To install Ruby and Rails on your Amazon EC2 server there are a few steps you need to follow, but none of them quite hard. By default ruby is already installed on your server by Amazon - check it by running $ ruby -v.
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux]
For this tutorial I will not be using the Ruby Version Manager - RVM. It has the power to make it easier later to change ruby versions in a contained environment.
$ wget http://rubyforge.org/frs/download.php/75475/rubygems-1.8.11.tgz
$ tar -xzf rubygems-1.8.11.tgz
$ cd rubygems-1.8.11
$ sudo ruby setup.rb
$ gem -v
1.8.11
$ sudo yum install ruby-devel
$ sudo yum install make
$ sudo yum install ruby-irb
$ sudo gem install rails
This should be enough to let you use Ruby on Rails on your Amazon EC2 server.