forked from aws-cloudformation/cfn-lint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeneric.yaml
164 lines (164 loc) · 4.08 KB
/
generic.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
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Parameters:
WebServerPort:
Type: String
Default: 80
Description: Web Server Ports
Package:
Type: String
Default: httpd
Description: Package to install
Package1:
Type: String
Default: httpd
Description: Package to install
pIops:
Type: Number
Default: 60
pEnvironment:
Type: String
Default: Prod
pProdVolumeSize:
Type: Number
Default: 50
pDevVolumeSize:
Type: Number
Default: 25
Conditions:
ProdVolumeSize: !Equals [!Ref pEnvironment, "Prod"]
Resources:
MyModule:
Type: "My::Organization::Custom::MODULE"
RootRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Principal:
Service:
- "ec2.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: "/"
Policies:
- PolicyName: "root"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action: "*"
Resource: "*"
RolePolicies:
Type: "AWS::IAM::Policy"
Properties:
PolicyName: "root"
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action: "*"
Resource: "*"
Roles:
- Ref: "RootRole"
RootInstanceProfile:
Type: "AWS::IAM::InstanceProfile"
Properties:
Path: "/"
Roles:
- Ref: "RootRole"
MyEC2Instance:
Type: "AWS::EC2::Instance"
Properties:
ImageId: "ami-2f726546"
InstanceType: t3.micro
KeyName: testkey
IamInstanceProfile: !Ref RootInstanceProfile
BlockDeviceMappings:
- DeviceName: /dev/sdm
Ebs:
VolumeType: io1
Iops: !Ref pIops
DeleteOnTermination: false
VolumeSize: 20
NetworkInterfaces:
- DeviceIndex: "1"
UserData: !Sub |
yum install ${ Package}
mySnsTopic:
Type: AWS::SNS::Topic
MyEC2Instance1:
Type: "AWS::EC2::Instance"
Properties:
ImageId: "ami-2f726546"
InstanceType: t3.micro
KeyName: testkey
BlockDeviceMappings:
- DeviceName: /dev/sdm
Ebs:
VolumeType: io1
Iops: !Ref pIops
DeleteOnTermination: false
VolumeSize:
!If [ProdVolumeSize, !Ref pProdVolumeSize, !Ref pDevVolumeSize]
NetworkInterfaces:
- DeviceIndex: "1"
PrivateIpAddresses:
- PrivateIpAddress: 1.1.1.1
Primary: true
- PrivateIpAddress: 1.1.1.2
Primary: false
UserData:
Fn::Sub:
- "yum install ${myPackage}"
- myPackage: !Ref Package1
ElasticIP:
Type: "AWS::EC2::EIP"
Properties:
Domain: "vpc"
ElasticLoadBalancer:
Type: AWS::ElasticLoadBalancing::LoadBalancer
Properties:
AvailabilityZones:
Fn::GetAZs: ""
Instances:
- Ref: MyEC2Instance
Listeners:
- LoadBalancerPort: "80"
InstancePort:
Ref: WebServerPort
Protocol: HTTP
HealthCheck:
Target:
Fn::Sub: "HTTP:${WebServerPort}/"
HealthyThreshold: "3"
UnhealthyThreshold: "5"
Interval: "30"
Timeout: "5"
IamPipeline:
DeletionPolicy: Delete
UpdateReplacePolicy: Delete
Type: "AWS::CloudFormation::Stack"
Properties:
TemplateURL: !Sub "https://s3.${ AWS::Region}.amazonaws.com/ss-vsts-codepipeline-${AWS::Region}/vsts/${AWS::AccountId}/templates/vsts-pipeline/pipeline.yaml"
Parameters:
DeploymentName: iam-pipeline
Deploy: "auto"
CustomResource:
Type: Custom::Function
Version: "1.0"
Properties:
ServiceToken: anArn
WaitCondition:
Type: AWS::CloudFormation::WaitCondition
CreationPolicy:
ResourceSignal:
Timeout: PT15M
Count: 1
Outputs:
ElasticIP:
Value: !Sub "${ElasticIP}/32"
Export:
Name: "elastic-ip-cidr"