-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.vpc.yml
51 lines (50 loc) · 1.39 KB
/
example.vpc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
AWSTemplateFormatVersion: 2010-09-09
Resources:
privateVPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 172.31.0.0/16
Tags:
- Key: Name
Value: !Ref AWS::StackName
privateSubnet1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref privateVPC
AvailabilityZone: !Select [0, !GetAZs '']
CidrBlock: 172.31.3.0/24
MapPublicIpOnLaunch: false
Tags:
- Key: Name
Value: !Sub '${AWS::StackName}-subnet-a'
privateSubnet2:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref privateVPC
AvailabilityZone: !Select [1, !GetAZs '']
CidrBlock: 172.31.2.0/24
MapPublicIpOnLaunch: false
Tags:
- Key: Name
Value: !Sub '${AWS::StackName}-subnet-b'
privateRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref privateVPC
privateSubnet1RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref privateSubnet1
RouteTableId: !Ref privateRouteTable
privateSubnet2RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId: !Ref privateSubnet2
RouteTableId: !Ref privateRouteTable
Outputs:
Vpc:
Value: !Ref privateVPC
Subnets:
Value: !Join [',', [!Ref privateSubnet1, !Ref privateSubnet2]]
SecurityGroup:
Value: !GetAtt privateVPC.DefaultSecurityGroup