Deploying Rails Application on Amazon Ec2
Posting after a long time. But any ways below are the steps if you want to deploy a rails app on ec2 directly without using any 3rd party service providers
All the details mentioned below after for ubuntu so path might vary for other Linux flavours.
step 1 = Set java home. Ofcourse you need to have java installed and I assume that you already have it installed.
Step 2 = login to amazon aws go to the account tab and download security credentials. You will see 2 things
1) private key 2) certificate
Download them and store it on some path like /home/dhaval/cert or whatevery
Than export the keys and set it up with the following commands
Step 3 = Download api tools available on aws site
export it and set the path
Step 4 = set up ssh keys using the following commands
Now save this generated kaypair in ~/.shh folder with name id_rsa-gsg-keypair
Step 5 = Start an instance using the command below
ec2-run-instances (ami instance name) -k gsg-keypair
Step 6 = Check status of the instance
check status with
ec2-describe-instances (instant name)
Step 7 = Authorization of network ports using commands as below
ec2-authorize default -p 22
ec2-authorize default -p 80
Step 8 = Connect to your instance using the command below
ssh -i id_rsa-gsg-keypair root@machine_name
Thats all once these steps are done you can see the instance running on the aws console.
Than install ruby gems + rails + other required gems and packages and you are set to go.
In order to upload your files you can use Capistrano or also you can ssh through ftp using the key specified.
Hope this helps. If you are stuck at any step do feel free to ask question and I shall get back to you.