In this module, you will create an Amazon EC2 instance to run your WordPress site. Amazon EC2 provides highly-configurable server instances on-demand. On an EC2 instance, you can run a WordPress site that will be accessible by users anywhere.

Time to Complete Module: 10 Minutes


When getting started with WordPress, you may test it out by installing and running it on your laptop or desktop. This is fine for a test but you will quickly hit its limitations. Your WordPress site will only be running as long as your laptop or desktop is running. Further, the site will only be accessible by you -- it won’t be available over the public internet.

A better approach is to use a server.

Amazon EC2 provides on-demand server provisioning. With Amazon EC2, you rent out server instances with varying sizes, each with different CPU, RAM, and network configuration. You pay by the hour for these servers, and you can use them to host websites, like your WordPress site. With an EC2 instance, your WordPress site will remain up and running and will be accessible by anyone over the internet.

In the steps below, you will launch an EC2 instance to host your WordPress site. 


  • Step 1. Choosing an Amazon Machine Image

    To create your EC2 instance, go to Amazon EC2 in the AWS console. Click the blue button that says Launch instance to open the instance creation wizard.

    Module2-step1a

    (Click to enlarge)

    Module2-step1a

    In the first page, you will choose an Amazon Machine Image (“AMI”). The AMI you choose will determine the base software that is installed on your new EC2 instance. This includes the operating system (Amazon Linux, Red Hat Enterprise Linux, Ubuntu, Microsoft Server, etc.), as well as the applications that are installed on the machine.

    Many AMIs are general-purpose AMIs for running many different applications, but some are purpose-built for specific use cases, such as the Deep Learning AMI or various AWS Marketplace AMIs.

    The Amazon Linux distro is a popular choice, so choose the Amazon Linux 2 AMI (HVM) in the AMI selection view.

    Module2-step1b

    (Click to enlarge)

    Module2-step1b
  • Step 2. Choosing an instance type

    On the second screen of the EC2 wizard, you will select an EC2 instance type. An instance type is a particular configuration of CPU, memory (RAM), storage, and network capacity.

    AWS has a huge selection of instance types that cover many different workloads. Some are geared toward memory-intensive workloads, like databases and caches, while others are aimed at compute-heavy workloads like image processing or video encoding.

    Amazon EC2 allows you to run 750 hours per month of a t2.micro instance under the AWS Free Tier. Select this option for this lab so that you won’t incur any costs on your bill. 

    Module2-step2a

    (Click to enlarge)

    Module2-step2a

    After selecting the t2.micro instance, click the blue Review and Launch button to skip some of the advanced configuration steps.

  • Step 3. Configuring a security group

    After clicking the Review and Launch button, you will be at a Review Instance Launch screen. You need to configure one more thing before launching your instance.

    Security groups are networking rules that describe the kind of network traffic that is allowed to your EC2 instance. You want to allow two kinds of traffic to your instance:

    SSH traffic from your current IP address so you can use the SSH protocol to log into your EC2 instance and configure WordPress;

    HTTP traffic from all IP addresses so that users can view your WordPress site.

    To configure this, click the Edit security groups link on the review page.

    Module2-step3a

    (Click to enlarge)

    Module2-step3a

    It will show the current rules in your security group.

    There is an SSH rule configured, but it allows SSH access from any IP address. Click under Source to restrict it to your current IP address.

    Module2-step3b

    (Click to enlarge)

    Module2-step3b

    Then, you need to add a new rule to allow HTTP traffic. Click Add Rule.

    Module2-step3c

    (Click to enlarge)

    Module2-step3c

    In the new rule that shows up, click the dropdown under the Type column. Select HTTP, and it will autofill default values for an HTTP rule.

    Module2-step3d

    (Click to enlarge)

    Module2-step3d

    Once you have the security group rules in place, give your security group a name in the Security group name input box. Name the group “wordpress” so that it will be easy to find.

    Once you’ve named it, click the blue Review and Launch button.

    Module2-step3e

    (Click to enlarge)

    Module2-step3e
  • Step 4. Launch and get an SSH key


    It is now time to launch your EC2 instance. Click the blue Launch button to create your EC2 instance.

    Module2-step4a

    (Click to enlarge)

    Module2-step4a

    You will see a details on how to configure a key pair for your instance. You will use the key pair to SSH into your instance, which will give you the ability to run commands on your server.

    Create a new key pair for your instance and give it a name. Then click the Download Key Pair button to download the .pem file to your machine, which you will use in the next module.

    Module2-step4b

    (Click to enlarge)

    Module2-step4b

    Once your key pair is downloaded, click the blue Launch Instances button to launch your EC2 instance.

    Module2-step4c

    (Click to enlarge)

    Module2-step4c

    You have successfully launched your EC2 instance. In the next module, we will configure your RDS database to work with your EC2 instance.