Tuesday, October 29, 2013

Provisioning Amazon AWS Servers

These days, services like Amazon Web Services (AWS) have made it very simple and affordable to provision scalable virtual private servers for development, testing, and even production environments. So simple, in fact, that I'm going to show you just how.
Let's start by navigating to the AWS homepage. From there, click on the "Get Started for Free" button. Free, of course, is relative to what you're doing. I plan on provisioning RHEL servers that require a little more "juice" as well as features like Elastic IP's (more on this later). When we click on the get started button, we will be asked to create an account. Enter your login credentials and click Continue.


We will then be prompted for Billing information. Enter that as well and Continue. Based on the server type and add-ons we choose, we will be billed accordingly (ex. $0.12 per hour while server is up).



 Next, we'll select our support plan. I personally do not see the need for a support plan for my use but you might. Select the appropriate support plan and Continue.



 We are now logged in to our AWS account. Click on the "AWS Management Console" link on the left to get started launching an instance. 


 We will be using the EC2 (Virtual Servers in the Cloud) service under the "Compute & Networking" category. 

Once we reach the EC2 Dashboard we will be presented with many options for managing and monitoring our EC2 instances. Amazon really makes it easy for us by providing that layer of abstraction between us and the nitty-gritty server administration tasks. We will go over some of those tools later. Click on "Launch Instance" to get going.


 Finally, the good stuff! Amazon will now walk us through the steps of choosing and configuring our servers. The first step we're presented with is choosing an Amazon Machine Image (AMI). Per Amazon, AMI's are templates that contain the software configuration required to launch an instance. For our purposes, we're going to select the Red Hat Enterprise Linux 6.4 AMI.



Once you select your AMI, you are presented with instance types. Lets pick a good medium sized instance (m1.medium size).







If you're planning to launch more than one instance, you can do that here. We're going to choose 3 instances and accept the defaults for the rest. For those that have an unsteady mouse, I would select "Enable Termination Protection" so you don't accidentally terminate your instance (losing all work). The Virtual Private Cloud option is useful if you want to have complete control over your networking environment. VPC's allow you to select your own set of IP address ranges and create subnets for different server functionality. You can therefore create public-facing subnets for your webservers and private-facing subnets for your database and application servers. If you want to have this flexibility, create a new VPC and configure it accordingly. For now, we're going to accept the defaults with the exception of the number of instances (I happen to need 3).  



Next, we will add storage based on our needs. I happen to need about 25GB per instance. Click Continue. 






For security configuration, lets set up an SSH TCP firewall rule. If you know the IP's you want to connect to your server, you can specify those as well.






 Review Instance and LAUNCH!






After launching, you will be asked to create a new key pair. The key pair is essential for private key authentication from your machine to the AWS Instance. Download the key and store it somewhere safe. DO NOT LOSE IT! We will use the .pem file to generate a ppk file later to log ssh with putty.



 Your instances should now be running. 









In order to connect to the instances you will need to download putty.exe and puttygen.exe. Let's start with puttygen.exe. Click on the "Load" button and locate the .pem file you downloaded a minute ago. You will need to specify All Files in the drop down. Open the file and click OK to dismiss the confirmation dialog box. Click on "Save Private Key" and putty will save it with a .ppk extension. Open putty and under Connection > SSH > Auth browse for the private key file. Copy and paste the public DNS name and specify the ec2-user and connect. 

 


That's it. You're connected to your new AWS Instance.I hope you found this useful. If not, leave questions below and I will try to answer them. I'll go over setting up VNC and Desktop in a later post for those that need the graphical interface for easier installations of software on your Instances.





No comments: