How to Host your WordPress Website on Amazon EC2 and S3
Updated: Aug 2
You can enjoy reliable, fast, and protected website (against any type of data loss) by hosting your website on cloud.
In this article, I will let you know the basic procedure to host your WordPress website on Amazon S3 and EC2.
Hosting on Amazon S3
Hosting your images on Amazon s3 is a great option because you can stop worrying about backing up your images as S3 keeps multiple copies of your files and access to the images is very fast. It also reduces the load on your server of images.
Hosting on Amazon EC2
Amazon EC2 helps you in making resizable memory and compute capacity online (on cloud). Hosting on aws gives you an awesome plug and play option for your server hard disks, capacity and computing power.
Why Hosting on AWS EC2 and S3 is Beneficial?
You can enjoy flexible pricing structure for each service do you want to avail.
The configuration dashboard is so easy to manage. So that you can setup if you have little experience with Amazon S3 and EC2.
You get scalable hosting.
Now, you have highly available website.
You will feel ease in loading high potential resources (content pulling) for your website.
Process to Host your WordPress Website
Sign up for the Amazon Account. You will get the Access Key and API Key for this
Add it into your WordPress plugin to access it in the Amazon directory
define( ‘AWS_ACCESS_KEY_ID’, ‘***************** <strong><em>’ ); define( ‘AWS_SECRET_ACCESS_KEY’, ‘ </em> </strong>*************************************’ );
You will get the Amazon Web Services Management Console.
Select the services which you are looking forward.
On service tab ( select EC2 and S3).
Step-5: Steps for S3
Click to S3 first
Create a bucket on S3: The S3 bucket is actually a container like the structure of your website, that’s the bucket for your S3 asset for your WordPress website.
Now, you have to set up your WordPress website to communicate with the S3.
From the “Static Website Hosting” option, enable website hosting on your index page (that would probably the first landing page of your website).
Enable website hosting indexed document and error file in case of any error.
Upload all the files that you want to be in your S3 bucket. Your bucket is accessible privately. You can check out your bucket URL from the side bar of S3. dashboard.
If you have developed a bucket earlier then, select the required bucket and hit upload to push your relevant content in the S3 Bucket.
After File upload, it will be pulled from that directory from Amazon S3 bucket, where it was once saved.
After your file upload, you can make these file public to make it accessible via its AWS S3 bucket URL (in my case it’s: www.yourwebsite.com.s3_website-eu-west-1.amazonaws.com). Now, the images and content can be accessed from your S3 bucket now.
Check for the URL of your website. Here is your website from Amazon S3 bucket.
Step-6: Steps for EC2
Now, for launching your EC2 Instance, follow the procedure as below:
Just login to your AWS console.
Find the EC2 under compute list under Amazon Web Services dashboard.
To configure your virtual machine, create and launch an EC2 instance.
After creating, configure your instance by going through the configuration wizard.
In the configuration setup, choose AWS marketplace that has WordPress installed. If not, then go to the left navigation panel and select AWS marketplace.
In the provided list click on the WordPress and install it. Ongoing through its steps, review it.
On going through the next step, proceed it with or without key (as you want it).
Your instance is launched now. You can activate any subdomain or domain in it.
The Public IP is associated with the website, which you will be using for your website.
Your website is now launched, and all the assets are loaded via AWS. To make it accessible, with your very own URL, edit your “.htaccess” file.
Run your EC2 instance, load your files and access it through its server now.
Step-7: Steps to Do on WordPress Dashboard End
Once you done with creating the EC2 Instance for your website and making the S3 Bucket for your content, you now need to link it into the WordPress dashboard end.
For this, the necessary procedure is :
Install AWS Plugins
Go to the plugin area, and Click on “Add Plugin” .
Search for plugin named “ Amazon Web Services” which will Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.
Once installed, download another plugin for S3. It is advised to install the plugin named “Amazon S3 and CloudFlare”.
Activate both the plugins
Once activated, on the left panel find AWS, click Access Key, it will ask you to add the Access API key and Secret Access Key for your AWS, just add it and Save Changes.
Now, Go for S3 and CloudFront, and browse for the Existing Bucket, or Create New one , depending upon the thing you want to get.
You will see all the content in your existing bucket. The next screen will be
Set the path from where it will sync your images or content. Check for any other option, if it suits you.
Now, all the things are ready for work and your assets will launch from the S3 bucket, when you add into your WordPress post or pages. It will automatically sync and load from AWS.
.Vizteck solution can help you setup your existing hosting to Amazon AWS on scalable servers. Contact Us today for a quote