How to Setup AWS S3 in WordPress

It’s been more than a decade that Amazon launched its Elastic Compute Cloud and people have been talking about its advantages for a few years now, but people still are resistant to switch as it lacks in integration with cPanel and WHM.

I did some research on the Amazon Web Services (AWS) and got to know about the latest changes in integration, and now I don’t feel the need to switch back to my old hardware anytime soon.

Then I thought of using cPanel and WHM (interfaces I'm very familiar with) in AWS. I looked around for a few days but couldn't find a reliable source and also the information was also not fully categorized and was not very easy to understand.

So I decided to put up all the steps in proper order to set up VPC, Security Groups, Your EC2 instance, S3 Storage, Route 53 DNS and cPanel/WHM using AWS.

So get your focus here and understand each step correctly. I'll start with Setup of Amazon Virtual Private Cloud (VPC), and move further through all the topics individually, Let's get started.

How To: Set Up cPanel & WHM on Amazon Web Services

First things first, you need to login to your Amazon AWS Management Console.

Let's talk about how to Set Up VPC.

HOW TO SET UP VPC ON AWS

  1. Click on the Compute and Networking Region and then click on the VPC Icon.
  2. Start the VPC wizard appearing on the screen.
  3. Another window will open up which has many VPC Set Up options, click on the very first option named as "VPC with Single Public Subnet Only".
  4. Click on continue and it will show up a review option, here you can edit the VPC IP CIDR Block if you wish to add additional IP  Addresses.

Note: The allowed block size is between /28 and /16 which means you can have up to 65,536 IP addresses.

  1. Click on Create VPC button and it's done!

You have successfully created VPC on AWS.

Now I'll show you how to Set Up Security Groups on AWS

HOW TO SET UP SECURITY GROUPS ON AWS

  1. Like the earlier procedure, you have to click on the Compute and Networking option and click on the VPC icon.
  2. Open the menu and click on the Create Security Group option.
  3.  It will show up and window and ask for the name of the group, it's description and the VPC. After filling all the information, click on the Yes, Create option.
  4. If you wish to edit your group and bind up some rules, click on the group you want to edit and options will be available on the underneath groups. Edit them and add rules accordingly.

Note: If you want to allow all traffic in and manage ports through cPanel/WHM, then select Inbound and create a rule for all traffic; make source 0.0.0.0/0 and click add Rule.

Done! The Security group has been created.

Now, let's get to the third and in my opinion the difficult one.

HOW TO SET UP AMAZON EC2 INSTANCE

  1. You will find an EC2 option, select it and click on launch Instance button to begin.
  2. Install your favorable Amazon Machine Images(AMI).
  3. Choose the instance you prefer the best, in my opinion starting with small is better has AWS scales very easily.
  4. Now, you need to do is configure your instance details. It has many subparts and should be followed accordingly.
    1. Select your desired network and subnet.
    2. Add your preferred IAM Role to add AWS access keys
    3. Set Shutdown Behavior to “Stop” (otherwise it will be terminated)
    4. Enable Termination Protection (Makes termination a two-step process preventing accidental termination)
    5. Under the network interfaces option, add a Primary IP address based on the range you chose.
    6. Under the network interfaces option, add a Primary IP address based on the range you chose.
  5. Add your desired storage Amazon offers a few different kinds of storage, for this instance, our options are root and EBS. Root storage is in the EC2 instance so when the instance gets terminated the data gets terminated. EBS is independent of the EC2 instance so data will not be terminated with the instance.
  6. Now, tag your instance and create a name for it.
  7. Configure security group You can use the security group that we made it before, just select the radio button and "select the existing security group" option and select the one which we created earlier.
  8. Review and launch Just do a double-check on the everything and check whether it looks like you wanted to or not and click on launch.
  9. Select a key pair You can use existing key or select Create New Key Pair, add a name for your key pair and download it.

Done! You have successfully created an EC2 instance.

As we talked about it earlier, let's learn how to Set Up and Elastic IP

HOW TO SET UP ELASTIC IP

  1. Select the EC2 option and click on the Elastic IP's menu.
  2. You will find a blue button on the top left corner named Allocate New Address button.
  3. Use the Instance drop-down to set your instance to the one you wish to use.
  4. Click the Reassociation check box. This is to keep the IP associated with the instance even if the instance is rebooted.
  5.  Now you just need to click on the Associate button to finalize all the changes.

Done! You have successfully Set Up Elastic Up on AWS.

I also tried to Route 53 to configure my hostnames for this project. I went and purchased a domain and decided I would use that for my hostnames and it is an easy method to understand. So let me explain the steps.

HOW TO  SETUP ROUTE 53 DNS

The steps are pretty much simple and can be easily used.

  1. Click on the Hosted Zone button and two empty blocks will appear.
  2. You need to fill up two blocks, the first one is the domain name and the second one is used if you wish to add a comment on it.
  3. You need to go back to your domain registrar page and set your own custom name servers as the four under delegation set as shows the picture.
  4.  Click on Go To RecordSets and add an entry for your public IP address.

Note: At this point, your DNS should be configured to have the elastic IP address be used for your EC2 instance we created. You can use tools like MX Toolbox's DNS Lookup tool to determine if your DNS is pointing or not.

We will come back to this later when we discuss configuring nameservers. Now, you have a Route 53 DNS

So, now let's discuss the main topic that how do we setup cPanel/WHM on AWS. cPanel is one of the tools which people are most comfortable using and it goes way back. So using in on AWS solves the problem of lack of integration and also works for the users.

HOW TO SETUP cPanel/WHM ON AWS

Now that you have your Amazon AWS configured, you can have some fun with installing and configuring cPanel/WHM and ill guide you all through it.

  1. Secure Shell(SSH) into your instance, you may have an EC2 username.
  2. Now just follow these basic steps as I have divided this point for it.

Root access

sudo su

Install Perl

$ yum install perl

 

Install Wget

$ yum install wget

 

Change to your home directory.

$ cd /home

 

Get latest cPanel

$ wget -N http://httpupdate.cpanel.net/latest

Execute installation files

$ sh latest

  1. Patience! Wait while it installs, it may take some time.
  2. Set root password. passwd root and follow further instructions.
  3. Open your browser and  go to https://Your.IP.Address:/2087
  4. Use the root as the username and use the root password as the password and click on login.

Now, you have successfully installed WHM according to you and you can configure it to your liking.

Points to keep in mind:

(a) I recommend configuring a security policy to regulate the ports we opened at the beginning.(b) Set up your hostnames
(c) If you have some problems, use CentOS as it works perfectly fine on all computers.

 

Check out these top 3 WordPress hosting services:

Was this article helpful?