-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstances.yaml
82 lines (65 loc) · 2.27 KB
/
instances.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
Description: >
This template deploys high available ec2 instances to the provided VPC and subnets
Parameters:
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
InstanceType:
Description: Which instance type should we use to build the EC2 cluster?
Type: String
Default: m5.large
InstanceImage:
Description: Which Image type should use to build launch configs
Type: AWS::EC2::Image::Id
KeyPair:
Description: An Amazon EC2 key pair name
Type: AWS::EC2::KeyPair::KeyName
IamInstanceProfile:
Description: Instance Profile Name need to attach with ec2 instance
Type: String
Default: ""
VPC:
Description: Choose which VPC this EC2 cluster should be deployed to
Type: AWS::EC2::VPC::Id
Subnets:
Description: Choose which subnets this EC2 cluster should be deployed to
Type: List<AWS::EC2::Subnet::Id>
SecurityGroup:
Description: Select the Security Group to use for the EC2 cluster hosts
Type: List<AWS::EC2::SecurityGroup::Id>
FriendlyAppName:
Description: Give us a friendly name for each instance to indentyfy from each
Type: String
IsEIP:
Description : select true/false to assign an elstic ip
Default: false
Type: String
AllowedValues:
- true
- false
Conditions:
IamInstanceProfile: !Not [!Equals [!Ref IamInstanceProfile,""]]
IsEIP: !Equals [!Ref IsEIP,"true"]
Resources:
EC2Instance:
Type: AWS::EC2::Instance
Properties:
SubnetId: !Select [0,!Ref Subnets]
InstanceType: !Ref InstanceType
KeyName: !Ref KeyPair
ImageId: !Ref InstanceImage
SecurityGroupIds: !Ref SecurityGroup
# BlockDeviceMappings:
# - DeviceName: /dev/sda1
# Ebs:
# VolumeSize: 8
Tags:
- Key: Name
Value: !Sub ${FriendlyAppName}
EIP:
Type: AWS::EC2::EIP
DependsOn: EC2Instance
Condition: IsEIP
Properties:
InstanceId: !Ref EC2Instance
Domain: !Ref VPC