DevOps Classroom Series – 07/Mar/2021

Terraform in AWS

  • Now we need to create a database instance in aws

  • To create a database

    • we need to create a db subnet group which specifies database subnets
    • We need to create a rds db instance with mysql/postgres/oracle/sqlserver.
    • In this series i will be creating a mysql based rds instance
  • Manual Steps:

    • Create a db subnet group Preview Preview Preview Preview
  • Terraform:

    • Lets create a new file called as rds.tf
    • The resource for db subnet group Refer Here Preview
    • Refer Here for the changeset Preview
  • Now we need to create a db instance. Manual Steps are shown below Preview Preview Preview Preview Preview Preview Preview Preview Preview

  • Now lets try to create a db instance from terraform provider documentation. Refer Here Preview

  • Refer Here for the changes added to create rds instance

  • Now we are supposed to create ec2 instances in app subnet and web subnet Preview

  • Lets refactor the terraform template so that we have network.tf to create network elements , rds.tf to create database elements

  • Since having one large network.tf is not readable lets create multiple tf files

  • Refer Here for the changeset

  • So we need to create ec2 instance in web subnet and install required softwares and deploy the application and same scenario for app subnet

  • So this is just not creation of resource, we need to login into vm’s (ec2 instances) from terraform and execute the application deployment script (shell script/Chef cookbook/Ansible)

  • The above operations are referred as provisioning

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin