Getting Started with AWS

Deploy WordPress

with Amazon RDS

Module 2: Creating an EC2 Instance

In this module, you will create an Amazon EC2 instance to run your WordPress site.

Introduction

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.

What You Will Learn

  •  Create an Amazon EC2 instance to run your WordPress site

 Time to Complete

10 minutes

 Services Used

Why use Amazon EC2 for your WordPress site

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. 

Implementation

  • 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.

    Click the launch instance button

    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.

    Choose the Amazon Linux 2 AMI (HVM) in the AMI selection view
  • 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.

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

    After selecting the t2.micro instance, click the blue Review and Launch button to skip some of the advanced configuration steps.
  • 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.
    Click the edit security groups link on the review page

    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.

    Click under Source to restrict it to your current IP address.

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

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

    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.

    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.

    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.

    Name the group “wordpress” so that it will be easy to find. Click the Review and Launch button.
  • 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.

    Click the blue launch button to create your EC2 instance.

    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.

    Then click the Download Key Pair button to download the .pem file to your machine

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

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

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

Was this module helpful?

Thank you
Please let us know what you liked.
Close
Sorry to disappoint you
Is something out-of-date, confusing or inaccurate? Please help us improve this tutorial by providing feedback.
Close

Configuring Your RDS Database