DevOps Classroomnotes 26/Mar/2023

Ntier in AWS Contd

  • So far we have created vpc with 6 subnets and attached internet gateway
  • Now lets create two route tables public and private
  • Terraform has locals where we can define the value for usage within template Refer Here

Create Route tables

  • Refer Here for the changeset to add route tables and Refer Here for route table resource reference
    Preview
  • Now we need to associate private route table with 4 subnets and public route table with 2 subnets. Refer Here for the changes done

Preview

Creating RDS DB Instance (db)

  • Manual Steps:

    • DB Subnet Group: This is more than one subnet where the databse has to be created
    • Security Group:
      • mysql: open 3306 port with in vpc
    • Database Engine: mysql
    • size: db.t2.micro
    • credentials: username and password
  • Create security Group: Refer Here for changes
  • Add db subnet group Refer Here for changes
  • Create rds instance. Refer Here for the changes done
    Preview
  • Lets add database endpoint as output Refer Here
    Preview

AWS EC2 from terraform

  • Create an ec2 instance in web1 subnet
  • Steps:
  • Create ec2 Refer Here for changes

Preview

Activity

  • Create a new folder and one tf file with local provider to create a text file anywhere in your system
  • When you apply you get state file
    • copy the state file and store with name state_1.tfstate
  • Now change the path to new directory and apply the changes
    • copy the state file and store with name state_2.tfstate
  • Try adding a output in tf
    • copy the state file and store with name state_3.tfstate

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner