Deploying a WordPress website with Amazon RDS Database to elastic beanstalk involves the following step. Let us see in detail about the steps to configure and deploy the same.
Launching a DB instance in Amazon RDS
Launching an Elastic Beanstalk environment
Configuring the security groups and Environment properties
Installing the WordPress
Configuring the auto-scaling property
Download the latest version of WordPress from https://wordpress.org/ into your local machine for installing the WordPress to the Elastic Beanstalk environment. Download the configuration files in the following repository: https://github.com/awslabs/eb-php-wordpress/releases/download/v1.0/eb-php-wordpress-v1.zip. Configure your default VPC and subnet IDs from the Amazon VPC console.
Launching the DB instance in Amazon RDS:
Separate DB instance is required for the WordPress storage. Choose the type of DB instance accordingly ( e.g: MySQL). While launching the DB instance make sure that the cost of DB instance is affordable according to your project. This instance is not monitored by the Elastic Beanstalk. Configure the DB instance and launch. Multi-AZ deployment will increase your cost but it also increases the availability. Your estimated monthly cost is displayed on the left side of the page.
Launching an Elastic Beanstalk environment:
Choose the PHP as the platform and upload the downloaded WordPress code in zip format. Configure the Elastic Beanstalk and launch. Environment creation takes about 5 minutes. Launching an environment creates the following resources:
Instance security group
Load balancer security group
Auto Scaling group
Amazon S3 bucket
Amazon CloudWatch alarms
AWS CloudFormation stack
Configuring the security groups and Environment properties:
For EC2 security groups, type a comma after the name of the auto-generated security group followed by the name of the RDS DB instance’s security group. Configure environment properties for the Launched RDS DB instance:
RDS_HOSTNAME – The hostname of the DB instance.
Amazon RDS console label – Endpoint is the hostname.
RDS_PORT – The port on which the DB instance accepts connections. The default value varies between DB engines.
Amazon RDS console label – Port
RDS_DB_NAME – The database name, ebdb.
Amazon RDS console label – DB Name
RDS_USERNAME – The user name that you configured for your database.
Amazon RDS console label – Username
RDS_PASSWORD – The password that you configured for your database.
Install the WordPress:
Open Elastic Beanstalk console and Choose the environment URL to open your site in a browser. If you succeeded, you will be redirected to a WordPress installation wizard, which looks like above image because the site has not been configured yet. Choose the language and continue the installation where you have to register and install WordPress.
Configuring the auto-scaling property:
In the scaling section of Elastic Beanstalk console, configure the minimum instance and maximum instance count. If the load is increased load balancer will automatically balance the load based on the configuration in the scaling section.
We saw in detail about to how to configure a WordPress website with Amazon RDS database to Elastic Beanstalk. This will help you in configuring the site by yourself.