DEV Community

Cover image for Step by step to deploy and host a high-available WordPress application using AWS EC2 instance,RDS,ASG and VPC (Part-1)

Posted on

Step by step to deploy and host a high-available WordPress application using AWS EC2 instance,RDS,ASG and VPC (Part-1)

How this post will help?

Learn and build a WordPress application using AWS EC2 instance with Amazon RDS DB instance that is external to AWS Elastic Beanstalk, then how to configure a high-availability environment running a WordPress website to connect to it. Then website uses Amazon EFS as the shared storage for upload files.

Amazon RDS High Availability:

Running a DB instance external to Elastic Beanstalk decouples the database from the lifecycle of your environment. This lets you connect to the same database from multiple environments, swap out one database for another, or perform a blue/green deployment without affecting your database.


  • Basic Elastic Beanstalk operations and Beanstalk console.
  • Command line terminal(Linux or MacOS) or Cloudshell.
  • Basics of aws concept.

First, we launch a DB instance in Amazon RDS:

Its completely independent from Elastic Beanstalk Environments and will not be terminated or monitored by Elastic Beanstalk

Follow step by step to launch a database with the MySQL engine and enable Multi-AZ deployment

  1. Open the AWS RDS console and click Databases in side navigation pane.
  2. Choose Create database and choose Standard Create (Don't choose Easy Create).
  3. In Availability and durability choose Multi-AZ DB instance (Review the default settings and adjust these settings according to your specific requirements).
  4. Master username and Master password – The database username and password. Make a note of these settings because you will use them later.
  5. Under Additional configuration, for Initial database name, type ebdb
  6. Verify the default settings for the remaining options, and then choose Create database.

We created MySQL database in AWS RDS instance.

Note : Check whether the inbound rules on the security group that's attached to your RDS instance. If not go to inbound and attach the security group.


Download WordPress:

To prepare to deploy WordPress using AWS Elastic Beanstalk, you must copy the WordPress files to your computer and provide the correct configuration information.

To create a WordPress project:

~$ curl -o wordpress.tar.gz
Enter fullscreen mode Exit fullscreen mode

WordPress Install

  • Download the configuration files from the sample repository
~$ wget
Enter fullscreen mode Exit fullscreen mode


  • Extract WordPress and change the name of the folder.
 ~$ tar -xvf wordpress.tar.gz
 ~$ mv wordpress wordpress-beanstalk
 ~$ cd wordpress-beanstalk
Enter fullscreen mode Exit fullscreen mode

MV file

  • Extract the configuration files over the WordPress installation.
~/wordpress-beanstalk$ unzip ../
Enter fullscreen mode Exit fullscreen mode

Launch an Elastic Beanstalk environment:

Use the Elastic Beanstalk console to create an Elastic Beanstalk environment.

In the following steps, you'll use the Elastic Beanstalk console to:

  • Create an Elastic Beanstalk application using the managed PHP platform.
  • Accept the default settings and sample code.

To launch an environment:

  • Open ElasticBeanstalk console using Pre-Link
    and click Create application

  • For Platform, select the platform and platform branch that match the language used by your application.

  • For Application code, choose Sample application.

  • Choose Review and launch.

  • Review the available options. Choose the available option you want to use, and when you're ready, choose Create app.


We created beanstalk environment successfully.

In Part-2, We will see how to confirm beanstalk environmental ,external AWS RDS and final Wordpress deployment.

Follow and Share for more update

Top comments (0)