forked from widdix/aws-cf-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpc-nat-gateway.yaml
54 lines (54 loc) · 1.45 KB
/
vpc-nat-gateway.yaml
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
52
53
54
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'VPC: NAT Gateway for private subnets, a cloudonaut.io template'
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: 'Parent Stacks'
Parameters:
- ParentVPCStack
- Label:
default: 'NatGateway Parameters'
Parameters:
- SubnetName
Parameters:
ParentVPCStack:
Description: Stack name of parent VPC stack based on vpc/vpc-*azs.yaml template.
Type: String
SubnetName:
Description: 'Subnet name of parent VPC stack based on vpc/vpc-*azs.yaml template.'
Type: String
Default: SubnetAPublic
AllowedValues:
- SubnetAPublic
- SubnetBPublic
- SubnetCPublic
- SubnetDPublic
Resources:
EIP:
Type: 'AWS::EC2::EIP'
Properties:
Domain: vpc
NatGateway:
Type: 'AWS::EC2::NatGateway'
Properties:
AllocationId: !GetAtt 'EIP.AllocationId'
SubnetId:
'Fn::ImportValue': !Sub '${ParentVPCStack}-${SubnetName}'
Route:
Type: AWS::EC2::Route
Properties:
RouteTableId:
'Fn::ImportValue': !Sub '${ParentVPCStack}-RouteTablePrivate'
DestinationCidrBlock: '0.0.0.0/0'
NatGatewayId: !Ref NatGateway
Outputs:
TemplateID:
Description: 'cloudonaut.io template id'
Value: 'vpc/vpc-nat-gateway'
IPAddress:
Description: 'The public IP address of the NAT gateway.'
Value: !Ref EIP
Export:
Name: !Sub '${AWS::StackName}-IPAddress'