forked from dxctechnology/dxcf-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample-AmazonNATImageCustomResource.yaml
105 lines (105 loc) · 3.27 KB
/
Example-AmazonNATImageCustomResource.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
AWSTemplateFormatVersion: 2010-09-09
Description: Example-AmazonNATImageCustomResource Template.
This demonstrates how to dynamically get the most recent Amazon NAT Image.
Parameters:
Region:
Description: Optional Region, specify to select a region other than the current region
Type: String
Default: ''
AllowedValues:
- ''
- us-east-1
- us-east-2
- us-west-1
- us-west-2
- ca-central-1
- eu-west-1
- eu-central-1
- eu-west-2
- eu-west-3
- ap-southeast-1
- ap-southeast-2
- ap-northeast-2
- ap-northeast-1
- ap-south-1
- sa-east-1
ConstraintDescription: Must be a valid AWS region or blank.
Version:
Description: Amazon NAT Version
Type: String
Default: Amazon NAT 2017.09.1
AllowedValues:
- ''
- Amazon NAT
- Amazon NAT 2018.03.0
- Amazon NAT 2017.09.1
- Amazon NAT 2017.09.0
- Amazon NAT 2017.03.1
- Amazon NAT 2017.03.0
ConstraintDescription: Must be a valid Amazon NAT version or blank.
Date:
Description: Optional Amazon NAT Date, specify to select a specific publication date for the Image
Type: String
Default: 20180115
AllowedPattern: (^$|^20(1[6-9]|[2-9][0-9])(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])$)
ConstraintDescription: Must be a valid date or blank.
Conditions:
ConfigureRegion: !Not [ !Equals [ !Ref Region, '' ]]
ConfigureVersion: !Not [ !Equals [ !Ref Version, '' ]]
ConfigureDate: !Not [ !Equals [ !Ref Date, '' ]]
Resources:
LatestAmazonNATImage:
Type: Custom::AmazonNATImage
Properties:
ServiceToken: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:AmazonNATImage
Region: !If
- ConfigureRegion
- !Ref Region
- !Ref AWS::NoValue
LatestVersionedAmazonNATImage:
Type: Custom::AmazonNATImage
Properties:
ServiceToken: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:AmazonNATImage
Region: !If
- ConfigureRegion
- !Ref Region
- !Ref AWS::NoValue
OSName: !If
- ConfigureVersion
- !Ref Version
- !Ref AWS::NoValue
SpecificVersionedAmazonNATImage:
Type: Custom::AmazonNATImage
Properties:
ServiceToken: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:AmazonNATImage
Region: !If
- ConfigureRegion
- !Ref Region
- !Ref AWS::NoValue
OSName: !If
- ConfigureVersion
- !Ref Version
- !Ref AWS::NoValue
OSDate: !If
- ConfigureDate
- !Ref Date
- !Ref AWS::NoValue
Outputs:
LatestImageId:
Description: The Latest ImageId
Value: !Ref LatestAmazonNATImage
LatestName:
Description: The Latest Image Name
Value: !GetAtt LatestAmazonNATImage.Name
LatestVersionedImageId:
Description: The Latest Versioned ImageId
Value: !Ref LatestVersionedAmazonNATImage
LatestVersionedName:
Description: The Latest Versioned Image Name
Value: !GetAtt LatestVersionedAmazonNATImage.Name
SpecificVersionedImageId:
Description: The Specific Versioned ImageId
Value: !Ref SpecificVersionedAmazonNATImage
SpecificVersionedName:
Description: The Specific Versioned Image Name
Value: !GetAtt SpecificVersionedAmazonNATImage.Name