Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

A Quick Start Guide for Deployment to the Amazon EC2 Cloud : Page 2

You've heard all the buzz about cloud computing, but how do you actually get started with a cloud service like Amazon EC2.


advertisement

Accessing Your Amazon EC2 Instance

The next thing to do is to create a key-pair to be used to access your instance. The concept is the same as the REST request:

https://ec2.amazonaws.com/?Action=CreateKeyPair&KeyName=gsg-keypair&AUTHENTICATOR



You will then need to create a file id_rsa-mykeypair and paste everything between the two lines in that file, the two lines inclusive.

"-----BEGIN RSA PRIVATE KEY-----" KEY IS HERE "-----END RSA PRIVATE KEY-----"

Make sure you set the proper permissions on the file and make sure that it is in your path.

>>> chmod 600 id_rsa-mykeypair

Amazon now requires you to authorize access to your instance. This is to ensure that you or someone you trust can access these instances. I mostly like to access thru ports 22 (SSH) and 80 (HTTP). I then need these two requests:

https://ec2.amazonaws.com/?Action=AuthorizeSecurityGroupIngress&GroupName=default&IpProtocol=tcp&FromPort=80&ToPort=80&CidrIp=0.0.0.0/0&AUTHENTICATOR

https://ec2.amazonaws.com/?Action=AuthorizeSecurityGroupIngress&GroupName=default&IpProtocol=tcp&FromPort=22&ToPort=22&CidrIp=your-public-ip-address/32&AUTHENTICATOR

The tricky part here is to make sure that you get your public IP address right. If you use a DSL or cable line, the address might change and nothing will work until you resubmit your request; something that has happened to me a number of times.

Let's start the images.

https://ec2.amazonaws.com/?Action=RunInstances&ImageId=ami-be3adfd7&MaxCount=10&MinCount=2&KeyName=gsg-keypair&Placement.AvailabilityZone=us-west-1a&AUTHENTICATOR

As you can see, I asked Amazon to create at least two instances of the image (given by the image ID) and most 10, depending on the load. I will get two instance IDs in return.

What I require is a dnsName to access the instance(s). But when you request instances to be started, the dnsName entries that you get in return are all empty! You can use describeInstances to get the dnsName for every instance:

https://ec2.amazonaws.com/?Action=DescribeInstances/&InstanceId=i-2ba64342&AUTHENTICATOR

This will return information about each instance, and part of that is the public IP address that can be used to access the instance(s).

I am now ready to deploy and use!

For more information, be sure to read some of the EC2 documentation that are freely available from Amazon. Much of what I know, learned and showed you here are directly from the documents.



Art Sedighi -- Contributing Editor, Cloud, HPC and Grid -- is a freelance writer and IT consultant. Mr. Sedighi was the CTO and founder of SoftModule and held the senior consulting engineer position at DataSynapse. He received his BS in Electrical Engineering and MS in Computer Science, both from Rensselaer Polytechnic Institute.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap