forked from saha-rajdeep/cloudformation-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
crossstack-output-receiver-ec2.yml
140 lines (140 loc) · 3.88 KB
/
crossstack-output-receiver-ec2.yml
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
AWSTemplateFormatVersion: 2010-09-09
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.
Parameters:
KeyName:
Description: Name of an existing EC2 KeyPair to enable SSH access to the instance
Type: 'AWS::EC2::KeyPair::KeyName'
ConstraintDescription: must be the name of an existing EC2 KeyPair.
InstanceType:
Description: WebServer EC2 instance type
Type: String
Default: t2.micro
AllowedValues:
- t1.micro
- t2.nano
- t2.micro
- t2.small
ConstraintDescription: must be a valid EC2 instance type.
SecurityGroupStackName:
Description: Security Group Stack Name
Type: String
MinLength: '1'
MaxLength: '255'
Mappings:
AWSInstanceType2Arch:
t1.micro:
Arch: HVM64
t2.nano:
Arch: HVM64
t2.micro:
Arch: HVM64
t2.small:
Arch: HVM64
AWSInstanceType2NATArch:
t1.micro:
Arch: NATHVM64
t2.nano:
Arch: NATHVM64
t2.micro:
Arch: NATHVM64
t2.small:
Arch: NATHVM64
AWSRegionArch2AMI:
us-east-1:
HVM64: ami-0080e4c5bc078760e
HVMG2: ami-0aeb704d503081ea6
us-west-2:
HVM64: ami-01e24be29428c15b2
HVMG2: ami-0fe84a5b4563d8f27
us-west-1:
HVM64: ami-0ec6517f6edbf8044
HVMG2: ami-0a7fc72dc0e51aa77
eu-west-1:
HVM64: ami-08935252a36e25f85
HVMG2: ami-0d5299b1c6112c3c7
eu-west-2:
HVM64: ami-01419b804382064e4
HVMG2: NOT_SUPPORTED
eu-west-3:
HVM64: ami-0dd7e7ed60da8fb83
HVMG2: NOT_SUPPORTED
eu-central-1:
HVM64: ami-0cfbf4f6db41068ac
HVMG2: ami-0aa1822e3eb913a11
eu-north-1:
HVM64: ami-86fe70f8
HVMG2: ami-32d55b4c
ap-northeast-1:
HVM64: ami-00a5245b4816c38e6
HVMG2: ami-09d0e0e099ecabba2
ap-northeast-2:
HVM64: ami-00dc207f8ba6dc919
HVMG2: NOT_SUPPORTED
ap-northeast-3:
HVM64: ami-0b65f69a5c11f3522
HVMG2: NOT_SUPPORTED
ap-southeast-1:
HVM64: ami-05b3bcf7f311194b3
HVMG2: ami-0e46ce0d6a87dc979
ap-southeast-2:
HVM64: ami-02fd0b06f06d93dfc
HVMG2: ami-0c0ab057a101d8ff2
ap-south-1:
HVM64: ami-0ad42f4f66f6c1cc9
HVMG2: ami-0244c1d42815af84a
us-east-2:
HVM64: ami-0cd3dfa4e37921605
HVMG2: NOT_SUPPORTED
ca-central-1:
HVM64: ami-07423fb63ea0a0930
HVMG2: NOT_SUPPORTED
sa-east-1:
HVM64: ami-05145e0b28ad8e0b2
HVMG2: NOT_SUPPORTED
cn-north-1:
HVM64: ami-053617c9d818c1189
HVMG2: NOT_SUPPORTED
cn-northwest-1:
HVM64: ami-0f7937761741dc640
HVMG2: NOT_SUPPORTED
Resources:
EC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
InstanceType: !Ref InstanceType
SecurityGroupIds:
- !ImportValue
'Fn::Sub': '${SecurityGroupStackName}-SecurityGroupId'
KeyName: !Ref KeyName
ImageId: !FindInMap
- AWSRegionArch2AMI
- !Ref 'AWS::Region'
- !FindInMap
- AWSInstanceType2Arch
- !Ref InstanceType
- Arch
Outputs:
InstanceID:
Description: InstanceId of the newly created EC2 instance
Value: !Ref EC2Instance
AZ:
Description: Availability Zone of the newly created EC2 instance
Value: !GetAtt
- EC2Instance
- AvailabilityZone
PublicDNS:
Description: Public DNSName of the newly created EC2 instance
Value: !GetAtt
- EC2Instance
- PublicDnsName
PublicIP:
Description: Public IP address of the newly created EC2 instance
Value: !GetAtt
- EC2Instance
- PublicIp