(01)Create stack
Linux
1aws cloudformation create-stack \2 --stack-name my-vpc \3 --template-body file://vpc-stack.yaml4aws cloudformation describe-stacks --stack-name my-vpcAWS VPC stack template — create network infrastructure from YAML
vpc-stack.yaml
1AWSTemplateFormatVersion: "2010-09-09"2Description: Simple VPC with one public subnet3 4Resources:5 MyVPC:6 Type: AWS::EC2::VPC7 Properties:8 CidrBlock: 10.0.0.0/169 EnableDnsSupport: true10 EnableDnsHostnames: true11 Tags:12 - Key: Name13 Value: devops-vpc14 15 PublicSubnet:16 Type: AWS::EC2::Subnet17 Properties:18 VpcId: !Ref MyVPC19 CidrBlock: 10.0.1.0/2420 MapPublicIpOnLaunch: true21 AvailabilityZone: !Select [0, !GetAZs ""]22 23Outputs:24 VpcId:25 Value: !Ref MyVPC26 Export:27 Name: !Sub "${AWS::StackName}-VpcId"Step 01
1aws cloudformation create-stack \2 --stack-name my-vpc \3 --template-body file://vpc-stack.yaml4aws cloudformation describe-stacks --stack-name my-vpc