DEV Community

Cover image for Deploy WordPress on EC2 by WordPress AMI
Fady Nabil for AWS Community Builders

Posted on

Deploy WordPress on EC2 by WordPress AMI

  • Wordpress
    WordPress is a highly popular content management system (CMS). It is most commonly used for blogs but can also be used for running e-commerce sites, message boards, company websites, Portfolio Websites and many other popular use cases. In this guide, you will learn how to set up a WordPress site to run a blog.

  • AWS Services services that use in this project
    An Amazon EC2 instance to install and host the WordPress application.

Implementation

Creating an EC2 INSTANCE and Choosing an Amazon Machine Image

a. Open the AWS Management Console. When the screen loads, enter EC2 in the search bar, then select EC2 to open the service console.

Image description

b. Choose the Launch instance button to open the instance creation wizard.

Image description

c. On the first page, enter wordpress app as your instance name.

Image description

d. Next, 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.), and 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.

WordPress image is certified by Bitnami as secure, up-to-date, and packaged using industry best practices, and approved by Automattic, the experts behind WordPress, so choose WordPress Certified by Bitnami and Automattic after make search on AWS Marketplace AMIs in the AMI selection view.

so write Wordpress on search bar then click Enter

Image description

e. You will find the first image, choose it and press on Select

Image description

f. Read overview and all details about AMI then click Continue

Image description

g. You will return to the AMI Section and you will find that the image has been selected.

Image description

Choosing an instance type

Scroll down to 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, such as databases and caches, while others are aimed at compute-heavy workloads, such as 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.

But in this image .. AMI vendor recommends using t3a.small instance

a. Select the t3a.small instance.

Image description

Configuring an SSH key

You will see a details page 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.

a. Open the key pair (login) section and choose Create new key pair for your instance.

Image description

b. Give your key pair a name. Then choose .ppk in Private Key file format to can use with PuTTYThen. Then choose the Create key pair button, which will download the .ppk file to your machine. You will use this file later.

Image description

c. You will return to Key pair (login) Section and you will find that Key has been selected.

Image description

Configuring a security group and launching your instance

You need to configure a security group 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 traffic to your instance:

  • SSH traffic from all IP addresses so you can use the SSH protocol to log in to your EC2 instance and configure WordPress.
  • HTTPS traffic from all IP addresses so that users can view your WordPress site Secured.
  • HTTP traffic from all IP addresses so that users can view your WordPress site.

a. To configure this, select Allow SSH traffic from Anywhere and select Allow HTTPS & HTTP traffic from the internet (These are the default choices when choosing an Wordpress AMI).

Image description

Configuring storage on instance

a. Here we can increase the storage space for the Root volume and also can be added more volume storage.

Image description

Launch

It is now time to launch your EC2 instance.
a. Choose the Launch instance button to create your EC2 instance.

Image description

b. Wait for instance to launch.

Image description

c. You have successfully launched your EC2 instance. Click on Open address to view website.

Image description

Deploying Wordpress

a. You should see the WordPress welcome page.

Image description

b. Add /wp-admin after the end of the link to reach the admin page to manage everything on the site.

Image description

c. You should see the WordPress login page.

Image description

SSH into your EC2 instance to know login information

You will use SSH to connect to your EC2 instance and run some commands.

a. Go to the EC2 instances page in the console. You should see the EC2 instance you created for the WordPress installation. Select it and you will see the Public IPv4 address and the Public IPv4 DNS in the instance description.
Click on Copy icon to copy public ip

Image description

b. Open PuTTY appliction and paste public ip in Host Name (or IP address).

Image description

c. Click on + the one next to SSH in Category list.

Image description

d. Then click on Auth.

Image description

e. In Private Key file for authentication, Click on Browse

Previously, you downloaded the .ppk file for the key pair of your instance. Locate that file now. It will likely be in a Downloads folder on your desktop.

open this .ppk file

Image description

f. Click on Open.

Image description

g. You should see the following in your terminal to indicate that you connected successfully.

then you will log in with bitnami (bitnami is deafult).

Image description

Wordpress Credentials

a. Run the following command to see your application credentials.

sudo cat /home/bitnami/bitnami_credentials
Enter fullscreen mode Exit fullscreen mode

Image description

b. You will find WordPress Credentials, make copy for username and password.

Image description

c. Back to WordPress Admin login then make paste for username and password then click on Login.

Image description

d. You should see the WordPress Admin page.

Image description

Top comments (0)