Setting up a Cloud Compute Instance

| 0 Comments | 0 TrackBacks

Setting up a cloud compute instance


Let's create an EC2 instance that is running Windows Server. You can use this either as a server or a workstation. Before you attempt this part of the lesson, you need to make sure you've done the following things. You need to have:
  • Obtained an Amazon account and enabled it for use with Amazon EC2
  • Applied the Amazon education credits to your account

If you have any doubt about one of these items, contact the course instructor by posting below or by email.

Here are the steps for getting a server running on Amazon EC2. Since Amazon can potentially update their site at any given time, some minor adjustments may be required for these steps. Contact the instructor if you have questions, or, if you find an issue that you are able to work around, please mention it in a comment below.

  1. Open a web browser to http://aws.amazon.com/console

    This application is called the AWS Management Console, and it helps you create and manage things on EC2, such as instances. This app has some quirks, and I've found that I have to run it in the Google Chrome browser to completely avoid them. Sometimes it will work in Firefox.
  2. Click Sign in to the AWS Management Console.
  3. Type your e-mail address (which is your Amazon account name) and password, then click Sign in using our secure server
    You should be taken to a screen with a bunch of tabs across the top, such as Elastic Beanstalk, S3, etc. These represent all the types of web services that Amazon offers. For now, you're interested only in EC2, which is Amazon's set of web services for renting hardware infrastructure.
  4. Click the Amazon EC2 tab. On the right, you'll see a summary of all the items you have running in Amazon EC2. There should be nothing listed. On the left, you'll see a menu of different categories of things you can create in EC2, such as Instances, Volumes, Elastic IPs, etc. You'll learn about a few of these as we go along.

    One thing you can select at this time is the region you want to work in. Amazon runs EC2 from various data centers placed around the world. You can choose which data center, or region, will house the resources you create. Typically, the closer you can place your region to your end users, the faster your services and apps will appear. But some organizations may also pick a region based on legal requirements relating to countries that can or cannot house their data. If you are working on this course from a continent other than North America, you may want to change the Region dropdown to choose a data center closer to you. Be aware that costs are slightly higher in some regions. You can see a list of costs at http://aws.amazon.com/pricing/ec2.
  5. From the left menu, click Instances. Ensure that you are using the "US East" region (there's a drop-down list in the upper left), then click the Launch Instance button. 

    In the window that appears, titled Create a new instance, be certain the radio button for Launch Classic Wizard is selected. Then hit Continue. A wizard appears that will help you create an instance. The first thing you're going to do is choose the Amazon Machine Image (AMI) that will determine the software and settings on your instance. You'll see that Amazon offers some basic AMIs containing just an operating system. Select one of the stock Windows instances, without a database installed.  
  6. You are taken to the Instance Details panel. Here you can choose the availability zone (AZ) in which your instance will run. AZs are Amazon's way of isolating machines within a region to minimize the chance of your site going down. For example, the US West region contains three AZs. The AZs are located in physically separate facilities that use different power grids, are built on different flood plains, etc. If your site contains multiple servers, you can place them in different AZs to minimize the chance of the full loss of your site if a data center is damaged. In your case, where you choosing one instance, you'll just leave this as No Preference to let Amazon select an available zone.
    On this panel you'll also choose the size, or computing power, of your instance. The instance size that you choose drastically effects the price that you pay, so follow these instructions carefully.
  7. Click the Instance Type dropdown and select High-CPU Medium (c1.medium). This is the largest type of instance for a 32-bit Windows server. It has good performance, and is economical (29 cents an hour for Windows, 17 cents an hour for Linux). Then click Continue.

    You're now viewing a panel where you can choose even more instance details. Some of these are beyond the scope of this course. However, you will enable Termination Protection. Terminating your instance deletes it forever. Termination Protection is nothing fancy; it just prevents you from terminating an instance until you explicitly disable termination protection on the instance. It's a way of making you go through an extra step to make sure you don't accidentally do something you didn't intend to do, which is helpful for beginners.
  8. Check the Termination Protection checkbox, then click Continue

    Now you're at a place where you can type a name for your instance. It used to be that your instances in the console were just assigned an ID. This was hard to keep track of once you had more than just a few instances, so Amazon allows you to type other metadata about the instance. This is stored as name/value pairs.
  9. In the Value column, go to the first text box (the one right across from Name), and type a name for your instance, such as Course Instance. Then click Continue.

    This first time you log in to your instance, you'll need to either know a pre-set Administrator password, or have one generated using a special file called a key pair in order to retrieve it. On this panel of the wizard you can create a key pair file.
  10. Click Create a new Key Pair, type a name for your key pair, then click Create & Download your Key Pair. A small, text-based file with the extension of .pem will be downloaded to your machine. Keep this key pair file in a safe place that you remember. You'll use it later in the course, although not with this OpenGeo instance.

    After downloading your key pair, you may be automatically taken to the next page of the wizard, but if not, click Continue. Now you will set some rules about what type of incoming Internet traffic can access your server. Amazon provides a firewall around every new instance that blocks all incoming traffic. You have to selectively "poke holes" in this firewall to allow appropriate types of communication with your server. In EC2 lingo, the set of rules that you create is called a Security Group.
  11. Click Create a new Security Group and type a group name and description.
  12. Find the Create a new rule drop-down list and choose HTTP. Then click Add Rule. You have just allowed HTTP access on Port 80 to everyone, thereby letting Internet users access your web services. Port 80 is the most common port used on the Internet for incoming web traffic into a server.
  13. From the Create a new rule drop-down list, choose RDP. Then click Add Rule. This rule is necessary so you can log in to and administer your instance, since Windows Remote Desktop requires port 3389 to be open.

    You may have noticed when you added those rules that you could specify a Source IP address using notation such as 0.0.0.0/0. This is called classless inter-domain routing (CIDR) notation and allows you to specify an IP address or a range of addresses that are allowed to connect through the port. With EC2 instances that you wanted to keep very secure, you would not typically open RDP access to all addresses (which we allowed by using 0.0.0.0/0). Instead, you would specify your IP address or your organization's range of IP addresses using CIDR notation. 

    If you know your IP address (easily attainable by visiting a site like whatismyip.com), try applying it to this rule to lock down your instance even more. Just be sure to put /32 at the end (for example: 67.168.99.22/32). The /32 is CIDR's way of limiting access to just the one address specified, instead of a range of addresses.

    Once you're done applying these two rules for HTTP and RDP, click Continue. EC2 now has all the information it has to launch your instance at this point.
  14. The wizard window now shows a summary of the instance that will be created. Examine it. Follow the Edit Firewall link and be certain that your Security Group is the one being used, then click Continue to return to the summary view. ClickLaunch. You'll see a message telling you that the instance is launching, which you can close.

    At this moment, somewhere in Amazon's data center, a virtual machine is being created for you with Windows on it.
  15. As the launch process proceeds, the My Instances window should appear, and you will see your instance listed. (You can also select the Instances link from the left menu of the AWS Management Console.). Within a minute or two, you'll see its status change from pending to running, but this does not mean the instance is ready yet. It takes around 20 minutes for Windows and the software running on your instance to configure itself. It's best not to disturb the instance while this is occurring.

    Every instance you create has a public-facing address, or Public DNS, that can be used to reference the instance from anywhere on the Internet. The challenge is that this address changes every time your stop and then start your instance. To give your machine a more permanent address, you'll set up an Amazon Elastic IP. This is an unchanging address that Amazon allocates to you for your use. You can then associate it with any instance you choose. Every time you stop and start the instance, you'll associate it with this IP address.
  16. At least 10 minutes after performing the previous step, open the AWS Management Console and click Elastic IPs.
  17. Click Allocate New Address, leave the drop-down list as EC2, and click Yes, Allocate.

    You should see an address appear in your list of Elastic IPs, such as 107.20.220.152.
  18. Click Associate Address, choose your instance from the drop-down (an instance must be running to appear here) and click Yes, Associate.

Once you launch an instance, the instance starts automatically and your Amazon bill begins accruing. It's very important to understand that you begin amassing charges right away; Amazon does not wait until you log in to your instance to begin charging you. In order to control costs, you need to stop your instance whenever you aren't using it. Before you take a break, please immediately continue reading the next section of the lesson to understand how to properly stop and start your instance.

No TrackBacks

TrackBack URL: https://blogs.psu.edu/mt4/mt-tb.cgi/397666

Leave a comment

Subscribe to receive notifications of follow up comments via email.
We are processing your request. If you don't see any confirmation within 30 seconds, please reload your page.

Search This Blog

Full Text  Tag

Recent Entries

How to stop and start your instance
Fortunately, you don't have to repeat all the previous steps to complete the Launch Instance wizard every time you want…
Setting up a Cloud Compute Instance
Setting up a cloud compute instanceLet's create an EC2 instance that is running Windows Server. You can use this either…
Week 12 Readings (and media)
This week we will read one paper and discuss its application to your term projects and we will view…