Deploying a WordPress Website Using Elastic Beanstalk with External RDS

Pankaj Makhijani
AWS in Plain English
6 min readSep 22, 2023

--

Hey everyone đź‘‹, I hope you are fine and having a great day. Today, In this blog we will look at how to deploy our wordpress website on elastic beanstalk and use external database like on-premise database or AWS RDS.

Wordpress is the simple and most powerful way to create websites and blogs. Today almost around 40% of the website available on the internet are powered by wordpress. Many people today are moving their business online using wordpress because of the simplicity, customization, variety of themes and plugins to perform various tasks.

After we are ready building our websites it’s time to make it available for public usage and host it online. Elastic Beanstalk is a Platform-as-a-Service (PaaS) offering offered by Amazon Web Services and it simplifies the process of deploying and manage our applications. We just need to upload the code and it will handle the deployment from provisioning, load balancing, auto-scaling to meet the demand and application health monitoring.

Amazon RDS is a managed relational database service offered by AWS which makes it very easy to setup, operate and scale databases. We can also provision RDS while creating Elastic beanstalk environment but it will be deleted in case we tear down our Elastic beanstalk environment. Also, you can also use your on-prem database in stead of RDS to store data.

Enough of the gyaan! Now let’s begin the deployment.

Step 1: Setup RDS with the following configurations

▪ Database creation method — Standard create

â–Ş Engine Type: mysql

▪ Template— free-tier

▪ DB instance identifier — database-1 & set username & password for your Database (In my case username is admin & password is admin123)

â–Ş DB instance class -db.t2.micro (Choose as per your required vCPU and RAM)

▪ Under connectivity, select “Yes” for public access

▪ Create new VPC security group and enter name “rds-wp-sg”

▪ Under additional configurations, add initial database name “hello-word-db”

â–Ş Enabled automated backups & maintainence options as per the requirement else disable that for testing.

▪ Click “create database” and wait while it gets provisioned and status is available.

Click on the DB identifier and head over to the connectivity and security to get the database endpoint i.e hostname to connect DB instance.

Configure your security group to allow inbound traffic from your VPC’s CIDR group & On-prem CIDRonly.

Step 2: Setting up wordpress application

Now, it’s time to create our wordpress application for deployment. Currently, I don’t have any wordpress application available so I will be downloading the default wordpress website and start from scratch.

Click here to download the wordpress and extract the zip folder to view the sample wordpress application.

If you already have wordpress website available with you change the database configurations in “wp-config.php file”.

Now select all the files in this directory and create a zip folder in order to deploy it on Elastic Beanstalk. (index.zip in our case)

Step 3: Creating elastic beanstalk application

Go to AWS console and search for Elastic beanstalk and create new application. Give application name “hello-world-app”

Now our application is created, let’s create a environment insde the application.

Step 4: Creating application environment

Click on application and create new environment with the following details.

▪ Environment tier — Web Worker Environment

â–Ş Keep application and environment information as it is

▪ Choose platform “PHP”

â–Ş Under application code, select upload your code and choose the zip file of your wordpress application content.

NOTE: ZIP the wordpress app content files which are under wordpress dirctory and DO NOT directly zip the wordpress directory.

â–Ş Click Next

â–Ş Under Configure service access, create new service role and select the EC2 key pair by which you can access your EC2 instance, where elastic beanstalk will run your website.

â–Ş Create IAM role for your EC2 instance profiler.

â–Ş click Next and choose VPC and subnet for your instance and keep everything as it is.

▪ Click on “skip to review” to keep everything as it is. Also you can configure scaling and monitoring as per your application needs.

â–Ş Click on submit to create the environment.

â–Ş Once your application environment is created successfully, you will get the domain to access your website.

Step 5: Accessing our application

Open the domain to check your website

Hurray! Our application is deployed successfully, now it’s time to setup the wordpress application configurations.

â–Ş Select language : English and Click next to setup database configurations

â–Ş Enter database name, database host (Database endpoint), database username and password.

Next enter your site details and admin login page credentials.

You have now successfully setup your wordpress application 🎉

You can now login with your credentials to access the wordpress dashboard and start building your website. You can also append /wp-admin to your site URL to access the admin dashboard.

Navigate to your Elastic beanstalk domain to visit your page

In case you are facing any issues after adding the db credentials, please check your security groups of the RDS instance.

Conclusion

I hope you are now clear with deploying a wordpress application on AWS and it is quite simple. It involves setting up the external RDS instance, configuring the elastic beanstalk environment and deploying the application code. Having an external database ensures reliability and security.

Click on clap if you found this blog helpfulđź‘Ź and do follow for more such useful blogs. Thanks and have a great day.

In Plain English

Thank you for being a part of our community! Before you go:

--

--

AWS Community Builder | AWS Solution Architect | Cloud Engineer working at Rishabh Software | 3x AWS Certified 1x Azure Certified