Integration of AWS-RDS and Wordpress running on Kubernetes pods.

→AWS RDS

→ Kubernetes Pods(Wordpress)

What is Kubernetes?

→ Terraform (I have used module Approach of terraform)

What is Terraform ?

  • In this, I have created 2 folder(modules) : “awsrds” and “k8swp”. Both contains terraform files, which are reponsible for working of modules. This foolder task6 has 2 files: “main.tf” and “variables.tf”.
vat.tf file
security group
DB Instance
  • identifier — It is the name of our DB Instance
  • engine and engine_version can be used according to used cases, but in my case, I have used “Mysql”.
  • name — This is the name of our database, on which wordpress will act as frontend.
  • username — This is the name of user which can use our database. In my case, I have given this username through a variable in variables.tf and value given will be “admin”.
  • password — This is the password for user “admin”.
  • instance_class — This is the type of Instance we want, as t2.micro is free, so I am using this.
  • publicly_accessible — This is given as “true”, beacuse we are accessing this Database from outside of given VPC, if we set it to false, it becomes privately accessible, and only instances from the same VPC can access this.
  • vpc_security_group_ids — Using this, I have attached my Security Group to this resource.
  • These are created as these will be used in my other module, which is kubernetes module for wordpress pod. We are exporting these value which means that, when our database will be created, we get many values which are exported, but we are taking only these 2 (endpoint and name).
  • endpoint — This is the final URL of our database , which will help our wordpress pod to connect to this database.
  • name — This is the name of our database.
  • rdsusername” — username of our database, which is “admin”
  • rdspasswd” — Password for our user
  • rdsendpoint” — URL of our database(this is same as we can give address,but domain name has more advantages)
  • rdsdbname” — Name of our database
  • port” — This is the port on which our Wordpress Pod will be running.
  • Provisioner is used for this, and as we are doing command locally, so “local-exec” provisioner is used, and then in command, we can write, what we want, here command is “minikube start”.
Kubernetes service — NodePort
replication controller (a)
replication controller (b)
main file(a)
main file (b)
Terraform Init output
output of terraform apply command
Creation Complete
Default VPC
Security Group created
DB Instance creating
DB Instance Created
Nodeport service created
Replication Controller Created
Wordpress Pod Created
Automatically opened by Nullresource
This form has to be filled by us and then “begin installation”.
User has successfully created by us and now we can login.
We can login now, and we will be redirected to our desired page
Dashboard
  • For this, see left side menu, click on posts and then on new posts.
  • Empty Page will come, and we can write anything in that, so i have written the following content :
New Post
  • Click on “Publish” on top right corner, as then only, our data will be saved on DB Instance.
Post is Published :)
Environment Variables (Edit in Path)
mysql path in my case
We have to use domain name URL/Endpoint and with this username and passwd as shown in command
our desired database is “poddb”
As we want that our post is saved or not, so desired table is “wp_posts”
to see data of complete table, data is too much in this, but we can find the lines that we have written in post
As, you can see that both the lines are there which we write in our post
Exited mysql
RDS Database is being deleted
Nothing is there

--

--

--

I am a student and persuing under graduation in computer science and engineering.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

A Short Introduction to R Programming

Scaling and Deployment of a Microservice in Kubernetes

An efficient workspace, is a happy workspace…

An eye-catchy leaderboard for your Unity game

Roobykon Ruby Digest: Issue 15

Creating VPC and using bastion host for private subnet using terraform

DevOps vs SDLC

What is the impact of CPU utilization on a database

Akhilesh Jain

Akhilesh Jain

I am a student and persuing under graduation in computer science and engineering.

More from Medium

Infrastructure Testing & Compliance

What Is Cloud Test Automation?

How to manage all my K8s secrets in git securely with Bitnami sealed secrets

A Tale of an Elastic Kubernetes Service Setup

A cluster of mushrooms growing.