How to host a WordPress website in AWS EC2 instance – Part 1

How to host a WordPress website in AWS EC2 instance – Part 1

How to host a WordPress website in AWS EC2 instance – Part 1

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

This will be a 3-part series where in part 1 we are going to create an EC2 instance in AWS cloud to host our WordPress website, in the part 2 we will install and configure our WordPress website and in part 3 will complete the setup by enabling DNS and TSL/SSL for our WordPress website.

For those who are completely new to AWS cloud, an EC2 instance is basically a server that is hosted in AWS cloud and we are going to provision this cloud server in this blog post.

Create an AWS EC2 instance to host a WordPress website:

Prerequisites:

Step 1: Login to AWS Management Console and navigate to EC2 service.

https://aws.amazon.com/

How to host a WordPress website in AWS EC2 instance – Part 1

Step 2: Select your region and click “Launch Instance”.

How to host a WordPress website in AWS EC2 instance – Part 1

Note: AWS has datacenters in multiple geographic locations called region and unless you are using a CDN solution, its recommended to host your website near your target audience.

Step 2: Select “Amazon Linux 2” AMI for your EC2 instance.

How to host a WordPress website in AWS EC2 instance – Part 1

Note: AMI or Amazon Machine Image is a template containing OS and other Applications pre-configured and is used to deploy new EC2 instance. AWS provides AMI for all type of OS and architecture and we are using “Amazon Linux 2” AMI which contains a strip down version of Linux.

Step 3: Select the instance type and click “Next configure instance default”

How to host a WordPress website in AWS EC2 instance – Part 1

Note: Instance type basically defined the resource (CPU, RAM and Network) allocation to your server.

Step 4: Configure EC2 instance details.

We will keep default configuration options for the moment which if required can be changed once the server is provisioned. Click “Next Add Storage”.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 5: Configure storage options.

Again, we will keep the default and move to next step.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 6: Optionally you can add a tag to easily identify your server if you have multiple servers.

Click “Next: Configure Security Group”.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 7: Create the security group configuration for your EC2 instance.

How to host a WordPress website in AWS EC2 instance – Part 1

Note: Security group is basically the firewall to your server where you configure which port to open. Since we are creating a website, we need to open port 80 and 443 for HTTP and HTTPS communication from anywhere. You also need to open port 22 for connection to your server using SSH. I have provided my local system public IP address but if you don’t have the public IP address then though not recommended, you can open the SSH port to accused from anywhere like we did for HTTP and HTTPS.

Step 8: Click on the “Launch” to deploy your server in the AWS cloud.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 9: Provide key pairs details and click “Launch instances”.

Select “Create new key pair” provide a name. Download the private key and store in a safe location. This key will be used later to connect to your server over SSH. Click “Launch instances” to launch your EC2 instance.

How to host a WordPress website in AWS EC2 instance – Part 1

You now have a brand-new server in AWS cloud, click on the instance id to navigate to your server.

How to host a WordPress website in AWS EC2 instance – Part 1

Next, we are going to assign a Public static IP address to our server so that IP address does not changes after every reboot of the instance.

Step 10: Under “Network & Security” click “Elastic IPs” and then click on “Allocate Elastic IP address”.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 11: Select “Amazon’s pool of IPv4 addresses”, optionally you can create a tag to easily identify this elastic IP address. Click “Allocate”.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 12: Next, we will associate this elastic IP address with our EC2 instance, click “Associate Elastic IP address” under “Actions”.

How to host a WordPress website in AWS EC2 instance – Part 1

Step 13: Select your EC2 instance and private IP address and click “Associate”.

How to host a WordPress website in AWS EC2 instance – Part 1

Note: Copy this IP address for later use, our website will use this IP address.

Next, we will connect to the EC2 instance.

Step 14: Connect to your EC2 instance –

Using Browser:

Select the instance and click “Connect”.

How to host a WordPress website in AWS EC2 instance – Part 1

Select the “EC2 Instance Connect” tab and click “Connect”.

How to host a WordPress website in AWS EC2 instance – Part 1

How to host a WordPress website in AWS EC2 instance – Part 1

Using external tools :

Install Putty or MobaXterm

Open Putty or MobaExterm or any other tool that you are using and provide your private SSH keys, Public IP address and Username to connect to your AWS EC2 instance. For example, below is a screenshot for MobaExterm connection:

How to host a WordPress website in AWS EC2 instance – Part 1

Using command line:

Hope you have enjoyed this 1st part where we have created the EC2 instance. In the second part we will install and setup our WordPress application.

Leave a Reply

Close Menu