Cloud Formation Script for VPC creation

Cloud Formation Script for VPC creation


1) Copy below text of script in notepad and save it as .yaml file
2) Go to AWS and cloud formation
3) click create stack
4) select template already exists and upload this .yaml file
5) It will prompt you to provide VPC name and IP range as those are kept as parameter in this template


Note: make sure empty spaces are not changed before the command starts
--------------------------------------------------------------------------------------------------------------
AWSTemplateFormatVersion: 2010-09-09
# This CloudFormation template deploys a basic VPC / Network.
Parameters:
  VPCName:
    Type: String
    Description: Please provide VPC name as per naming convention
  CIDRBlock:
    Type: String
    Description: Please provide IP range for VPC e.g 10.10.0.0/16
Resources:
# VPC Build
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: !Ref CIDRBlock
      EnableDnsSupport: true
      EnableDnsHostnames: true
      Tags:
      - Key: Name
        Value:  !Ref VPCName
------------------------------------------------------------------------------------------------------------------------

Comments