Deploying WordPress application on Kubernetes with AWS RDS using terraform

Deploying WordPress application on Kubernetes with AWS RDS using terraform

                >>>>The Objective of the task was to<<<<<

1. Write an Infrastructure as code using terraform, which automatically

   deploy the Wordpress application


2. On AWS, use RDS service for the relational database for Wordpress 

   application.


3. Deploy the Wordpress as a container either on top of Minikube or EKS or 

   Fargate service on AWS


4. The Wordpress application should be accessible from the public world if 

   deployed on AWS or through workstation if deployed on Minikube.

Amazon Relational Database Service (RDS)

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. Amazon RDS is available on several database instance types - optimized for memory, performance, or I/O - and provides you with six familiar database engines to choose from, including Amazon Aurora, MySQL, Oracle Database, etc..

Now's Let jump towards the practical

The easiest way to configure the provider is by creating/generating a config in a default location (~/.kube/config). That allows you to leave the provider block completely empty.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

The above file will deploy the WordPress application.

and now we will run the above file using terraform, the commands for the same is

terraform init, terraform plan, terraform apply

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

We can see that terraform file is executed properly without any error now will check if the pods are running by kubectl get pods and kubectl get all -o wide commands

No alt text provided for this image

We can see that the container is running properly and exposed to port 30000 so if any user from the outside world wants to access the website he can use my minikube ip:30000 to access the website. Now we will deploy the RDS database for our WordPress application in AWS and collect all the information like database name password and username to login to WordPress.

No alt text provided for this image

The above terraform code for RDS will create RDS in AWS I have provided the database name username and password which we will need while login to WordPress.

Now we will run the RDS file by using terraform

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

As we can see our terraform code has been executed successfully so now we will go to AWS and check our Amazon RDS database.

No alt text provided for this image
No alt text provided for this image

Connecting RDS to Word Press

finally, we can connect the WordPress application to our RDS database by providing the username, password, database name, and database host. Now go to google chrome and type the minikube ip:30000 to launch the WordPress application.

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

We can see that WordPress is connected with our RDS database in AWS and our website is working fine.

Thank you for reading !!!!!!


Azeemushan Ali

Senior Cloud & DevOps Engineer at Presidio || IMSEC || 2x AWS Certified || 1x Azure Certified || 1x Terraform Certified || 5?? Gold Level @ HackerRank

4 年

Excellent Work ??

回复
Vatsal Madhar

Diameter Core & OCS/BSS Specialist (OCS, DRA, PCRF & AAA) || 3xOCI || Oracle Cloud Architect Professional certified

4 年

Very detailed Article Srishti

Gaurav Singh Sengar

DevOps Engineer | Streamlining Software Development & Deployment Processes | Cloud Computing | Automation | CI/CD | Infrastructure Management | Continuous Improvement

4 年

Keep it up

Shailly Shah

Software Developer | Full-Stack | .Net Core | Angular | Azure | SQL | Agile | 2x Azure Certified

4 年

Good work ??

要查看或添加评论,请登录

Srishti Jain的更多文章

  • Configuring Load Balancer on AWS using Ansible

    Configuring Load Balancer on AWS using Ansible

    Task Description: ??Provision EC2 instances through ansible. ?? Retrieve the IP Address of instances using the dynamic…

    2 条评论
  • Deploying Webserver on AWS using Ansible

    Deploying Webserver on AWS using Ansible

    This task involves the following steps: 1. Launching an EC2 instance.

    2 条评论
  • Task 1 - Ansible

    Task 1 - Ansible

    STEPS TO DO THIS TASK : ?? Configure Docker ?? Start and enable Docker services ?? Pull the httpd server image from the…

    2 条评论
  • Objectives: -

    Objectives: -

    Perform the task-1 using EFS instead of EBS service on the AWS as, Create/launch Application using Terraform 1. Create…

    2 条评论
  • Creating a VPC using NAT Gateway and Integrating it with EC2

    Creating a VPC using NAT Gateway and Integrating it with EC2

    STEPS: 1. Write an Infrastructure as code using terraform, which automatically create a VPC.

    2 条评论
  • Creating VPC and integrating it with Ec2

    Creating VPC and integrating it with Ec2

    STEPS: 1) Write a Infrastructure as code using terraform, which automatically create a VPC. 2) In that VPC we have to…

    5 条评论
  • EKS TASK

    EKS TASK

    What is EKS? Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that makes it easy for you to run…

    11 条评论
  • Multi Node Kubernetes Cluster

    Multi Node Kubernetes Cluster

    Here we are creating multi node kubernetes cluster by using one master and two slaves. Step1:- Install rhel 8 in your…

    9 条评论
  • Task 1: -

    Task 1: -

    1. Create the key and security group which allow the port 80.

    12 条评论

社区洞察

其他会员也浏览了