First install xvfb which will allow you to run it with a "virtual screen".
sudo yum -y install xorg-x11-server-Xvfb
Then you should check out this helpful post which will help you get firefox installed on amazon EC2. This is because you can't just do sudo yum install firefox on EC2. So, basically you create a file (I used this gist) on the EC2 instance that he provides and then run it to install firefox and all of it's dependancies.
When the script runs it will install firefox in
by default I believe.
Once it has installed you probably then need to add it to your path as the above link also explains. But you should also add the DISPLAY system variable though so do something like this...
cat << EOF >> ~/.bashrc
Then you have to kick off xvfb for screen 99 so it will be able to run firefox on it's "virtual screen". Like so...
Xvfb :99 -screen 0 1024x768x16 &
Then hopefully when you re-run your selenium tests it will find firefox on the path and run it in the correct "virtualised" screen on that EC2 instance.
As a side note - I am not by any means an expert of any type in amazon linux so... Goodluck.
Alternatively, you could investigate running against selenium server which you could fire up on an amazon EC2 ubuntu micro instance, which you can easily setup to have a GUI.