Hosting WordPress on AWS

AWS Elastic Beanstalk
Amazon S3 and other storage options
Amazon RDS with its read replica in other AZ
AWS IAM(Identity and Access Management)
How IAM works

Step-by-step Procedure :

  1. Creating RDS instances
  2. Create S3 bucket for static content
  3. Creating source bundle
  4. Create Elastic Beanstalk application
  5. Link Elastic Beanstalk application to RDS instance
  1. On the RDS dashboard, In the sidebar click on ‘databases’ and click on the create database.
  1. Go to the S3 dashboard. Click on ‘Create Bucket’.
  2. Give the name of the bucket and Select the region.
  1. Go to the IAM dashboard, select “Policies” from the menu at left , and click the “Create Policy” button.
{
"Version": "2012-10-17", //This is versioning internal to AWS.
"Statement": [
{
"Effect": "Allow", //We want to allow the following actions on the resource.
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetBucketLocation"
], //Allow the user to get, put, and delete files in our bucket.
"Resource": [
"arn:aws:s3:::YOUR-BUCKET-NAME", //Allow the actions on the bucket itself.
"arn:aws:s3:::YOUR-BUCKET-NAME/*" //Allow the actions on all files within the bucket.
]
}
]
}
  1. Go to the IAM dashboard, select “Users” from the menu at left , and click the “Add User” button.

Create your source bundle

<?php
// AWS configuration for WP Offload S3.
define('DBI_AWS_ACCESS_KEY_ID',$_SERVER['AWS_ACCESS_KEY_ID']);
define('DBI_AWS_SECRET_ACCESS_KEY',$_SERVER['AWS_SECRET_ACCESS_KEY']);
// MySQL configuration.
define('DB_NAME', $_SERVER['RDS_DB_NAME']);
define('DB_USER', $_SERVER['RDS_USERNAME']);
define('DB_PASSWORD', $_SERVER['RDS_PASSWORD']);
define('DB_HOST', $_SERVER['RDS_HOSTNAME'] . ':' . $_SERVER['RDS_PORT']);
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
// Authentication keys and salts.define('AUTH_KEY', $_SERVER['WP_AUTH_KEY']);
define('SECURE_AUTH_KEY', $_SERVER['WP_SECURE_AUTH_KEY']);
define('LOGGED_IN_KEY', $_SERVER['WP_LOGGED_IN_KEY']);
define('NONCE_KEY', $_SERVER['WP_NONCE_KEY']);
define('AUTH_SALT', $_SERVER['WP_AUTH_SALT']);
define('SECURE_AUTH_SALT', $_SERVER['WP_SECURE_AUTH_SALT']);
define('LOGGED_IN_SALT', $_SERVER['WP_LOGGED_IN_SALT']);
define('NONCE_SALT', $_SERVER['WP_NONCE_SALT']);
// Other WordPress defaults.$table_prefix = 'wp_';
define('WP_DEBUG', false);
if (!defined('ABSPATH'))
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
option_settings:
aws:elasticbeanstalk:application:environment:
AWS_ACCESS_KEY_ID: 'placeholder
AWS_SECRET_ACCESS_KEY: 'placeholder'
WP_AUTH_KEY: 'placeholder'
WP_SECURE_AUTH_KEY: 'placeholder'
WP_LOGGED_IN_KEY: 'placeholder'
WP_NONCE_KEY: 'placeholder'
WP_AUTH_SALT: 'placeholder'
WP_SECURE_AUTH_SALT: 'placeholder'
WP_LOGGED_IN_SALT: 'placeholder'
WP_NONCE_SALT: 'placeholder'
RDS_DB_NAME: 'placeholder'
RDS_HOSTNAME: 'placeholder'
RDS_PORT: '3306'
RDS_USERNAME: 'placeholder'
RDS_PASSWORD: 'placeholder'
  1. Go to the Elastic Beanstalk dashboard and click “Create New Application” in the upper right.
Hosting Wordpress on AWS

Output

Output of how it looks like

--

--

--

2x AWS Certified

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top 4 Java Frameworks you Should Know

Unity Development — AI Sight

Volatility 3 — Downloading Windows Symbols for Volatility 3 on Air-gapped Machines

My Google FooBar Journey, 2022

FluxNodes: Infrastructure scaling on a Decentralized Web3

Will IT Departments Become Obsolete?

Login — UIView Animations Part 2

System Design — Online Judge with Data Modelling

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Janvi Ajudiya

Janvi Ajudiya

2x AWS Certified

More from Medium

Automatically log your Expenses in Spreadsheet using Google App Scripts!

HTML based static web application on AWS EC2.

Learn How To Create A Module Magento 2 ! — MyWebDiary |

How To Clone Linode Server?