You might be missing a repository, I don't have experience with RHEL based Linux distributions but if you give more details about what Linux distribution you are using on your EC2 instance someone could give you a solution.
Also, even if there is no libgit2-devel available for your Linux distro, you can always compile it from source.
git clone https://github.com/libgit2/libgit2
cd libgit2
mkdir build && cd build
sudo su
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build . --target install
cd ..
rm -rf libgit2
exit