Login | Register   
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

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


advertisement

One basic concept that escapes most cloud newbies is the fact that you are accessing a remote resource as if it were local; a very basic yet very powerful concept to understand. When think of how to approach development for the cloud, you could simply ask: What would you do if the node you are accessing is right in your own datacenter?

Amazon EC2 provides all you need to create an ecosystem or environment that allows seamless access to a remote virtual environment. One main difference is EC2's auto scaling capability, which automatically increases or decreases the number of running Amazon EC2 instances to match demand. Scaling takes place when a metric's upper or lower boundary threshold is breached for the duration specified by the user's configuration. In essence, you create low and high water marks that if are breached, the number of machine instances (called Amazon machine images or AMIs) changes.

My previous article focused on the basics of the Amazon EC2 cloud offering. In this article, I will discuss how to actually get started with the EC2 infrastructure. Keeping only to EC2 for AWS newcomers, I will not cover other services that Amazon offers such as MapReduce, Database, and Simple Queuing Service. In fact, this article skips over many of the required steps for using EC2; you should use it only as a general beginner's guide.

Accessing Amazon EC2 with REST

There are many ways to access EC2, and in this article I will focus on the most basic and platform-independent way: via REST. There are APIs that do the same thing, but I will leave that for future articles. I want to cover REST first because I can use it as the basis to illustrate how things actually work, even though most times a higher-level programming language is used.



One basic assumption here is that you have an account set up already with the proper credentials.

There are a number of classes of Amazon Machine Images:

  • Free
  • Custom-made ones you make yourself
  • Custom-made ones that you pay for

For many grid-type applications (the type I often work with), the vanilla image will do just fine -- after all, all you need to do is compute, right? Right!

So I need to construct a REST request that asks for all the available AMIs.

https://ec2.amazonaws.com/?Action=DescribeImages&User.1=amazon&AUTHENTICATOR

This message will find and return all the images owned by Amazon. Amazon also provides an authenticator, which you need to use for access every time. You might get something like the following as the result.

<DescribeImagesResponse xmlns="http://ec2.amazonaws.com/doc/2010-11-15/">
   <imagesSet>
      <item>
         <imageId>ami-be3adfd7</imageId>
         <imageLocation>amazon/getting-started</imageLocation>
         <imageState>available</imageState>
         <imageOwnerId>206029621532</imageOwnerId>
         <isPublic>true</isPublic>
         <architecture>i386</architecture>
         <imageType>machine</imageType>
         <kernelId>aki-d3376696</kernelId>
         <ramdiskId>ari-e73766a2</ramdiskId>
         <imageOwnerAlias>amazon</imageOwnerAlias>
         <name>getting-started</name>
         <description>Fedora 8 v1 ec2pnp enabled</description>
         <rootDeviceType>ebs</rootDeviceType>
         <rootDeviceName>/dev/sda</rootDeviceName>
         <blockDeviceMapping>
            <item>
            <deviceName>/dev/sda</deviceName>
            <ebs>
               <snapshotId>snap-32885f5a</snapshotId>
               <volumeSize>15</volumeSize>
                   <deleteOnTermination>false</deleteOnTermination>
            </ebs>
            </item>
         </blockDeviceMapping>
      </item>
   </imagesSet>
   ...
</DescribeImagesResponse>

This completely generic sample basically provides all you need to know about the image. What is important is the imageId, which Amazon will use as the OS to boot up your instances.



Comment and Contribute

 

 

 

 

 


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

 

 

Sitemap