AnimeshShaw commited on
Commit
8718bc4
·
1 Parent(s): a66ea27

Add human_reference_dataset/aws-cloudformation-templates/EC2/

Browse files
human_reference_dataset/aws-cloudformation-templates/EC2/EC2InstanceWithSecurityGroupSample.json ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "AWS CloudFormation Sample Template EC2InstanceWithSecurityGroupSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
4
+ "Metadata": {
5
+ "License": "Apache-2.0"
6
+ },
7
+ "Parameters": {
8
+ "KeyName": {
9
+ "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
10
+ "Type": "AWS::EC2::KeyPair::KeyName",
11
+ "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
12
+ },
13
+ "InstanceType": {
14
+ "Description": "WebServer EC2 instance type",
15
+ "Type": "String",
16
+ "AllowedValues": [
17
+ "t2.nano",
18
+ "t2.micro",
19
+ "t2.small",
20
+ "t2.medium",
21
+ "t2.large",
22
+ "t2.xlarge",
23
+ "t2.2xlarge",
24
+ "t3.nano",
25
+ "t3.micro",
26
+ "t3.small",
27
+ "t3.medium",
28
+ "t3.large",
29
+ "t3.xlarge",
30
+ "t3.2xlarge",
31
+ "m4.large",
32
+ "m4.xlarge",
33
+ "m4.2xlarge",
34
+ "m4.4xlarge",
35
+ "m4.10xlarge",
36
+ "m5.large",
37
+ "m5.xlarge",
38
+ "m5.2xlarge",
39
+ "m5.4xlarge",
40
+ "c5.large",
41
+ "c5.xlarge",
42
+ "c5.2xlarge",
43
+ "c5.4xlarge",
44
+ "c5.9xlarge",
45
+ "g3.8xlarge",
46
+ "r5.large",
47
+ "r5.xlarge",
48
+ "r5.2xlarge",
49
+ "r5.4xlarge",
50
+ "i3.xlarge",
51
+ "i3.2xlarge",
52
+ "i3.4xlarge",
53
+ "i3.8xlarge",
54
+ "d2.xlarge",
55
+ "d2.2xlarge",
56
+ "d2.4xlarge",
57
+ "d2.8xlarge"
58
+ ],
59
+ "Default": "t3.small",
60
+ "ConstraintDescription": "must be a valid EC2 instance type."
61
+ },
62
+ "SSHLocation": {
63
+ "Description": "The IP address range that can be used to SSH to the EC2 instances",
64
+ "Type": "String",
65
+ "Default": "192.168.1.0/0",
66
+ "MinLength": 9,
67
+ "MaxLength": 18,
68
+ "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
69
+ "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
70
+ },
71
+ "LatestAmiId": {
72
+ "Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
73
+ "Default": "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
74
+ },
75
+ "Subnets": {
76
+ "Type": "List<AWS::EC2::Subnet::Id>"
77
+ }
78
+ },
79
+ "Resources": {
80
+ "EC2Instance": {
81
+ "Type": "AWS::EC2::Instance",
82
+ "Properties": {
83
+ "InstanceType": {
84
+ "Ref": "InstanceType"
85
+ },
86
+ "SubnetId": {
87
+ "Fn::Select": [
88
+ 0,
89
+ {
90
+ "Ref": "Subnets"
91
+ }
92
+ ]
93
+ },
94
+ "SecurityGroupIds": [
95
+ {
96
+ "Fn::GetAtt": [
97
+ "InstanceSecurityGroup",
98
+ "GroupId"
99
+ ]
100
+ }
101
+ ],
102
+ "KeyName": {
103
+ "Ref": "KeyName"
104
+ },
105
+ "ImageId": {
106
+ "Ref": "LatestAmiId"
107
+ }
108
+ }
109
+ },
110
+ "InstanceSecurityGroup": {
111
+ "Type": "AWS::EC2::SecurityGroup",
112
+ "Metadata": {
113
+ "guard": {
114
+ "SuppressedRules": [
115
+ "INCOMING_SSH_DISABLED"
116
+ ]
117
+ }
118
+ },
119
+ "Properties": {
120
+ "GroupDescription": "Enable SSH access via port 22",
121
+ "SecurityGroupIngress": [
122
+ {
123
+ "IpProtocol": "tcp",
124
+ "FromPort": 22,
125
+ "ToPort": 22,
126
+ "CidrIp": {
127
+ "Ref": "SSHLocation"
128
+ }
129
+ }
130
+ ]
131
+ }
132
+ }
133
+ },
134
+ "Outputs": {
135
+ "InstanceId": {
136
+ "Description": "InstanceId of the newly created EC2 instance",
137
+ "Value": {
138
+ "Ref": "EC2Instance"
139
+ }
140
+ },
141
+ "AZ": {
142
+ "Description": "Availability Zone of the newly created EC2 instance",
143
+ "Value": {
144
+ "Fn::GetAtt": [
145
+ "EC2Instance",
146
+ "AvailabilityZone"
147
+ ]
148
+ }
149
+ },
150
+ "PublicDNS": {
151
+ "Description": "Public DNSName of the newly created EC2 instance",
152
+ "Value": {
153
+ "Fn::GetAtt": [
154
+ "EC2Instance",
155
+ "PublicDnsName"
156
+ ]
157
+ }
158
+ },
159
+ "PublicIP": {
160
+ "Description": "Public IP address of the newly created EC2 instance",
161
+ "Value": {
162
+ "Fn::GetAtt": [
163
+ "EC2Instance",
164
+ "PublicIp"
165
+ ]
166
+ }
167
+ }
168
+ }
169
+ }
human_reference_dataset/aws-cloudformation-templates/EC2/EC2InstanceWithSecurityGroupSample.yaml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: 'AWS CloudFormation Sample Template EC2InstanceWithSecurityGroupSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.'
4
+
5
+ Metadata:
6
+ License: Apache-2.0
7
+
8
+ Parameters:
9
+ KeyName:
10
+ Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
11
+ Type: AWS::EC2::KeyPair::KeyName
12
+ ConstraintDescription: must be the name of an existing EC2 KeyPair.
13
+
14
+ InstanceType:
15
+ Description: WebServer EC2 instance type
16
+ Type: String
17
+ AllowedValues:
18
+ - t2.nano
19
+ - t2.micro
20
+ - t2.small
21
+ - t2.medium
22
+ - t2.large
23
+ - t2.xlarge
24
+ - t2.2xlarge
25
+ - t3.nano
26
+ - t3.micro
27
+ - t3.small
28
+ - t3.medium
29
+ - t3.large
30
+ - t3.xlarge
31
+ - t3.2xlarge
32
+ - m4.large
33
+ - m4.xlarge
34
+ - m4.2xlarge
35
+ - m4.4xlarge
36
+ - m4.10xlarge
37
+ - m5.large
38
+ - m5.xlarge
39
+ - m5.2xlarge
40
+ - m5.4xlarge
41
+ - c5.large
42
+ - c5.xlarge
43
+ - c5.2xlarge
44
+ - c5.4xlarge
45
+ - c5.9xlarge
46
+ - g3.8xlarge
47
+ - r5.large
48
+ - r5.xlarge
49
+ - r5.2xlarge
50
+ - r5.4xlarge
51
+ - i3.xlarge
52
+ - i3.2xlarge
53
+ - i3.4xlarge
54
+ - i3.8xlarge
55
+ - d2.xlarge
56
+ - d2.2xlarge
57
+ - d2.4xlarge
58
+ - d2.8xlarge
59
+ Default: t3.small
60
+ ConstraintDescription: must be a valid EC2 instance type.
61
+
62
+ SSHLocation:
63
+ Description: The IP address range that can be used to SSH to the EC2 instances
64
+ Type: String
65
+ Default: 192.168.1.0/0
66
+ MinLength: 9
67
+ MaxLength: 18
68
+ AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
69
+ ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
70
+
71
+ LatestAmiId:
72
+ Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
73
+ Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
74
+
75
+ Subnets:
76
+ Type: List<AWS::EC2::Subnet::Id>
77
+
78
+ Resources:
79
+ EC2Instance:
80
+ Type: AWS::EC2::Instance
81
+ Properties:
82
+ InstanceType: !Ref InstanceType
83
+ SubnetId: !Select
84
+ - 0
85
+ - !Ref Subnets
86
+ SecurityGroupIds:
87
+ - !GetAtt InstanceSecurityGroup.GroupId
88
+ KeyName: !Ref KeyName
89
+ ImageId: !Ref LatestAmiId
90
+
91
+ InstanceSecurityGroup:
92
+ Type: AWS::EC2::SecurityGroup
93
+ Metadata:
94
+ guard:
95
+ SuppressedRules:
96
+ - INCOMING_SSH_DISABLED
97
+ Properties:
98
+ GroupDescription: Enable SSH access via port 22
99
+ SecurityGroupIngress:
100
+ - IpProtocol: tcp
101
+ FromPort: 22
102
+ ToPort: 22
103
+ CidrIp: !Ref SSHLocation
104
+
105
+ Outputs:
106
+ InstanceId:
107
+ Description: InstanceId of the newly created EC2 instance
108
+ Value: !Ref EC2Instance
109
+
110
+ AZ:
111
+ Description: Availability Zone of the newly created EC2 instance
112
+ Value: !GetAtt EC2Instance.AvailabilityZone
113
+
114
+ PublicDNS:
115
+ Description: Public DNSName of the newly created EC2 instance
116
+ Value: !GetAtt EC2Instance.PublicDnsName
117
+
118
+ PublicIP:
119
+ Description: Public IP address of the newly created EC2 instance
120
+ Value: !GetAtt EC2Instance.PublicIp
human_reference_dataset/aws-cloudformation-templates/EC2/EC2_Instance_With_Ephemeral_Drives.json ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "AWS CloudFormation Sample Template EC2_Instance_With_Ephemeral_Drives: Example to show how to attach ephemeral drives using EC2 block device mappings. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
4
+ "Metadata": {
5
+ "License": "Apache-2.0"
6
+ },
7
+ "Parameters": {
8
+ "KeyName": {
9
+ "Description": "Name of an existing EC2 KeyPair to enable SSH access to the web server",
10
+ "Type": "AWS::EC2::KeyPair::KeyName",
11
+ "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
12
+ },
13
+ "InstanceType": {
14
+ "Description": "WebServer EC2 instance type",
15
+ "Type": "String",
16
+ "AllowedValues": [
17
+ "t2.nano",
18
+ "t2.micro",
19
+ "t2.small",
20
+ "t2.medium",
21
+ "t2.large",
22
+ "t2.xlarge",
23
+ "t2.2xlarge",
24
+ "t3.nano",
25
+ "t3.micro",
26
+ "t3.small",
27
+ "t3.medium",
28
+ "t3.large",
29
+ "t3.xlarge",
30
+ "t3.2xlarge",
31
+ "m4.large",
32
+ "m4.xlarge",
33
+ "m4.2xlarge",
34
+ "m4.4xlarge",
35
+ "m4.10xlarge",
36
+ "m5.large",
37
+ "m5.xlarge",
38
+ "m5.2xlarge",
39
+ "m5.4xlarge",
40
+ "c5.large",
41
+ "c5.xlarge",
42
+ "c5.2xlarge",
43
+ "c5.4xlarge",
44
+ "c5.9xlarge",
45
+ "g3.8xlarge",
46
+ "r5.large",
47
+ "r5.xlarge",
48
+ "r5.2xlarge",
49
+ "r5.4xlarge",
50
+ "r5.12xlarge",
51
+ "i3.xlarge",
52
+ "i3.2xlarge",
53
+ "i3.4xlarge",
54
+ "i3.8xlarge",
55
+ "d2.xlarge",
56
+ "d2.2xlarge",
57
+ "d2.4xlarge",
58
+ "d2.8xlarge"
59
+ ],
60
+ "Default": "t2.nano",
61
+ "ConstraintDescription": "must be a valid EC2 instance type."
62
+ },
63
+ "SSHLocation": {
64
+ "Description": "Lockdown SSH access to the bastion host (default can be accessed from anywhere)",
65
+ "Type": "String",
66
+ "Default": "198.162.1.0/0",
67
+ "MinLength": "9",
68
+ "MaxLength": "18",
69
+ "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
70
+ "ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x."
71
+ },
72
+ "LatestAmiId": {
73
+ "Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
74
+ "Default": "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
75
+ },
76
+ "Subnets": {
77
+ "Type": "List<AWS::EC2::Subnet::Id>"
78
+ }
79
+ },
80
+ "Resources": {
81
+ "EC2Instance": {
82
+ "Type": "AWS::EC2::Instance",
83
+ "Properties": {
84
+ "InstanceType": {
85
+ "Ref": "InstanceType"
86
+ },
87
+ "SubnetId": {
88
+ "Fn::Select": [
89
+ 0,
90
+ {
91
+ "Ref": "Subnets"
92
+ }
93
+ ]
94
+ },
95
+ "SecurityGroups": [
96
+ {
97
+ "Ref": "EC2SecurityGroup"
98
+ }
99
+ ],
100
+ "KeyName": {
101
+ "Ref": "KeyName"
102
+ },
103
+ "ImageId": {
104
+ "Ref": "LatestAmiId"
105
+ },
106
+ "BlockDeviceMappings": [
107
+ {
108
+ "DeviceName": "/dev/sdc",
109
+ "VirtualName": "ephemeral0"
110
+ }
111
+ ]
112
+ }
113
+ },
114
+ "EC2SecurityGroup": {
115
+ "Type": "AWS::EC2::SecurityGroup",
116
+ "Metadata": {
117
+ "guard": {
118
+ "SuppressedRules": [
119
+ "INCOMING_SSH_DISABLED"
120
+ ]
121
+ }
122
+ },
123
+ "Properties": {
124
+ "GroupDescription": "SSH access",
125
+ "SecurityGroupIngress": [
126
+ {
127
+ "IpProtocol": "tcp",
128
+ "FromPort": "22",
129
+ "ToPort": "22",
130
+ "CidrIp": {
131
+ "Ref": "SSHLocation"
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ }
137
+ },
138
+ "Outputs": {
139
+ "Instance": {
140
+ "Description": "DNS Name of the newly created EC2 instance",
141
+ "Value": {
142
+ "Fn::GetAtt": [
143
+ "EC2Instance",
144
+ "PublicDnsName"
145
+ ]
146
+ }
147
+ }
148
+ }
149
+ }
human_reference_dataset/aws-cloudformation-templates/EC2/EC2_Instance_With_Ephemeral_Drives.yaml ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: 'AWS CloudFormation Sample Template EC2_Instance_With_Ephemeral_Drives: Example to show how to attach ephemeral drives using EC2 block device mappings. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.'
4
+
5
+ Metadata:
6
+ License: Apache-2.0
7
+
8
+ Parameters:
9
+ KeyName:
10
+ Description: Name of an existing EC2 KeyPair to enable SSH access to the web server
11
+ Type: AWS::EC2::KeyPair::KeyName
12
+ ConstraintDescription: must be the name of an existing EC2 KeyPair.
13
+
14
+ InstanceType:
15
+ Description: WebServer EC2 instance type
16
+ Type: String
17
+ AllowedValues:
18
+ - t2.nano
19
+ - t2.micro
20
+ - t2.small
21
+ - t2.medium
22
+ - t2.large
23
+ - t2.xlarge
24
+ - t2.2xlarge
25
+ - t3.nano
26
+ - t3.micro
27
+ - t3.small
28
+ - t3.medium
29
+ - t3.large
30
+ - t3.xlarge
31
+ - t3.2xlarge
32
+ - m4.large
33
+ - m4.xlarge
34
+ - m4.2xlarge
35
+ - m4.4xlarge
36
+ - m4.10xlarge
37
+ - m5.large
38
+ - m5.xlarge
39
+ - m5.2xlarge
40
+ - m5.4xlarge
41
+ - c5.large
42
+ - c5.xlarge
43
+ - c5.2xlarge
44
+ - c5.4xlarge
45
+ - c5.9xlarge
46
+ - g3.8xlarge
47
+ - r5.large
48
+ - r5.xlarge
49
+ - r5.2xlarge
50
+ - r5.4xlarge
51
+ - r5.12xlarge
52
+ - i3.xlarge
53
+ - i3.2xlarge
54
+ - i3.4xlarge
55
+ - i3.8xlarge
56
+ - d2.xlarge
57
+ - d2.2xlarge
58
+ - d2.4xlarge
59
+ - d2.8xlarge
60
+ Default: t2.nano
61
+ ConstraintDescription: must be a valid EC2 instance type.
62
+
63
+ SSHLocation:
64
+ Description: Lockdown SSH access to the bastion host (default can be accessed from anywhere)
65
+ Type: String
66
+ Default: 198.162.1.0/0
67
+ MinLength: "9"
68
+ MaxLength: "18"
69
+ AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
70
+ ConstraintDescription: must be a valid CIDR range of the form x.x.x.x/x.
71
+
72
+ LatestAmiId:
73
+ Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
74
+ Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
75
+
76
+ Subnets:
77
+ Type: List<AWS::EC2::Subnet::Id>
78
+
79
+ Resources:
80
+ EC2Instance:
81
+ Type: AWS::EC2::Instance
82
+ Properties:
83
+ InstanceType: !Ref InstanceType
84
+ SubnetId: !Select
85
+ - 0
86
+ - !Ref Subnets
87
+ SecurityGroupIds:
88
+ - !GetAtt EC2SecurityGroup.GroupId
89
+ KeyName: !Ref KeyName
90
+ ImageId: !Ref LatestAmiId
91
+ BlockDeviceMappings:
92
+ - DeviceName: /dev/sdc
93
+ VirtualName: ephemeral0
94
+
95
+ EC2SecurityGroup:
96
+ Type: AWS::EC2::SecurityGroup
97
+ Metadata:
98
+ guard:
99
+ SuppressedRules:
100
+ - INCOMING_SSH_DISABLED
101
+ Properties:
102
+ GroupDescription: SSH access
103
+ SecurityGroupIngress:
104
+ - IpProtocol: tcp
105
+ FromPort: "22"
106
+ ToPort: "22"
107
+ CidrIp: !Ref SSHLocation
108
+
109
+ Outputs:
110
+ Instance:
111
+ Description: DNS Name of the newly created EC2 instance
112
+ Value: !GetAtt EC2Instance.PublicDnsName
human_reference_dataset/aws-cloudformation-templates/EC2/EIP_With_Association.json ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "AWS CloudFormation Sample Template Sample template EIP_With_Association: This template shows how to associate an Elastic IP address with an Amazon EC2 instance - you can use this same technique to associate an EC2 instance with an Elastic IP Address that is not created inside the template by replacing the EIP reference in the AWS::EC2::EIPAssoication resource type with the IP address of the external EIP. **WARNING** This template creates an Amazon EC2 instance and an Elastic IP Address. You will be billed for the AWS resources used if you create a stack from this template.",
4
+ "Metadata": {
5
+ "License": "Apache-2.0"
6
+ },
7
+ "Parameters": {
8
+ "InstanceType": {
9
+ "Description": "WebServer EC2 instance type",
10
+ "Type": "String",
11
+ "AllowedValues": [
12
+ "t2.nano",
13
+ "t2.micro",
14
+ "t2.small",
15
+ "t2.medium",
16
+ "t2.large",
17
+ "t2.xlarge",
18
+ "t2.2xlarge",
19
+ "t3.nano",
20
+ "t3.micro",
21
+ "t3.small",
22
+ "t3.medium",
23
+ "t3.large",
24
+ "t3.xlarge",
25
+ "t3.2xlarge",
26
+ "m4.large",
27
+ "m4.xlarge",
28
+ "m4.2xlarge",
29
+ "m4.4xlarge",
30
+ "m4.10xlarge",
31
+ "m5.large",
32
+ "m5.xlarge",
33
+ "m5.2xlarge",
34
+ "m5.4xlarge",
35
+ "c5.large",
36
+ "c5.xlarge",
37
+ "c5.2xlarge",
38
+ "c5.4xlarge",
39
+ "c5.9xlarge",
40
+ "g3.8xlarge",
41
+ "r5.large",
42
+ "r5.xlarge",
43
+ "r5.2xlarge",
44
+ "r5.4xlarge",
45
+ "r5.12xlarge",
46
+ "i3.xlarge",
47
+ "i3.2xlarge",
48
+ "i3.4xlarge",
49
+ "i3.8xlarge",
50
+ "d2.xlarge",
51
+ "d2.2xlarge",
52
+ "d2.4xlarge",
53
+ "d2.8xlarge"
54
+ ],
55
+ "Default": "t3.small",
56
+ "ConstraintDescription": "must be a valid EC2 instance type."
57
+ },
58
+ "KeyName": {
59
+ "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
60
+ "Type": "AWS::EC2::KeyPair::KeyName",
61
+ "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
62
+ },
63
+ "SSHLocation": {
64
+ "Description": "The IP address range that can be used to SSH to the EC2 instances",
65
+ "Type": "String",
66
+ "Default": "0.0.0.0/0",
67
+ "MinLength": "9",
68
+ "MaxLength": "18",
69
+ "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
70
+ "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
71
+ },
72
+ "LatestAmiId": {
73
+ "Type": "AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>",
74
+ "Default": "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2"
75
+ },
76
+ "Subnets": {
77
+ "Type": "List<AWS::EC2::Subnet::Id>"
78
+ }
79
+ },
80
+ "Resources": {
81
+ "EC2Instance": {
82
+ "Type": "AWS::EC2::Instance",
83
+ "Properties": {
84
+ "UserData": {
85
+ "Fn::Base64": {
86
+ "Fn::Join": [
87
+ "",
88
+ [
89
+ "IPAddress=",
90
+ {
91
+ "Ref": "IPAddress"
92
+ }
93
+ ]
94
+ ]
95
+ }
96
+ },
97
+ "InstanceType": {
98
+ "Ref": "InstanceType"
99
+ },
100
+ "SubnetId": {
101
+ "Fn::Select": [
102
+ 0,
103
+ {
104
+ "Ref": "Subnets"
105
+ }
106
+ ]
107
+ },
108
+ "SecurityGroups": [
109
+ {
110
+ "Ref": "InstanceSecurityGroup"
111
+ }
112
+ ],
113
+ "KeyName": {
114
+ "Ref": "KeyName"
115
+ },
116
+ "ImageId": {
117
+ "Ref": "LatestAmiId"
118
+ }
119
+ }
120
+ },
121
+ "InstanceSecurityGroup": {
122
+ "Type": "AWS::EC2::SecurityGroup",
123
+ "Properties": {
124
+ "GroupDescription": "Enable SSH access",
125
+ "SecurityGroupIngress": [
126
+ {
127
+ "IpProtocol": "tcp",
128
+ "FromPort": "22",
129
+ "ToPort": "22",
130
+ "CidrIp": {
131
+ "Ref": "SSHLocation"
132
+ }
133
+ }
134
+ ]
135
+ }
136
+ },
137
+ "IPAddress": {
138
+ "Type": "AWS::EC2::EIP"
139
+ },
140
+ "IPAssoc": {
141
+ "Type": "AWS::EC2::EIPAssociation",
142
+ "Properties": {
143
+ "InstanceId": {
144
+ "Ref": "EC2Instance"
145
+ },
146
+ "AllocationId": {
147
+ "Fn::GetAtt": [
148
+ "IPAddress",
149
+ "AllocationId"
150
+ ]
151
+ }
152
+ }
153
+ }
154
+ },
155
+ "Outputs": {
156
+ "InstanceId": {
157
+ "Description": "InstanceId of the newly created EC2 instance",
158
+ "Value": {
159
+ "Ref": "EC2Instance"
160
+ }
161
+ },
162
+ "InstanceIPAddress": {
163
+ "Description": "IP address of the newly created EC2 instance",
164
+ "Value": {
165
+ "Ref": "IPAddress"
166
+ }
167
+ }
168
+ }
169
+ }
human_reference_dataset/aws-cloudformation-templates/EC2/EIP_With_Association.yaml ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: 'AWS CloudFormation Sample Template Sample template EIP_With_Association: This template shows how to associate an Elastic IP address with an Amazon EC2 instance - you can use this same technique to associate an EC2 instance with an Elastic IP Address that is not created inside the template by replacing the EIP reference in the AWS::EC2::EIPAssoication resource type with the IP address of the external EIP. **WARNING** This template creates an Amazon EC2 instance and an Elastic IP Address. You will be billed for the AWS resources used if you create a stack from this template.'
4
+
5
+ Metadata:
6
+ License: Apache-2.0
7
+
8
+ Parameters:
9
+ InstanceType:
10
+ Description: WebServer EC2 instance type
11
+ Type: String
12
+ AllowedValues:
13
+ - t2.nano
14
+ - t2.micro
15
+ - t2.small
16
+ - t2.medium
17
+ - t2.large
18
+ - t2.xlarge
19
+ - t2.2xlarge
20
+ - t3.nano
21
+ - t3.micro
22
+ - t3.small
23
+ - t3.medium
24
+ - t3.large
25
+ - t3.xlarge
26
+ - t3.2xlarge
27
+ - m4.large
28
+ - m4.xlarge
29
+ - m4.2xlarge
30
+ - m4.4xlarge
31
+ - m4.10xlarge
32
+ - m5.large
33
+ - m5.xlarge
34
+ - m5.2xlarge
35
+ - m5.4xlarge
36
+ - c5.large
37
+ - c5.xlarge
38
+ - c5.2xlarge
39
+ - c5.4xlarge
40
+ - c5.9xlarge
41
+ - g3.8xlarge
42
+ - r5.large
43
+ - r5.xlarge
44
+ - r5.2xlarge
45
+ - r5.4xlarge
46
+ - r5.12xlarge
47
+ - i3.xlarge
48
+ - i3.2xlarge
49
+ - i3.4xlarge
50
+ - i3.8xlarge
51
+ - d2.xlarge
52
+ - d2.2xlarge
53
+ - d2.4xlarge
54
+ - d2.8xlarge
55
+ Default: t3.small
56
+ ConstraintDescription: must be a valid EC2 instance type.
57
+
58
+ KeyName:
59
+ Description: Name of an existing EC2 KeyPair to enable SSH access to the instances
60
+ Type: AWS::EC2::KeyPair::KeyName
61
+ ConstraintDescription: must be the name of an existing EC2 KeyPair.
62
+
63
+ SSHLocation:
64
+ Description: The IP address range that can be used to SSH to the EC2 instances
65
+ Type: String
66
+ Default: 0.0.0.0/0
67
+ MinLength: "9"
68
+ MaxLength: "18"
69
+ AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
70
+ ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
71
+
72
+ LatestAmiId:
73
+ Type: AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>
74
+ Default: /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2
75
+
76
+ Subnets:
77
+ Type: List<AWS::EC2::Subnet::Id>
78
+
79
+ Resources:
80
+ EC2Instance:
81
+ Type: AWS::EC2::Instance
82
+ Properties:
83
+ UserData: !Base64
84
+ Fn::Join:
85
+ - ""
86
+ - - IPAddress=
87
+ - !Ref IPAddress
88
+ InstanceType: !Ref InstanceType
89
+ SubnetId: !Select
90
+ - 0
91
+ - !Ref Subnets
92
+ SecurityGroupIds:
93
+ - !GetAtt InstanceSecurityGroup.GroupId
94
+ KeyName: !Ref KeyName
95
+ ImageId: !Ref LatestAmiId
96
+
97
+ InstanceSecurityGroup:
98
+ Type: AWS::EC2::SecurityGroup
99
+ Properties:
100
+ GroupDescription: Enable SSH access
101
+ SecurityGroupIngress:
102
+ - IpProtocol: tcp
103
+ FromPort: "22"
104
+ ToPort: "22"
105
+ CidrIp: !Ref SSHLocation
106
+
107
+ IPAddress:
108
+ Type: AWS::EC2::EIP
109
+
110
+ IPAssoc:
111
+ Type: AWS::EC2::EIPAssociation
112
+ Properties:
113
+ InstanceId: !Ref EC2Instance
114
+ AllocationId: !GetAtt IPAddress.AllocationId
115
+
116
+ Outputs:
117
+ InstanceId:
118
+ Description: InstanceId of the newly created EC2 instance
119
+ Value: !Ref EC2Instance
120
+
121
+ InstanceIPAddress:
122
+ Description: IP address of the newly created EC2 instance
123
+ Value: !Ref IPAddress
human_reference_dataset/aws-cloudformation-templates/EC2/InstanceWithCfnInit.json ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "AWS CloudFormation sample template. \nCreate an Amazon EC2 instance with cfn-init and cfn-signal.\n",
4
+ "Resources": {
5
+ "Instance": {
6
+ "CreationPolicy": {
7
+ "ResourceSignal": {
8
+ "Timeout": "PT5M"
9
+ }
10
+ },
11
+ "Type": "AWS::EC2::Instance",
12
+ "Metadata": {
13
+ "guard": {
14
+ "SuppressedRules": [
15
+ "EC2_INSTANCES_IN_VPC"
16
+ ]
17
+ },
18
+ "AWS::CloudFormation::Init": {
19
+ "config": {
20
+ "packages": {
21
+ "yum": {
22
+ "httpd": []
23
+ }
24
+ },
25
+ "files": {
26
+ "/var/www/html/index.html": {
27
+ "content": "<body>\n <h1>Congratulations, you have successfully launched the AWS CloudFormation sample.</h1>\n</body>\n",
28
+ "mode": "000644",
29
+ "owner": "root",
30
+ "group": "root"
31
+ },
32
+ "/etc/cfn/cfn-hup.conf": {
33
+ "content": {
34
+ "Fn::Sub": "[main]\nstack=${AWS::StackId}\nregion=${AWS::Region}\n"
35
+ },
36
+ "mode": "000400",
37
+ "owner": "root",
38
+ "group": "root"
39
+ },
40
+ "/etc/cfn/hooks.d/cfn-auto-reloader.conf": {
41
+ "content": {
42
+ "Fn::Sub": "[cfn-auto-reloader-hook]\ntriggers=post.update\npath=Resources.LaunchConfig.Metadata.AWS::CloudFormation::Init\naction=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource Instance --region ${AWS::Region}\nrunas=root"
43
+ }
44
+ }
45
+ },
46
+ "services": {
47
+ "sysvinit": {
48
+ "httpd": {
49
+ "enabled": true,
50
+ "ensureRunning": true
51
+ },
52
+ "cfn-hup": {
53
+ "enabled": true,
54
+ "ensureRunning": true,
55
+ "files": [
56
+ "/etc/cfn/cfn-hup.conf",
57
+ "/etc/cfn/hooks.d/cfn-auto-reloader.conf"
58
+ ]
59
+ }
60
+ }
61
+ }
62
+ }
63
+ }
64
+ },
65
+ "Properties": {
66
+ "ImageId": "{{resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64}}",
67
+ "InstanceType": "t4g.nano",
68
+ "KeyName": "sample",
69
+ "BlockDeviceMappings": [
70
+ {
71
+ "DeviceName": "/dev/sda1",
72
+ "Ebs": {
73
+ "VolumeSize": 32
74
+ }
75
+ }
76
+ ],
77
+ "UserData": {
78
+ "Fn::Base64": {
79
+ "Fn::Sub": "#!/bin/bash\n/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource Instance --region ${AWS::Region}"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
human_reference_dataset/aws-cloudformation-templates/EC2/InstanceWithCfnInit.yaml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: "AWS CloudFormation sample template. \nCreate an Amazon EC2 instance with cfn-init and cfn-signal.\n"
4
+
5
+ Resources:
6
+ Instance:
7
+ CreationPolicy:
8
+ ResourceSignal:
9
+ Timeout: PT5M
10
+ Type: AWS::EC2::Instance
11
+ Metadata:
12
+ guard:
13
+ SuppressedRules:
14
+ - EC2_INSTANCES_IN_VPC
15
+ AWS::CloudFormation::Init:
16
+ config:
17
+ packages:
18
+ yum:
19
+ httpd: []
20
+ files:
21
+ /var/www/html/index.html:
22
+ content: |
23
+ <body>
24
+ <h1>Congratulations, you have successfully launched the AWS CloudFormation sample.</h1>
25
+ </body>
26
+ mode: "000644"
27
+ owner: root
28
+ group: root
29
+ /etc/cfn/cfn-hup.conf:
30
+ content: !Sub |
31
+ [main]
32
+ stack=${AWS::StackId}
33
+ region=${AWS::Region}
34
+ mode: "000400"
35
+ owner: root
36
+ group: root
37
+ /etc/cfn/hooks.d/cfn-auto-reloader.conf:
38
+ content: !Sub |-
39
+ [cfn-auto-reloader-hook]
40
+ triggers=post.update
41
+ path=Resources.LaunchConfig.Metadata.AWS::CloudFormation::Init
42
+ action=/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource Instance --region ${AWS::Region}
43
+ runas=root
44
+ services:
45
+ sysvinit:
46
+ httpd:
47
+ enabled: true
48
+ ensureRunning: true
49
+ cfn-hup:
50
+ enabled: true
51
+ ensureRunning: true
52
+ files:
53
+ - /etc/cfn/cfn-hup.conf
54
+ - /etc/cfn/hooks.d/cfn-auto-reloader.conf
55
+ Properties:
56
+ ImageId: '{{resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64}}'
57
+ InstanceType: t4g.nano
58
+ KeyName: sample
59
+ BlockDeviceMappings:
60
+ - DeviceName: /dev/sda1
61
+ Ebs:
62
+ VolumeSize: 32
63
+ UserData: !Base64
64
+ Fn::Sub: |-
65
+ #!/bin/bash
66
+ /opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource Instance --region ${AWS::Region}
67
+ /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource Instance --region ${AWS::Region}
human_reference_dataset/aws-cloudformation-templates/EC2/SingleENIwithMultipleEIPs.json ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "Template Creates a single EC2 instance with a single ENI which has multiple private and public IPs",
4
+ "Parameters": {
5
+ "Subnet": {
6
+ "Description": "ID of the Subnet the instance should be launched in, this will link the instance to the same VPC.",
7
+ "Type": "List<AWS::EC2::Subnet::Id>"
8
+ }
9
+ },
10
+ "Resources": {
11
+ "EIP1": {
12
+ "Type": "AWS::EC2::EIP",
13
+ "Properties": {
14
+ "Domain": "vpc"
15
+ }
16
+ },
17
+ "EIP2": {
18
+ "Type": "AWS::EC2::EIP",
19
+ "Properties": {
20
+ "Domain": "vpc"
21
+ }
22
+ },
23
+ "Association1": {
24
+ "Type": "AWS::EC2::EIPAssociation",
25
+ "DependsOn": [
26
+ "ENI",
27
+ "EIP1"
28
+ ],
29
+ "Properties": {
30
+ "AllocationId": {
31
+ "Fn::GetAtt": [
32
+ "EIP1",
33
+ "AllocationId"
34
+ ]
35
+ },
36
+ "NetworkInterfaceId": {
37
+ "Ref": "ENI"
38
+ },
39
+ "PrivateIpAddress": {
40
+ "Fn::Select": [
41
+ "0",
42
+ {
43
+ "Fn::GetAtt": [
44
+ "ENI",
45
+ "SecondaryPrivateIpAddresses"
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ },
52
+ "Association2": {
53
+ "Type": "AWS::EC2::EIPAssociation",
54
+ "DependsOn": [
55
+ "ENI",
56
+ "EIP2"
57
+ ],
58
+ "Properties": {
59
+ "AllocationId": {
60
+ "Fn::GetAtt": [
61
+ "EIP2",
62
+ "AllocationId"
63
+ ]
64
+ },
65
+ "NetworkInterfaceId": {
66
+ "Ref": "ENI"
67
+ },
68
+ "PrivateIpAddress": {
69
+ "Fn::Select": [
70
+ "1",
71
+ {
72
+ "Fn::GetAtt": [
73
+ "ENI",
74
+ "SecondaryPrivateIpAddresses"
75
+ ]
76
+ }
77
+ ]
78
+ }
79
+ }
80
+ },
81
+ "ENI": {
82
+ "Type": "AWS::EC2::NetworkInterface",
83
+ "Properties": {
84
+ "SecondaryPrivateIpAddressCount": 2,
85
+ "SourceDestCheck": true,
86
+ "SubnetId": {
87
+ "Fn::Select": [
88
+ "0",
89
+ {
90
+ "Ref": "Subnet"
91
+ }
92
+ ]
93
+ }
94
+ }
95
+ }
96
+ }
97
+ }
human_reference_dataset/aws-cloudformation-templates/EC2/SingleENIwithMultipleEIPs.yaml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: Template Creates a single EC2 instance with a single ENI which has multiple private and public IPs
4
+
5
+ Parameters:
6
+ Subnet:
7
+ Description: ID of the Subnet the instance should be launched in, this will link the instance to the same VPC.
8
+ Type: List<AWS::EC2::Subnet::Id>
9
+
10
+ Resources:
11
+ EIP1:
12
+ Type: AWS::EC2::EIP
13
+ Properties:
14
+ Domain: vpc
15
+
16
+ EIP2:
17
+ Type: AWS::EC2::EIP
18
+ Properties:
19
+ Domain: vpc
20
+
21
+ Association1:
22
+ Type: AWS::EC2::EIPAssociation
23
+ DependsOn:
24
+ - ENI
25
+ - EIP1
26
+ Properties:
27
+ AllocationId: !GetAtt EIP1.AllocationId
28
+ NetworkInterfaceId: !Ref ENI
29
+ PrivateIpAddress: !Select
30
+ - "0"
31
+ - !GetAtt ENI.SecondaryPrivateIpAddresses
32
+
33
+ Association2:
34
+ Type: AWS::EC2::EIPAssociation
35
+ DependsOn:
36
+ - ENI
37
+ - EIP2
38
+ Properties:
39
+ AllocationId: !GetAtt EIP2.AllocationId
40
+ NetworkInterfaceId: !Ref ENI
41
+ PrivateIpAddress: !Select
42
+ - "1"
43
+ - !GetAtt ENI.SecondaryPrivateIpAddresses
44
+
45
+ ENI:
46
+ Type: AWS::EC2::NetworkInterface
47
+ Properties:
48
+ SecondaryPrivateIpAddressCount: 2
49
+ SourceDestCheck: true
50
+ SubnetId: !Select
51
+ - "0"
52
+ - !Ref Subnet
human_reference_dataset/aws-cloudformation-templates/EC2/ec2_with_waitcondition_template.json ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "Create a variable number of EC2 instance resources.",
4
+ "Parameters": {
5
+ "KeyName": {
6
+ "Description": "Name of an existing EC2 KeyPair to enable SSH access to the instance",
7
+ "Type": "AWS::EC2::KeyPair::KeyName",
8
+ "Default": "slinger_testing",
9
+ "ConstraintDescription": "must be the name of an existing EC2 KeyPair."
10
+ },
11
+ "InstanceName": {
12
+ "Description": "Name of EC2 instance",
13
+ "Type": "String",
14
+ "ConstraintDescription": "must be a valid EC2 instance string name."
15
+ },
16
+ "InstanceType": {
17
+ "Description": "Basic EC2 instance type",
18
+ "Type": "String",
19
+ "AllowedValues": [
20
+ "t1.micro",
21
+ "t2.nano",
22
+ "t2.micro",
23
+ "t2.small",
24
+ "t2.medium",
25
+ "t2.large",
26
+ "m1.small",
27
+ "m1.medium",
28
+ "m1.large",
29
+ "m1.xlarge",
30
+ "m2.xlarge",
31
+ "m2.2xlarge",
32
+ "m2.4xlarge",
33
+ "m3.medium",
34
+ "m3.large",
35
+ "m3.xlarge",
36
+ "m3.2xlarge",
37
+ "m4.large",
38
+ "m4.xlarge",
39
+ "m4.2xlarge",
40
+ "m4.4xlarge",
41
+ "m4.10xlarge",
42
+ "c1.medium",
43
+ "c1.xlarge",
44
+ "c3.large",
45
+ "c3.xlarge",
46
+ "c3.2xlarge",
47
+ "c3.4xlarge",
48
+ "c3.8xlarge",
49
+ "c4.large",
50
+ "c4.xlarge",
51
+ "c4.2xlarge",
52
+ "c4.4xlarge",
53
+ "c4.8xlarge",
54
+ "g2.2xlarge",
55
+ "g2.8xlarge",
56
+ "r3.large",
57
+ "r3.xlarge",
58
+ "r3.2xlarge",
59
+ "r3.4xlarge",
60
+ "r3.8xlarge",
61
+ "i2.xlarge",
62
+ "i2.2xlarge",
63
+ "i2.4xlarge",
64
+ "i2.8xlarge",
65
+ "d2.xlarge",
66
+ "d2.2xlarge",
67
+ "d2.4xlarge",
68
+ "d2.8xlarge",
69
+ "hs1.8xlarge",
70
+ "cr1.8xlarge",
71
+ "cc2.8xlarge"
72
+ ],
73
+ "Default": "c4.2xlarge",
74
+ "ConstraintDescription": "must be a valid EC2 instance type."
75
+ },
76
+ "ImageId": {
77
+ "Description": "Basic instance ami",
78
+ "Type": "AWS::EC2::Image::Id"
79
+ },
80
+ "VpcId": {
81
+ "Description": "VpcId of your existing Virtual Private Cloud (VPC)",
82
+ "Type": "String"
83
+ },
84
+ "SubnetId": {
85
+ "Description": "SubnetId of an existing subnet in your Virtual Private Cloud (VPC)",
86
+ "Type": "String"
87
+ },
88
+ "SSHLocation": {
89
+ "Description": " The IP address range that can be used to SSH to the EC2 instances",
90
+ "Type": "String",
91
+ "Default": "0.0.0.0/0",
92
+ "MinLength": "9",
93
+ "MaxLength": "18",
94
+ "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
95
+ "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
96
+ },
97
+ "BudgetCode": {
98
+ "Description": " Budget code to save money",
99
+ "Type": "String",
100
+ "Default": "A019517",
101
+ "ConstraintDescription": "must be a valid budget code."
102
+ },
103
+ "LaunchPlatform": {
104
+ "Description": " Mark current platform",
105
+ "Type": "String",
106
+ "Default": "bitstorm_dev",
107
+ "ConstraintDescription": "must be a valid platform like bitstorm_qc bitstorm_dev bitstorm_staggin bitstorm_live."
108
+ },
109
+ "LaunchUser": {
110
+ "Description": " Mark current tester",
111
+ "Type": "String",
112
+ "Default": "null",
113
+ "ConstraintDescription": "must be a valid and existing tester."
114
+ },
115
+ "TestID": {
116
+ "Description": " Mark current testcase",
117
+ "Type": "String",
118
+ "ConstraintDescription": "must be a valid and existing testcase id."
119
+ },
120
+ "TestTarget": {
121
+ "Description": " Mark current test target",
122
+ "Type": "String",
123
+ "ConstraintDescription": "must be a valid and existing test target name."
124
+ },
125
+ "AgentID": {
126
+ "Description": " Mark current agent",
127
+ "Type": "String"
128
+ },
129
+ "IsMaster": {
130
+ "Description": "Mark master agent",
131
+ "Type": "String",
132
+ "Default": "False"
133
+ },
134
+ "MasterID": {
135
+ "Description": "Mark master ID",
136
+ "Type": "String",
137
+ "Default": "null"
138
+ }
139
+ },
140
+ "Mappings": {},
141
+ "Resources": {
142
+ "KWOSInstance": {
143
+ "Type": "AWS::EC2::Instance",
144
+ "Metadata": {
145
+ "AWS::CloudFormation::Init": {}
146
+ },
147
+ "Properties": {
148
+ "ImageId": {
149
+ "Ref": "ImageId"
150
+ },
151
+ "InstanceType": {
152
+ "Ref": "InstanceType"
153
+ },
154
+ "SubnetId": {
155
+ "Ref": "SubnetId"
156
+ },
157
+ "SecurityGroupIds": [
158
+ {
159
+ "Ref": "KWOSSecurityGroup"
160
+ }
161
+ ],
162
+ "KeyName": {
163
+ "Ref": "KeyName"
164
+ },
165
+ "Tags": [
166
+ {
167
+ "Key": "LaunchPlatform",
168
+ "Value": {
169
+ "Ref": "LaunchPlatform"
170
+ }
171
+ },
172
+ {
173
+ "Key": "LaunchUser",
174
+ "Value": {
175
+ "Ref": "LaunchUser"
176
+ }
177
+ },
178
+ {
179
+ "Key": "TestID",
180
+ "Value": {
181
+ "Ref": "TestID"
182
+ }
183
+ },
184
+ {
185
+ "Key": "Name",
186
+ "Value": {
187
+ "Ref": "InstanceName"
188
+ }
189
+ },
190
+ {
191
+ "Key": "BudgetCode",
192
+ "Value": {
193
+ "Ref": "BudgetCode"
194
+ }
195
+ },
196
+ {
197
+ "Key": "TestTarget",
198
+ "Value": {
199
+ "Ref": "TestTarget"
200
+ }
201
+ },
202
+ {
203
+ "Key": "AgentID",
204
+ "Value": {
205
+ "Ref": "AgentID"
206
+ }
207
+ },
208
+ {
209
+ "Key": "IsMaster",
210
+ "Value": {
211
+ "Ref": "IsMaster"
212
+ }
213
+ },
214
+ {
215
+ "Key": "MasterID",
216
+ "Value": {
217
+ "Ref": "MasterID"
218
+ }
219
+ }
220
+ ],
221
+ "Monitoring": false,
222
+ "UserData": {
223
+ "Fn::Base64": {
224
+ "Fn::Join": [
225
+ "",
226
+ [
227
+ "#!/bin/bash\n",
228
+ "apt-get -y install python-pip\n",
229
+ "pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz\n",
230
+ "# Helper function\n",
231
+ "function error_exit\n",
232
+ "{\n",
233
+ " /usr/local/bin/cfn-signal -e 1 -r \"$1\" '",
234
+ {
235
+ "Ref": "KWOSWaitHandle"
236
+ },
237
+ "'\n",
238
+ " exit 1\n",
239
+ "}\n",
240
+ "# Install the basic system configuration\n",
241
+ "/usr/local/bin/cfn-init -s ",
242
+ {
243
+ "Ref": "AWS::StackId"
244
+ },
245
+ " -r KWOSInstance ",
246
+ " --region ",
247
+ {
248
+ "Ref": "AWS::Region"
249
+ },
250
+ " || error_exit 'Failed to run cfn-init'\n",
251
+ "# All done so signal success\n",
252
+ "/usr/local/bin/cfn-signal -e 0 -r \"KWOS setup complete\" '",
253
+ {
254
+ "Ref": "KWOSWaitHandle"
255
+ },
256
+ "'\n"
257
+ ]
258
+ ]
259
+ }
260
+ }
261
+ }
262
+ },
263
+ "KWOSWaitHandle": {
264
+ "Type": "AWS::CloudFormation::WaitConditionHandle"
265
+ },
266
+ "KWOSWaitCondition": {
267
+ "Type": "AWS::CloudFormation::WaitCondition",
268
+ "Properties": {
269
+ "Handle": {
270
+ "Ref": "KWOSWaitHandle"
271
+ },
272
+ "Timeout": "300"
273
+ }
274
+ },
275
+ "KWOSSecurityGroup": {
276
+ "Type": "AWS::EC2::SecurityGroup",
277
+ "Properties": {
278
+ "VpcId": {
279
+ "Ref": "VpcId"
280
+ },
281
+ "GroupDescription": "Enable HTTP access via port 80/22/443 and ICMP access via port *",
282
+ "SecurityGroupIngress": [
283
+ {
284
+ "IpProtocol": "tcp",
285
+ "FromPort": "80",
286
+ "ToPort": "80",
287
+ "CidrIp": "0.0.0.0/0"
288
+ },
289
+ {
290
+ "IpProtocol": "tcp",
291
+ "FromPort": "8888",
292
+ "ToPort": "8888",
293
+ "CidrIp": "0.0.0.0/0"
294
+ },
295
+ {
296
+ "IpProtocol": "tcp",
297
+ "FromPort": "443",
298
+ "ToPort": "443",
299
+ "CidrIp": "0.0.0.0/0"
300
+ },
301
+ {
302
+ "IpProtocol": "icmp",
303
+ "FromPort": "-1",
304
+ "ToPort": "-1",
305
+ "CidrIp": "0.0.0.0/0"
306
+ },
307
+ {
308
+ "IpProtocol": "tcp",
309
+ "FromPort": "22",
310
+ "ToPort": "22",
311
+ "CidrIp": {
312
+ "Ref": "SSHLocation"
313
+ }
314
+ }
315
+ ]
316
+ }
317
+ }
318
+ },
319
+ "Outputs": {
320
+ "WebsiteURL": {
321
+ "Description": "URL for newly created KWOS deploy stack",
322
+ "Value": {
323
+ "Fn::Join": [
324
+ "",
325
+ [
326
+ "http://",
327
+ {
328
+ "Fn::GetAtt": [
329
+ "KWOSInstance",
330
+ "PublicDnsName"
331
+ ]
332
+ }
333
+ ]
334
+ ]
335
+ }
336
+ },
337
+ "InstanceId": {
338
+ "Description": "Instance Id of newly created instance",
339
+ "Value": {
340
+ "Ref": "KWOSInstance"
341
+ }
342
+ }
343
+ }
344
+ }
human_reference_dataset/aws-cloudformation-templates/EC2/ec2_with_waitcondition_template.yaml ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: Create a variable number of EC2 instance resources.
4
+
5
+ Parameters:
6
+ KeyName:
7
+ Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
8
+ Type: AWS::EC2::KeyPair::KeyName
9
+ Default: slinger_testing
10
+ ConstraintDescription: must be the name of an existing EC2 KeyPair.
11
+
12
+ InstanceName:
13
+ Description: Name of EC2 instance
14
+ Type: String
15
+ ConstraintDescription: must be a valid EC2 instance string name.
16
+
17
+ InstanceType:
18
+ Description: Basic EC2 instance type
19
+ Type: String
20
+ AllowedValues:
21
+ - t1.micro
22
+ - t2.nano
23
+ - t2.micro
24
+ - t2.small
25
+ - t2.medium
26
+ - t2.large
27
+ - m1.small
28
+ - m1.medium
29
+ - m1.large
30
+ - m1.xlarge
31
+ - m2.xlarge
32
+ - m2.2xlarge
33
+ - m2.4xlarge
34
+ - m3.medium
35
+ - m3.large
36
+ - m3.xlarge
37
+ - m3.2xlarge
38
+ - m4.large
39
+ - m4.xlarge
40
+ - m4.2xlarge
41
+ - m4.4xlarge
42
+ - m4.10xlarge
43
+ - c1.medium
44
+ - c1.xlarge
45
+ - c3.large
46
+ - c3.xlarge
47
+ - c3.2xlarge
48
+ - c3.4xlarge
49
+ - c3.8xlarge
50
+ - c4.large
51
+ - c4.xlarge
52
+ - c4.2xlarge
53
+ - c4.4xlarge
54
+ - c4.8xlarge
55
+ - g2.2xlarge
56
+ - g2.8xlarge
57
+ - r3.large
58
+ - r3.xlarge
59
+ - r3.2xlarge
60
+ - r3.4xlarge
61
+ - r3.8xlarge
62
+ - i2.xlarge
63
+ - i2.2xlarge
64
+ - i2.4xlarge
65
+ - i2.8xlarge
66
+ - d2.xlarge
67
+ - d2.2xlarge
68
+ - d2.4xlarge
69
+ - d2.8xlarge
70
+ - hs1.8xlarge
71
+ - cr1.8xlarge
72
+ - cc2.8xlarge
73
+ Default: c4.2xlarge
74
+ ConstraintDescription: must be a valid EC2 instance type.
75
+
76
+ ImageId:
77
+ Description: Basic instance ami
78
+ Type: AWS::EC2::Image::Id
79
+
80
+ VpcId:
81
+ Description: VpcId of your existing Virtual Private Cloud (VPC)
82
+ Type: String
83
+
84
+ SubnetId:
85
+ Description: SubnetId of an existing subnet in your Virtual Private Cloud (VPC)
86
+ Type: String
87
+
88
+ SSHLocation:
89
+ Description: ' The IP address range that can be used to SSH to the EC2 instances'
90
+ Type: String
91
+ Default: 0.0.0.0/0
92
+ MinLength: "9"
93
+ MaxLength: "18"
94
+ AllowedPattern: (\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})
95
+ ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
96
+
97
+ BudgetCode:
98
+ Description: ' Budget code to save money'
99
+ Type: String
100
+ Default: A019517
101
+ ConstraintDescription: must be a valid budget code.
102
+
103
+ LaunchPlatform:
104
+ Description: ' Mark current platform'
105
+ Type: String
106
+ Default: bitstorm_dev
107
+ ConstraintDescription: must be a valid platform like bitstorm_qc bitstorm_dev bitstorm_staggin bitstorm_live.
108
+
109
+ LaunchUser:
110
+ Description: ' Mark current tester'
111
+ Type: String
112
+ Default: "null"
113
+ ConstraintDescription: must be a valid and existing tester.
114
+
115
+ TestID:
116
+ Description: ' Mark current testcase'
117
+ Type: String
118
+ ConstraintDescription: must be a valid and existing testcase id.
119
+
120
+ TestTarget:
121
+ Description: ' Mark current test target'
122
+ Type: String
123
+ ConstraintDescription: must be a valid and existing test target name.
124
+
125
+ AgentID:
126
+ Description: ' Mark current agent'
127
+ Type: String
128
+
129
+ IsMaster:
130
+ Description: Mark master agent
131
+ Type: String
132
+ Default: "False"
133
+
134
+ MasterID:
135
+ Description: Mark master ID
136
+ Type: String
137
+ Default: "null"
138
+
139
+ Mappings: {}
140
+
141
+ Resources:
142
+ KWOSInstance:
143
+ Type: AWS::EC2::Instance
144
+ Metadata:
145
+ AWS::CloudFormation::Init: {}
146
+ Properties:
147
+ ImageId: !Ref ImageId
148
+ InstanceType: !Ref InstanceType
149
+ SubnetId: !Ref SubnetId
150
+ SecurityGroupIds:
151
+ - !Ref KWOSSecurityGroup
152
+ KeyName: !Ref KeyName
153
+ Tags:
154
+ - Key: LaunchPlatform
155
+ Value: !Ref LaunchPlatform
156
+ - Key: LaunchUser
157
+ Value: !Ref LaunchUser
158
+ - Key: TestID
159
+ Value: !Ref TestID
160
+ - Key: Name
161
+ Value: !Ref InstanceName
162
+ - Key: BudgetCode
163
+ Value: !Ref BudgetCode
164
+ - Key: TestTarget
165
+ Value: !Ref TestTarget
166
+ - Key: AgentID
167
+ Value: !Ref AgentID
168
+ - Key: IsMaster
169
+ Value: !Ref IsMaster
170
+ - Key: MasterID
171
+ Value: !Ref MasterID
172
+ Monitoring: false
173
+ UserData: !Base64
174
+ Fn::Join:
175
+ - ""
176
+ - - |
177
+ #!/bin/bash
178
+ - |
179
+ apt-get -y install python-pip
180
+ - |
181
+ pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
182
+ - |
183
+ # Helper function
184
+ - |
185
+ function error_exit
186
+ - |
187
+ {
188
+ - ' /usr/local/bin/cfn-signal -e 1 -r "$1" '''
189
+ - !Ref KWOSWaitHandle
190
+ - |
191
+ '
192
+ - |2
193
+ exit 1
194
+ - |
195
+ }
196
+ - |
197
+ # Install the basic system configuration
198
+ - '/usr/local/bin/cfn-init -s '
199
+ - !Ref AWS::StackId
200
+ - ' -r KWOSInstance '
201
+ - ' --region '
202
+ - !Ref AWS::Region
203
+ - |2
204
+ || error_exit 'Failed to run cfn-init'
205
+ - |
206
+ # All done so signal success
207
+ - /usr/local/bin/cfn-signal -e 0 -r "KWOS setup complete" '
208
+ - !Ref KWOSWaitHandle
209
+ - |
210
+ '
211
+
212
+ KWOSWaitHandle:
213
+ Type: AWS::CloudFormation::WaitConditionHandle
214
+
215
+ KWOSWaitCondition:
216
+ Type: AWS::CloudFormation::WaitCondition
217
+ Properties:
218
+ Handle: !Ref KWOSWaitHandle
219
+ Timeout: "300"
220
+
221
+ KWOSSecurityGroup:
222
+ Type: AWS::EC2::SecurityGroup
223
+ Properties:
224
+ VpcId: !Ref VpcId
225
+ GroupDescription: Enable HTTP access via port 80/22/443 and ICMP access via port *
226
+ SecurityGroupIngress:
227
+ - IpProtocol: tcp
228
+ FromPort: "80"
229
+ ToPort: "80"
230
+ CidrIp: 0.0.0.0/0
231
+ - IpProtocol: tcp
232
+ FromPort: "8888"
233
+ ToPort: "8888"
234
+ CidrIp: 0.0.0.0/0
235
+ - IpProtocol: tcp
236
+ FromPort: "443"
237
+ ToPort: "443"
238
+ CidrIp: 0.0.0.0/0
239
+ - IpProtocol: icmp
240
+ FromPort: "-1"
241
+ ToPort: "-1"
242
+ CidrIp: 0.0.0.0/0
243
+ - IpProtocol: tcp
244
+ FromPort: "22"
245
+ ToPort: "22"
246
+ CidrIp: !Ref SSHLocation
247
+
248
+ Outputs:
249
+ WebsiteURL:
250
+ Description: URL for newly created KWOS deploy stack
251
+ Value: !Join
252
+ - ""
253
+ - - http://
254
+ - !GetAtt KWOSInstance.PublicDnsName
255
+
256
+ InstanceId:
257
+ Description: Instance Id of newly created instance
258
+ Value: !Ref KWOSInstance