Wednesday, March 16, 2011

My experience with Clouds.... Setting up an EC2 instance in Amazon Cloud

I was fortunate enough to work on Cloud computing way back in the year 2007-08 ! Well, I
bet that time not many people heard about cloud computing at least not in the Kolkata :-) ...
Since then Cloud computing has advanced in leaps and bounds.
Following are the few things which I could recapture from the past...
Ø To list available Amazon Machine Image (AMI) instance:
# ec2-describe-images -o self -o amazon
Look for the line containing the public image identified by the ec2-public-images/getting- started.manifest.xml value in the third column and note the corresponding value in the second column (in this example, ami-5bae4b32). This is the AMI ID you need.
In our case it was the following:
IMAGE ami-2bb65342 ec2-public-images/getting-started.manifest.xml amazon available public
Ø To Run the instance:
# ec2-run-instances ami-2bb65342 -k my-keypair
INSTANCE i-1be81b72 ami-2bb65342 pending my-keypair 0 m1.small 2007-01-22T08:25:59+0000
Ø To check the status of the Instance at any time:
# ec2-describe-instances i-1be81b72
Ø To check the status of the all the Instances at any time:
# ec2-describe-instances
RESERVATION r-1fc12b76 175778090924 default
INSTANCE i-1be81b72 ami-2bb65342 ec2-72-44-34-181.z-2.compute-1.amazonaws.com domU-12-31-35-00-05-E1.z-2.compute-1.internalrunning my-keypair 0 m1.small 2007-01-22T08:25:59+0000
Ø To connect to the instance (Do it from where you have kept the file i.e. id_rsa-my-keypair )
# ssh -i id_rsa-my-keypair root@ec2-72-44-34-181.z-2.compute-1.amazonaws.com
Ø To open a port on EC2 Server (For example if you want to port 22 public):-
# ec2-authorize default -p
Example for port 22
# ec2-authorize default -p 22