Activity 2: Creating an Ntier Architecture using CF Template
- Lets start the template, to create the following
- For manual steps refer classroom video
- inputs =>
- vpc cidr range => 192.168.0.0/16
- Refer Here for cloud formation template anatomy
- Refer Here for cloud formation vpc
- Refer Here for the changeset for vpc
- Lets create the stack
- Generally we write templates so that we can reuse.
- To make reusability more effecient, we should paramterize.
- In Cloudformation, we can add parameters Refer Here
- The syntax of paramer is as follows
"Parameters" : {
"ParameterLogicalID" : {
"Type" : "DataType",
"ParameterProperty" : "value"
}
}
- To use the parameter value syntax is
{ "ref": "<parameter-name>" }
- In the documentation when we see the Parameter with Update Requires
- Replacement: When we change this value the resource will be recreated
- No interruption: When we change this value the existing resource will be updated withour recreation
- Refer Here for the changes done, Now lets update the cf stack
- There are naming conventions for giving parameter names
- Now lets update the template with fix Refer Here
- Now lets Enable DNS Hostnames for VPC. Refer Here
- For YAML Lovers refer below
---
AWSTemplateFormatVersion: '2010-09-09'
Description: This is template for activity 2
Parameters:
vpccidr:
Description: This is cidr for vpc
Type: String
Default: 192.168.0.0/16
Resources:
ntiervpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock:
Ref: vpccidr
EnableDnsHostnames: true
Tags:
- Key: Name
Value: Ntier