forked from tstlam/templates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fedora-cfn-helper-test.yaml
50 lines (50 loc) · 1.35 KB
/
fedora-cfn-helper-test.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
HeatTemplateFormatVersion: '2012-12-12'
Parameters:
flavor:
Type: String
Default: m1.small
image:
Type: String
Default: fedora
network:
Type: String
Default: 5f496f20-9d74-44b3-87f8-fee38c99ca87
keyname:
Type: String
Default: lxiaojun
Resources:
CfnUser: {Type: 'AWS::IAM::User'}
WebServerKeys:
Type: AWS::IAM::AccessKey
Properties:
UserName: {Ref: CfnUser}
Server:
Type: AWS::EC2::Instance
Metadata:
AWS::CloudFormation::Init:
config:
files:
/etc/cfn/cfn-credentials:
content:
'Fn::Replace':
- WebServerKeys: {Ref: WebServerKeys}
WebSecretKey: {'Fn::GetAtt': [WebServerKeys, SecretAccessKey]}
- |
AWSAccessKeyId=WebServerKeys
AWSSecretKey=WebSecretKey
mode: '000400'
owner: root
group: root
Properties:
ImageId: {Ref: image}
InstanceType: {Ref: flavor}
KeyName: {Ref: keyname}
SubnetId: {Ref: network}
UserData:
Fn::Base64:
Fn::Replace:
- 'AWS::StackName': {Ref: 'AWS::StackName'}
'AWS::Region': {Ref: 'AWS::Region'}
- |
#!/bin/bash -v
/opt/aws/bin/cfn-init -s AWS::StackName -r Server --region AWS::Region