-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.yaml
More file actions
47 lines (42 loc) · 906 Bytes
/
sample.yaml
File metadata and controls
47 lines (42 loc) · 906 Bytes
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
AWSTemplateFormatVersion:
'2010-09-09'
Description: EC2
Parameters:
InstanceType:
Type: String
Default: t2.micro
AllowedValues:
- t2.micro
- t2.small
- t2.medium
Mappings:
RegionMap:
us-east-1:
AMI: ami-0453ec754f44f9a4a
us-west-1:
AMI: ami-0583d8c7a9c35822c
Resources:
MySecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: all sg
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
MyEC2Instance:
Type: AWS::EC2::Instance
Properties:
InstanceType: !Ref InstanceType
SecurityGroups:
- !Ref MySecurityGroup
ImageId: !FindInMap
- RegionMap
- !Ref "AWS::Region"
- AMI
Outputs:
InstanceId:
Value: !Ref MyEC2Instance
PublicIp:
Value: !GetAtt MyEC2Instance.PublicIp