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:
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:
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.
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:
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.