/
batch_env_template_cfn.yml
104 lines (96 loc) · 3.08 KB
/
batch_env_template_cfn.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
AWSTemplateFormatVersion: 2010-09-09
Description: Setup Batch Compute Environment
Parameters:
RoleStackName:
Description: "Stack that deploys roles for genomic workflow"
Type: String
VPCStackName:
Description: "Stack that deploys vps for genomic workflow"
Type: String
ImageId:
Description: "Image ID for BatchGenomics AMI."
Type: String
Mappings:
RegionMap:
us-east-1:
AMI: ami-0be02032628f3507b
us-west-2:
AMI: ami-0151d1a9f263d8b04
Resources:
GenomicSpotEnv:
Type: AWS::Batch::ComputeEnvironment
Properties:
ServiceRole:
Fn::ImportValue: !Sub "${RoleStackName}:BatchServiceRole"
Type: MANAGED
State: ENABLED
ComputeResources:
SecurityGroupIds:
- Fn::ImportValue: !Sub "${VPCStackName}:SecurityGroup"
BidPercentage: 50
InstanceRole:
Fn::ImportValue: !Sub "${RoleStackName}:ECSInstanceProfile"
InstanceTypes:
- c5.18xlarge
ImageId: !Sub "${ImageId}"
MinvCpus: 0
DesiredvCpus: 0
MaxvCpus: 256
SpotIamFleetRole:
Fn::ImportValue: !Sub "${RoleStackName}:SpotFleetRole"
Subnets:
- Fn::ImportValue: !Sub "${VPCStackName}:SubnetA"
- Fn::ImportValue: !Sub "${VPCStackName}:SubnetB"
- Fn::ImportValue: !Sub "${VPCStackName}:SubnetC"
# Generate an instance name tag that is unique to this environment
# using the VPC ID for this stack in case we have this stack deployed
# multiple times in an account.
Tags:
Name: !Sub "GenomicSpot"
Type: SPOT
GenomicOnDemandEnv:
Type: AWS::Batch::ComputeEnvironment
Properties:
ServiceRole:
Fn::ImportValue: !Sub "${RoleStackName}:BatchServiceRole"
Type: MANAGED
State: ENABLED
ComputeResources:
SecurityGroupIds:
- Fn::ImportValue: !Sub "${VPCStackName}:SecurityGroup"
InstanceRole:
Fn::ImportValue: !Sub "${RoleStackName}:ECSInstanceProfile"
InstanceTypes:
- c5.18xlarge
ImageId: !Sub "${ImageId}"
MinvCpus: 0
DesiredvCpus: 0
MaxvCpus: 256
Subnets:
- Fn::ImportValue: !Sub "${VPCStackName}:SubnetA"
- Fn::ImportValue: !Sub "${VPCStackName}:SubnetB"
- Fn::ImportValue: !Sub "${VPCStackName}:SubnetC"
# Generate an instance name tag that is unique to this environment
# using the VPC ID for this stack in case we have this stack deployed
# multiple times in an account.
Tags:
Name: !Sub "GenomicOnDemand"
Type: EC2
HighPriorityQueue:
Type: AWS::Batch::JobQueue
Properties:
JobQueueName: "HighPriority"
Priority: 1000
State: ENABLED
ComputeEnvironmentOrder:
- Order: 1
ComputeEnvironment: !Ref GenomicOnDemandEnv
LowPriorityQueue:
Type: AWS::Batch::JobQueue
Properties:
JobQueueName: "LowPriority"
Priority: 1
State: ENABLED
ComputeEnvironmentOrder:
- Order: 1
ComputeEnvironment: !Ref GenomicSpotEnv