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 :

Here, We are going to serve a wordpress application from Elastic beanstalk, using Amazon RDS for MySQL database and S3 for static content.

  1. Create S3 bucket for static content
  2. Creating source bundle
  3. Create Elastic Beanstalk application
  4. Link Elastic Beanstalk application to RDS instance
  1. Give the name of the bucket and Select the region.
{
"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.
]
}
]
}

Create your source bundle

Download WordPress from following link:

<?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'
Hosting Wordpress on AWS

Output

Output of how it looks like

--

--

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