AWS Classroomnotes 21/Oct/2022

Activity 2: Create a network with 6 subnets

  • While creating subnet we need to pass the vpc id, but vpc id will be known after the stack is created, so there should be a way to dynamically refer the vpc id
  • Every AWS Cloud formation resource has return values Refer Here for return values of vpc
  • As per documentation there are two ways
    • Ref
    • Fn::GetAtt
  • Ref and Fn::GetAtt are built in functions of Cloudformation Refer Here for the ref usage
  • We have create a cf template with six subnets and created the stack
  • For the changes Refer Here
  • The template developed so far has two major problems in terms of reusability
    • It works only in oregon (us-west-2)
    • It has fixed cidr ranges
  • Lets try to solve the problem of fixed cidr ranges first.
  • I want user to be able to enter cidr ranges of his choice with the current values as default values
  • Parameter in AWS Cloud formation can help in solving this problem Refer Here
  • We have create two parameters. One for vpc cidr which is string and other for subnet cidrs which comma-seperated strings
  • Refer Here for the changes done
  • AWS Specific parameters are values dynamically made available by AWS Refer Here
  • We have used Availability zone name type parameter . This parameter removes the region dependency and the template can now work in any region. Refer Here for the chagnes done

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner