DEV Community

Cover image for Terraform AWS RDS Deployment
Clinton Mbilitem
Clinton Mbilitem

Posted on • Edited on

Terraform AWS RDS Deployment

Think of Terraform like a magic instruction book that tells the computer how to build things in the cloud.

At the very start of this book, we have something called the terraform block. This is like the “setup page” where we tell Terraform what tools it needs and how to get ready before building anything.

When we want to create something like an AWS RDS database, this Terraform block makes sure everything is prepared so Terraform can follow the instructions and build it step by step, just like following a fun LEGO guide!

configuration file terraform block

terraform block

Think of Terraform like a helper robot that builds things for you in the cloud.

The provider block is where we tell the robot who it will work with.

For example, if we want to build things in AWS (like a database), we use the provider block to say the following:
“Hey Terraform, please use AWS tools for this job!”

It’s like choosing which toy set to play with: LEGO, Minecraft, or something else.
Here, we’re choosing AWS so Terraform knows where to build our RDS database.

provider block

provider block

Think of Terraform like building with LEGO, step by step.

The Relational Database Service (RDS) resource block is the part where we tell Terraform exactly what we want to build, which is our database!

It’s like saying, "Hey Terraform, please build me a database with this name, this size, and these settings.”

Inside this block, we describe things like the following: the database name, the type (like MySQL or PostgreSQL), the size, and the username and password.

So, the resource block is where the real building happens, just like putting LEGO pieces together to create something awesome!

relational database service resource block

rds

Now comes the fun part! When we run terraform apply, it’s like pressing the big “BUILD” button.

Terraform looks at all our instructions (like the Terraform block, provider block, and RDS resource block) and says, "Okay! I know what to do; let’s build it!”

Then it checks everything is correct and shows us what it’s going to create and if we say “yes,” it starts building our database.

So, terraform apply is the step where our plan turns into something real just like finishing your LEGO model and seeing it come to life!

run terraform apply

run

success

Deployed RDS

rds deployed

Top comments (0)