AWS Tutorial For Beginners: AWS Elastic Compute Cloud (EC2)

AWS Elastic Compute Cloud – EC2
EC2 is the first service you will use in your business to really start putting the horsepower of AWS to work for you. It is the service that provides you with virtual servers to the whatever work it is that you want a server to do. Web servers, database servers, application servers, and more all can be made available with EC2.

With EC2 the setup of a new server just means setting some configuration options from the EC2 console and launching the server. In just a few minutes it will be online and ready for work. You can then install the applications you need. Or, if you’re looking for a server with some standard functionality there’s a shortcut to getting that going.

AWS EC2 offers a library of server images that come preinstalled with software. With these images, just select the one you want to launch and when the server comes online you already have everything you need preinstalled.

This is the approach we’ll be taking in today’s lesson to bring a web server online up and running with WordPress right out of the box.

So without further ado… Let’s get started!

EC2 Web Server Launch
Log into the AWS console with your administrator account and password. You’ll be presented with a plethora of choices for which AWS service you want to work with. Today, the magic password is “EC2”. It may be available in the default list of services, but if not, entering it in the search box and pressing enter will take you right to it.

Now you’re ready to launch a new server.

Right at the top of the screen you will see the “Launch Instance” button. Click it to get started.

You will be presented with a screen to select an Amazon Machine Image, AMI, to use for your new server. As mentioned earlier, we’re going to be using a pre built web server AMI. To find the proper choice click the “AWS Marketplace” link.

Enter “WordPress” in the search text box and hit enter.

You will be presented with a list of AMIs that host the WordPress website engine. The specific AMI you are looking for is “WordPress Certified by Bitnami”. It should be the first one on the list but Amazon selections change from time to time so be sure you check this AMI for:

  • $0.00 per hour cost
  • Free tier eligibility
  • Runs on Ubuntu

The second bullet point above is worth noting. Amazon charges an hourly fee for the servers you have running with EC2. If this is your first foray into AWS you will likely be eligible to use their free tier pricing for the first year. This means you get a certain number of server hours, it’s typically around 720, per month for eligible instances for your first year.

This is a way for Amazon to encourage you to try out their services and get familiar with them before you are ready to make a larger commitment to AWS. To take advantage of this offer while you are getting started with AWS just make sure you are selecting an AMI that is “Free tier eligible”.

Also, be aware that this 720 hours is for your whole account, not each server. So if you have two servers you can run them for 360 hours each, or approximately a half a month, and then you would start being charged for their use. You can see Amazon’s current pricing for EC2 instances on their EC2 Pricing Page.

For this lesson and the rest of this course we’re going to be using an t2 micro instance that costs $0.0116 per hour. For 720 hours in a month that comes to $8.352. Not overly expensive for a fully functional web server.
Once you’ve located the appropriate AMI, click the “Select” button to go to the next step.

You’ll be presented with a pop-up window to verify all the details of the AMI you’ve selected. Take one last look at everything to make sure you’ve made the correct selection and if everything looks right, click the “Continue” button.

This brings you to the instance selection screen. We’ve already covered this briefly above. You are looking for the t2 micro instance. It should be labeled with “Free tier eligible”. Click the checkbox for it and then click the “Next: Configure Instance Details” at the bottom of the page.

This page is full of configuration information. Some of it, like auto scaling, we will cover in future lessons in this course. For now, just make sure that the option to auto-assign a public IP address is enabled. This will make sure the instance can be reached on the web.

There are other options like additional storage that we won’t be covering in this lesson. The default selections for this are fine for our purposes. Leave them as they are and click the “Review and Launch” button.

Again, on this screen the defaults are fine for our purposes here. Leave them alone and click the “Launch” button.

You will be prompted to create a key pair. This is an important security measure. It means that only people with access to the key pair will be able to log into the server to make changes in the future.

Choose the “Create a new key pair” option. Enter a meaningful name in the “Key pair name” text box and click the “Download key pair” button. This will place a “.pem” file in your downloads location. Make sure and place a copy of this key file in a secure location that you will continue to have access to. Making a second backup copy in another secure location is also a good idea.

Once you’ve downloaded and secured the file click the “Launch Instances” button.

Now’s a good time to go get a cup of coffee or beverage of your choice. The launch process will take a few minutes to complete.

When you’re back click the “View Instances” button. Your new EC2 instance should be in a state of “running”. You are now ready to configure your WordPress website.

You’ll need your administrator credentials for WordPress at this point. Here’s how to get them.

Select the check box for your instance in the list of instances. Select the “Actions” drop down menu at the top of the list. Hover over the “Instance Settings” option. Another menu will pop out. Select the “Get System Log” option.

You will see a new popup window with all the log entries from the setup of your new instance. Scroll down until you see a section that looks like:

# #
# Setting Bitnami application password to ‘************’ #
# (the default application username is ‘****’) #

Where I’ve entered asterisks (*) above you will see your password and default application name. Make note of these. You will use them in the next step to access the administrator functions of your WordPress website.

Close the system log and make sure your instance is selected in the list of instances. This will display the instance details at the bottom of the screen.

Copy the URL next to the label “Public DNS (IPv4)” and paste it into a new browser tab. This will display your new, fully operational, WordPress website.

You can browse around and see what was setup by default. Once you’ve got a feel for it, the last step in today’s lesson is to access the administrator console.

In the browser bar, paste the URL you used above but add “/wp-admin/index.php” to the end of it. This will take you to the WordPress administrator login screen. Enter the username and password you noted above and click the “Login” button.

This will take you to the dashboard for your WordPress site. Configuring WordPress isn’t in the scope of this lesson but if that’s a topic you would like to explore further I recommend the book “WordPress: The Missing Manual” (This is an affiliate link, so if you buy after clicking it I earn a small commission on the sale). It is over six hundred pages of information on WordPress.

You can read it cover to cover or pick and choose the topics you need or are interested in.

Extra Credit!
One of the most useful features of EC2 instances is that you can create your very own AMIs from them once you’ve got them just the way you want them. That means you don’t have to go through all the steps of configuring a new server when you want a second or third to match your first. Simply create a snapshot of your existing instance and it will be stored for use later when you need it.

The steps to do this are simple.

First, select EC2 from the services drop down menu. Click on the “Instances” link to show all of your EC2 instances.

Click on the instance you want to create an image of. From the “Actions” drop down select “Image>Create Image”. You will see a pop-up asking you to name your image and give it a description. You can also change the storage size and storage type.

Go ahead and enter a name and description and click the “Create Image” button. We’ll be making use of this in Lesson 4. The image creation process will kick off and should be complete in a few minutes.

You can can view your AMI by clicking the “AMIs” link in the “Images” section of the left column.

Wrapping Up
So where are you now? In today’s lesson we covered the basics of EC2 on AWS and walked through the steps necessary to launch an EC2 instance with a WordPress website pre installed.

You’ve familiarized yourself with the EC2 console and are now able to launch an EC2 instance of your own. You have a functioning website running on AWS that you can access and configure to meet your needs.