Longstreet Labs Blog

Tutorial: How to launch an Amazon EC2 instance

Posted by Daniel Waltzer on Oct 12, 2016 3:32:00 PM

So, you're setting up a new website and you've got some basic coding skills. You know you want to use the Wordpress CMS to manage your site, and you've heard that Amazon Web Services (AWS) offers cloud servers that are inexpensive, scalable, and easy to maintain. You're ready to pull the trigger, but you don't know exactly where or how to start. Well, fear not! In this post, we'll talk you through a step-by-step process for setting up a server on AWS.

PREREQUISITES

First things first, you'll need an AWS account, which you can sign up for here if you don't already have one. Once you have your account, you'll want to log in and choose the region where your server will sit (for this tutorial, we'll use Northern Virgina).

aws1.jpg

Keep in mind that, for website speed purposes, you'll want to use a region that is closest to there area from which the majority of your traffic will come.

 

LAUNCHING AN EC2 INSTANCE

Now that your AWS account is ready to go and you're working in the right region, you're ready to launch a new EC2 instance (a.k.a. server). From the dashboard, click on "EC2" and then "Launch Instance."

aws2.jpg

From here, you'll see a list of instance types that you can launch. The first option is Amazon's Linux AMI, which we recommend using for your basic Wordpress site - this is the AMI we'll be using for this tutorial.

aws3.png

Once you select it, you'll be asked to choose the instance type. We could write a whole series of posts on which type is right for different sites. For most low- to medium-traffic websites, the t2.mico instance will be sufficient. Plus, it's elligible for Amazon's free tier, and you can always upgrade the server at a later date.

Select the t2.micro instance and click "Next: Configure Instance Details." While you may be tempted just to click "Review and Launch" and be done with it, there are some important configurations that you must first make.

aws4.jpg

From there, you're taken to a screen that lists some configurable instance details. The only one that you should pay attention to is "Enable termination protection" - we highly recommend enabling termination protection, which stops you from accidentally deleting the server if you get too clicky later.

From here, click on "Next: Add Storage," which prompts you to select the size of your server's hard drive. The default drive size is 8gb, which should be more than sufficient unless you're going to be storing lots of videos and pictures.

Next step, click "Next: Tag Instance." Here, you'll get to name the instance for internal identification purposes.

Then, click "Next: Configure Security Group" to proceed to the next and final step. Amazon's security groups is another topic that could warrant its own series of posts, but here's the short version of what you need to know: your security group determines what traffic can access your server and website. First, name your security group something like "General Website Security Group" (because you'll be able to reuse this group for future websites. Now, there are some important rules that you'll want to add:

  • SSH (port 22) - grants SSH access to the server
  • HTTP (port 80) - this is where your website traffic comes from
  • MYSQL (port 3306) - this is where traffic to your MySQL database comes from. You'll need to enable access from the source "Anywhere" if you wish to access your database remotely
  • HTTPS (port 443) optional - if you're going to set up an SSL certificate and allow traffic over HTTPS, then you'll need to enable access to port 443

Your final setup should look something like this:

aws5.png

Next, click "Review and Launch," and take one last look before you launch the server. When you've confirmed that all the details look right, click "Launch."

At this point, you'll be asked to choose a key pair or create a new one. This is a very important step in the process. Amazon does not use passwords to allow SSH access to the server. Instead, they use private key files for identification. Choose the "Create a new key pair option" and then name the key and download it. The key's name should include something to identify which server/website it is for, so that you don't get confused later when you have many different sites. Most importantly: save the key file somehwere that you will not lose it. You can never re-download the key, and if you lose it, you won't be able to access your server.

aws6.png

After downloading the key pair, click launch, and your server will start itself up! At the bottom right of the success screen, you'll see a "View Instances" button: click it and then select your new instance to view its details. Take note of its "Public DNS" and "Public IP," as you'll need to use either of these addresses to access the site.

aws7.jpg

Now, keep an eye on the "Status Check" column. When the status changes from "initializing" to "2/2 checks passed," your server is ready for use.

 

Hosting a Wordpress Site on EC2

Now that your instance is ready to go, you can install a web server, set up Wordpress, and then host your site all on your own.

Next steps:
For a full tutorial on how to host Wordpress on your new instance, follow the steps in this next post.

Topics: Wordpress, Tutorials, AWS

The blog for businesses with customers

Subscribe to Email Updates

Recent Posts