We claim that the answer is 2028. We will use a well-known lemma as follows:
If \( p \equiv 2 \pmod{3} \) is a prime number, then the map \( x \mapsto x^3 \) is surjective.
To solve the problem, note that \( 2027 \equiv 2 \pmod{3} \) and 2027 is a prime number. We consider two cases:
If \( 2027 \mid b \), then \( 2027 \mid b^5 + b^2 \), which implies \( a = b = 2027 \), and this works.
Conversely, we have
\[
\left( \frac{a^3}{b} \right)^2 + 1 \equiv -b^3 \pmod{2027}.
\]
Pick any \( \chi = \frac{a^3}{b} \in \{1, 2, \dots, 2027\} \). Then, the right-hand side (RHS) is uniquely defined, and from the claim, \( b \) is uniquely defined. Moreover, \( a^3 = b\chi \), and by the claim, \( a \) is uniquely defined. Therefore, there are 2027 solutions for this case.
We must be cautious with the case when RHS \( \equiv 0 \pmod{2027} \), which leads to a contradiction. However, this is impossible because it implies
\[
2027 \mid \left( \frac{a^3}{b} \right)^2 + 1,
\]but \( 2027 \equiv 3 \pmod{4} \), a contradiction.