Once you got new EC2 server it’s usually necessary to compile something like fresh Nginx or customized PHP version. Run following command first of all to prepare your environment:
yum groupinstall “Development Tools”
Now you have gcc, headers and tools ready for hard work!