Deploying WordPress site using Kubernetes and integrating it with a database by using Amazon RDS Service
# What is Amazon RDS Service?
Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming administration tasks such as hardware provisioning, database setup, patching and backups. It frees you to focus on your applications so you can give them the fast performance, high availability, security and compatibility they need.
For more info visit: https://aws.amazon.com/rds/
# Task Description:
Deploy the WordPress application on Kubernetes and AWS using terraform including the following steps:
→Write an Infrastructure as code using terraform, which automatically deploy the WordPress application.
→On AWS, use RDS service for the relational database for WordPress application.
→Deploy the WordPress as a container either on top of Minikube or EKS or Fargate service on AWS.
→The WordPress application should be accessible from the public world if deployed on AWS or through workstation if deployed on Minikube.
So now let’s move towards Practical part:
# Launch ‘Minikube’ and mentioned the kubernetes provider in the terraform code.
# Use Kubernetes deployment resource to deploy the pod for WordPress and properly configure the things required.
# Use Kubernetes Service resource and add a node-port so that we can access the WordPress,so that it can be accessed by everyone:
The range for Node-port is 30000–32767,make sure you assign a port for node-port within the range.
# to create a database for our WordPress site, we will use terraform for using AWS RDS service so we use AWS provider:
# Now after we write both the files,now we initialize the terraform by using the command:
# use terraform apply command to run the terraform code:
# Now we'll manually check the kubernetes service and pods etc.
Here you can see from above image that our WordPress is successfully deployed in kubernetes with 2 replicas.
→Here you can see our terraform code is deploying all the things successfully !!.
“ !! Now let’s check on AWS RDS service whether our databases is created or not !! “
Here you can see our databases is created successfully.
Now let’s check whether we connect to our WordPress site or not using minikube IP in my cases IP is 192.168.99.102:32514 .
# Now use the correct credentials you have provided in your db.tf file.
To get the Database host details, we can get it at end of the terraform code completion.
So, if we have put all the details correctly, so finally it gets connected to the AWS RDS database, and we can further launch our website on WordPress.
Finally,our task is done.
To see the code I have written for this task follow my repository link for the task.
GitHub Link: https://github.com/mayank-aly/cloud-task-6.git
Feel free to contact me anytime on my LinkedIn profile: https://www.linkedin.com/in/mayank-varshney-62744a163