📚
Dockerfile

CloudFormation VPC

AWS VPC stack template — create network infrastructure from YAML

📋Configuration Files

vpc-stack.yaml

yaml
1AWSTemplateFormatVersion: "2010-09-09"
2Description: Simple VPC with one public subnet
3
4Resources:
5 MyVPC:
6 Type: AWS::EC2::VPC
7 Properties:
8 CidrBlock: 10.0.0.0/16
9 EnableDnsSupport: true
10 EnableDnsHostnames: true
11 Tags:
12 - Key: Name
13 Value: devops-vpc
14
15 PublicSubnet:
16 Type: AWS::EC2::Subnet
17 Properties:
18 VpcId: !Ref MyVPC
19 CidrBlock: 10.0.1.0/24
20 MapPublicIpOnLaunch: true
21 AvailabilityZone: !Select [0, !GetAZs ""]
22
23Outputs:
24 VpcId:
25 Value: !Ref MyVPC
26 Export:
27 Name: !Sub "${AWS::StackName}-VpcId"
📄

Step 01

Deploy CloudFormation Stack

(01)Create stack

Linux
1aws cloudformation create-stack \
2 --stack-name my-vpc \
3 --template-body file://vpc-stack.yaml
4aws cloudformation describe-stacks --stack-name my-vpc