-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.yml
More file actions
180 lines (160 loc) · 4.55 KB
/
main.yml
File metadata and controls
180 lines (160 loc) · 4.55 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
AWSTemplateFormatVersion: 2010-09-09
Description: Valohai Private Workers resources
Parameters:
KeyPair:
Type: AWS::EC2::KeyPair::KeyName
Description: KeyPair that will be used for Valohai instances. You'll need to create this under EC2 -> KeyPairs before you can continue.
QueueAddress:
Type: String
Description: Address of the Valohai queue that will be setup.
Suffix:
Type: String
Description: Unique suffix used with some of the resources, you can for example use the stack name.
ValohaiMasterRoleARN:
Type: String
Description: Name of the Valohai Master Role used for autoscaling resources.
VpcId:
Type: String
Description: OPTIONAL. Provide an existing VPC ID to use with Valohai resources. Leave empty if you want to create a new VPC.
Default: ""
Subnet:
Type: String
Description: OPTIONAL. Provide the Subnet ID that should be used for the Valohai Queue instance, if you're using an existing VPC. Leave empty if you want the template to create a new VPC and Subnet.
Default: ""
Conditions:
CreateVPC: !Equals
- !Ref VpcId
- ""
Mappings:
RegionMap:
af-south-1:
AZs: 3
ImageId: ami-08a4b40f2fe1e4b35
ap-east-1:
AZs: 3
ImageId: ami-0b215afe809665ae5
ap-northeast-1:
AZs: 3
ImageId: ami-0df99b3a8349462c6
ap-northeast-2:
AZs: 4
ImageId: ami-04876f29fd3a5e8ba
ap-northeast-3:
AZs: 3
ImageId: ami-0001d1dd884af8872
ap-south-1:
AZs: 3
ImageId: ami-0c1a7f89451184c8b
ap-southeast-1:
AZs: 3
ImageId: ami-0d058fe428540cd89
ap-southeast-2:
AZs: 3
ImageId: ami-0567f647e75c7bc05
ca-central-1:
AZs: 3
ImageId: ami-0801628222e2e96d6
eu-central-1:
AZs: 3
ImageId: ami-05f7491af5eef733a
eu-south-1:
AZs: 3
ImageId: ami-018f430e4f5375e69
eu-west-1:
AZs: 3
ImageId: ami-0a8e758f5e873d1c1
eu-west-2:
AZs: 3
ImageId: ami-0194c3e07668a7e36
eu-west-3:
AZs: 3
ImageId: ami-0f7cd40eac2214b37
eu-north-1:
AZs: 3
ImageId: ami-0ff338189efb7ed37
me-south-1:
AZs: 3
ImageId: ami-0eddb8cfbd6a5f657
sa-east-1:
AZs: 3
ImageId: ami-054a31f1b3bf90920
us-east-1:
AZs: 6
ImageId: ami-09e67e426f25ce0d7
us-east-2:
AZs: 3
ImageId: ami-00399ec92321828f5
us-west-1:
AZs: 2
ImageId: ami-0d382e80be7ffdae5
us-west-2:
AZs: 4
ImageId: ami-03d5c68bab01f3496
Resources:
Network:
Type: AWS::CloudFormation::Stack
Condition: CreateVPC
DeletionPolicy: Delete
Properties:
Parameters:
AZs: !FindInMap [ RegionMap, !Ref "AWS::Region", AZs ]
Tags:
- Key: valohai
Value: "1"
TemplateURL: ./network.yml
S3Bucket:
Type: AWS::CloudFormation::Stack
DeletionPolicy: Retain
Properties:
Parameters:
Suffix: !Ref Suffix
ValohaiMasterRoleARN: !Ref ValohaiMasterRoleARN
Tags:
- Key: valohai
Value: "1"
TemplateURL: ./s3bucket.yml
WorkerSecurityGroup:
Type: AWS::CloudFormation::Stack
Properties:
Parameters:
VPC: !If [CreateVPC, !GetAtt Network.Outputs.VPC, !Ref VpcId]
Tags:
- Key: valohai
Value: "1"
TemplateURL: ./worker-security-group.yml
WorkerQueue:
Type: AWS::CloudFormation::Stack
DeletionPolicy: Delete
Properties:
Parameters:
ImageId: !FindInMap [ RegionMap, !Ref "AWS::Region", ImageId ]
KeyPair: !Ref KeyPair
QueueAddress: !Ref QueueAddress
Subnet: !If [CreateVPC, !GetAtt Network.Outputs.Subnet1, !Ref Subnet]
VPC: !If [CreateVPC, !GetAtt Network.Outputs.VPC, !Ref VpcId]
WorkersSecurityGroup: !GetAtt WorkerSecurityGroup.Outputs.SecurityGroup
Tags:
- Key: valohai
Value: "1"
TemplateURL: ./worker-queue.yml
Outputs:
KeyPair:
Value: !Ref KeyPair
Description: Key pair name
PrivateIp:
Value: !GetAtt WorkerQueue.Outputs.PrivateIp
Description: Worker Queue instance private IP address
PublicIp:
Value: !GetAtt WorkerQueue.Outputs.PublicIp
Description: Worker Queue instance public IP address
Region:
Value: !Ref AWS::Region
ValohaiMasterRole:
Value: !Ref ValohaiMasterRoleARN
Description: ValohaiMasterRole ARN
WorkerSecurityGroup:
Value: !GetAtt WorkerSecurityGroup.Outputs.SecurityGroup
Description: Valohai Security Group ID
VPC:
Value: !If [CreateVPC, !GetAtt Network.Outputs.VPC, !Ref VpcId]
Description: VPC ID