forked from dxctechnology/dxcf-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common-KeyPairs.yaml
260 lines (260 loc) · 9.62 KB
/
Common-KeyPairs.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
AWSTemplateFormatVersion: 2010-09-09
Description: Common-KeyPairs Template.
This imports EC2 KeyPairs. For each KeyPair, an rsa key must have been previously generated with the ssh-keygen command.
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Stack Dependencies
Parameters:
- BaselineStackName
- Label:
default: KeyPair Configuration
Parameters:
- BootstrapPublicKey
- BootstrapAdministratorPublicKey
- BootstrapUserPublicKey
- AdministratorPublicKey
- DeveloperPublicKey
- UserPublicKey
- ExamplePublicKey
- DemoPublicKey
ParameterLabels:
BaselineStackName:
default: Baseline Stack Name
BootstrapPublicKey:
default: Bootstrap PublicKey
BootstrapAdministratorPublicKey:
default: BootstrapAdministrator PublicKey
BootstrapUserPublicKey:
default: BootstrapUser PublicKey
AdministratorPublicKey:
default: Administrator PublicKey
DeveloperPublicKey:
default: Developer PublicKey
UserPublicKey:
default: User PublicKey
ExamplePublicKey:
default: Example PublicKey
DemoPublicKey:
default: Demo PublicKey
Parameters:
BaselineStackName:
Description: Name of the CloudFormation Stack containing the Baseline Resources
Type: String
MinLength: 2
MaxLength: 64
Default: Baseline
AllowedPattern: ^[A-Z][-a-zA-Z0-9]*$
ConstraintDescription: must begin with an upper case letter and contain alphanumeric characters and dashes.
BootstrapPublicKey:
Description: Optional public key for the bootstrap KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
BootstrapAdministratorPublicKey:
Description: Optional public key for the bootstrapadministrator KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
BootstrapUserPublicKey:
Description: Optional public key for the bootstrapuser KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
AdministratorPublicKey:
Description: Optional public key for the administrator KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
DeveloperPublicKey:
Description: Optional public key for the developer KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
UserPublicKey:
Description: Optional public key for the user KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
ExamplePublicKey:
Description: Optional public key for the example KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
DemoPublicKey:
Description: Optional public key for the demo KeyPair
Type: String
NoEcho: true
Default: ''
AllowedPattern: (^$|^ssh-rsa AAAAB3NzaC1yc2E[=/+A-Za-z0-9]{701}( .*)?$)
ConstraintDescription: must be a valid Public Key in OpenSSH format, if specified.
Conditions:
ConfigureBootstrapKeyPair: !Not [ !Equals [ !Ref BootstrapPublicKey, '' ]]
ConfigureBootstrapAdministratorKeyPair: !Not [ !Equals [ !Ref BootstrapAdministratorPublicKey, '' ]]
ConfigureBootstrapUserKeyPair: !Not [ !Equals [ !Ref BootstrapUserPublicKey, '' ]]
ConfigureAdministratorKeyPair: !Not [ !Equals [ !Ref AdministratorPublicKey, '' ]]
ConfigureDeveloperKeyPair: !Not [ !Equals [ !Ref DeveloperPublicKey, '' ]]
ConfigureUserKeyPair: !Not [ !Equals [ !Ref UserPublicKey, '' ]]
ConfigureExampleKeyPair: !Not [ !Equals [ !Ref ExamplePublicKey, '' ]]
ConfigureDemoKeyPair: !Not [ !Equals [ !Ref DemoPublicKey, '' ]]
Resources:
BootstrapKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: bootstrap
PublicKey: !Ref BootstrapPublicKey
Condition: ConfigureBootstrapKeyPair
BootstrapAdministratorKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: bootstrapadministrator
PublicKey: !Ref BootstrapAdministratorPublicKey
Condition: ConfigureBootstrapAdministratorKeyPair
BootstrapUserKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: bootstrapuser
PublicKey: !Ref BootstrapUserPublicKey
Condition: ConfigureBootstrapUserKeyPair
AdministratorKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: administrator
PublicKey: !Ref AdministratorPublicKey
Condition: ConfigureAdministratorKeyPair
DeveloperKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: developer
PublicKey: !Ref DeveloperPublicKey
Condition: ConfigureDeveloperKeyPair
UserKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: user
PublicKey: !Ref UserPublicKey
Condition: ConfigureUserKeyPair
ExampleKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: example
PublicKey: !Ref ExamplePublicKey
Condition: ConfigureExampleKeyPair
DemoKeyPair:
Type: Custom::KeyPair
Properties:
ServiceToken: !ImportValue
Fn::Sub: ${BaselineStackName}-KeyPairFunctionArn
KeyName: demo
PublicKey: !Ref DemoPublicKey
Condition: ConfigureDemoKeyPair
Outputs:
BootstrapKeyPair:
Description: The Bootstrap KeyPair
Value: !Ref BootstrapKeyPair
Export:
Name: !Sub ${AWS::StackName}-BootstrapKeyPair
Condition: ConfigureBootstrapKeyPair
BootstrapKeyPairFingerprint:
Description: The Bootstrap KeyPair Fingerprint
Value: !GetAtt BootstrapKeyPair.Fingerprint
Condition: ConfigureBootstrapKeyPair
BootstrapAdministratorKeyPair:
Description: The BootstrapAdministrator KeyPair
Value: !Ref BootstrapAdministratorKeyPair
Export:
Name: !Sub ${AWS::StackName}-BootstrapAdministratorKeyPair
Condition: ConfigureBootstrapAdministratorKeyPair
BootstrapAdministratorKeyPairFingerprint:
Description: The BootstrapAdministrator KeyPair Fingerprint
Value: !GetAtt BootstrapAdministratorKeyPair.Fingerprint
Condition: ConfigureBootstrapAdministratorKeyPair
BootstrapUserKeyPair:
Description: The BootstrapUser KeyPair
Value: !Ref BootstrapUserKeyPair
Export:
Name: !Sub ${AWS::StackName}-BootstrapUserKeyPair
Condition: ConfigureBootstrapUserKeyPair
BootstrapUserKeyPairFingerprint:
Description: The BootstrapUser KeyPair Fingerprint
Value: !GetAtt BootstrapUserKeyPair.Fingerprint
Condition: ConfigureBootstrapUserKeyPair
AdministratorKeyPair:
Description: The Administrator KeyPair
Value: !Ref AdministratorKeyPair
Export:
Name: !Sub ${AWS::StackName}-AdministratorKeyPair
Condition: ConfigureAdministratorKeyPair
AdministratorKeyPairFingerprint:
Description: The Administrator KeyPair Fingerprint
Value: !GetAtt AdministratorKeyPair.Fingerprint
Condition: ConfigureAdministratorKeyPair
DeveloperKeyPair:
Description: The Developer KeyPair
Value: !Ref DeveloperKeyPair
Export:
Name: !Sub ${AWS::StackName}-DeveloperKeyPair
Condition: ConfigureDeveloperKeyPair
DeveloperKeyPairFingerprint:
Description: The Developer KeyPair Fingerprint
Value: !GetAtt DeveloperKeyPair.Fingerprint
Condition: ConfigureDeveloperKeyPair
UserKeyPair:
Description: The User KeyPair
Value: !Ref UserKeyPair
Export:
Name: !Sub ${AWS::StackName}-UserKeyPair
Condition: ConfigureUserKeyPair
UserKeyPairFingerprint:
Description: The User KeyPair Fingerprint
Value: !GetAtt UserKeyPair.Fingerprint
Condition: ConfigureUserKeyPair
ExampleKeyPair:
Description: The Example KeyPair
Value: !Ref ExampleKeyPair
Export:
Name: !Sub ${AWS::StackName}-ExampleKeyPair
Condition: ConfigureExampleKeyPair
ExampleKeyPairFingerprint:
Description: The Example KeyPair Fingerprint
Value: !GetAtt ExampleKeyPair.Fingerprint
Condition: ConfigureExampleKeyPair
DemoKeyPair:
Description: The Demo KeyPair
Value: !Ref DemoKeyPair
Export:
Name: !Sub ${AWS::StackName}-DemoKeyPair
Condition: ConfigureDemoKeyPair
DemoKeyPairFingerprint:
Description: The Demo KeyPair Fingerprint
Value: !GetAtt DemoKeyPair.Fingerprint
Condition: ConfigureDemoKeyPair