Is your IT what you
need it to be?

Launching an EC2 Instance on AWS

Launching an EC2 Instance on AWS

This tutorial assumes that you have some level of familiarity with AWS and the terminology you will find associated with the service.

In this tutorial we are going to launch an EC2 virtual server on AWS. Elastic Compute Cloud (EC2) is simply a virtual computer that runs on AWS servers. For the sake of simplicity you can think of it as an independant server on the Internet.

Down to Business

Log in

The AWS console can be accessed at https://aws.amazon.com/console/. When you first log in to AWS you will find yourself at the console. Recently visited services will be listed and EC2 may be among them.

Type EC2 into the search box

The easiest way of locating the service you are looking for is to start typing into the search bar to help you find the service you are looking for.

Select EC2

After selecting EC2, you are taken to the EC2 Dashboard. This will display information about the EC2 resources you are using in your selected region. Currently we are not running any instances.

Select a region

You will want to select a region for your EC2 instance. Don't pick an instance that is geographically distant from your target audience. We want to keep the distance your data needs to travel to a minimum.

Log in

With your region selected you can now launch your instance by selecting the "Launch Instance" button.

Pick an AMI

You are now presented with a list of Amazon Machine Images (AMIs) from which you will need to make a selection. These AMIs are snapshots, or a template of an operating system. The AMIs presented initially are fairly "bare bones" systems, but you may want to delve into the AWS marketplace to find instances which have software pre-installed and configured.

Choose an instance type

There are many different types of instances you can select. Each type varies in what it was intended for. For the puposes of learning how to launch an instance let's select whatever instance is in the free tier for the region you selected. Free tier instances are clearly marked with a note under the Type column. An overview of instance types can be found at https://aws.amazon.com/ec2/instance-types/.

Configure instance details or review and launch

At this point we are presented with several options at the bottom of the page. The "Review and Launch" button will speed you past the next few steps and you will be presented with a bare-bones configuration. This will generally not meet your needs, so let's take the long way around and select "Next: Configure Instance Details".

Configure Instance Details and select "Next: Add Storage"

This next step allows you to configure many features about your instance. We will take a look into all of these settings in another article. For the purposes of getting your instance launched we will accept all the default values on this step. Select "Next: Add Storage"

Configure storage and select "Next: Add Tags"

Nothing happens without storage. By default your instance will only have an 8gb SSD attached to it. For most purposes you will need more, in particular if you are using this as a web server. Even better, adjust this first drive to a size you feel comfortable with for your OS and add another volume that will hold your data. Adding a second volume will allow you to detach that volume at some point in the future and to re-attach it to a new server.

Add tags and select "Next: Configure Security Group"

There are a number of ways that tags can be used in managing large numbers of servers. This is pretty much a free-form key-value pair that will be applied to instances, volumes and/or network interfaces. For example you may want to be able to run a script at some point that looks through all your instances for a key-value pair.

Configure your server security and select "Review and Launch"

Configuring the security settings on your instance will control which ports and protocols are accessible. Under the Type column you will have a selection list of common types of port and protocol combinations, but you can also add custom port ranges. You can also set the source IP. This is useful if you have a static IP address and only want your server to be accessible from that IP. The most common use case would be if your office has a static IP address your could configure your instance to only allow SSH access from your work. A source of 0.0.0.0/0 means it's open to the world. If you want to restrict access to a single IP address you would enter that address followed by /32 to limit it to that singular source.

Review your settings and select "Launch"

Here you are given the opportunity to review all your settings from the previous steps. Ensure they are correct and launch.

Choose your key pair option and "Launch Instances"

In order to access your instance you will need a private key file. Only in rare instances would your proceed without one. If you have previously gone through creating an EC2 instance in this region, you can choose the "Choose an existing key pair" option. In this particular case there are no existing key files so we will choose to "Create a new key pair". A name needs to be entered for this new key pair, and then select "Download Key Pair". A .pem file will be downloaded. This will be used with your SSH client to access your instance.

Launching...

For a moment you will be presented with a message while everything is prepared.

Select "View Instances"

Once the launch preparations are complete, you are presented with this message along with some initial details about your instance. Some useful links are also provided to AWS documentation under the "Here are some helpful resources to get you started" heading. Select "View Instances".

Your instance is launched!

We are now on the instances page where all your instances for this region are listed. You will note that you also have a "Launch Instances" button at the top-right corner. It's important to take a look and check the IP addresses associated with your instance. It will not immediately have an Elastic IP associated. An Elastic IP is a static IP address that remains with your instance. The public IP address assigned to your instance can be used to connect for now, but it is subject to change.