-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathtask-cpu.yml
70 lines (65 loc) · 1.97 KB
/
task-cpu.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
AWSTemplateFormatVersion: '2010-09-09'
Description: Deploy a task into an ECS cluster
Parameters:
EnvironmentName:
Type: String
Default: test
Description: The name of the environment to add this task to
TaskName:
Type: String
Default: tensorflow-cpu
Description: A name for the task
ImageUrl:
Type: String
Default: brentley/tensorflow-cpu:latest
Description: The url of a docker image
ContainerCpu:
Type: Number
Default: 1024
Description: How much CPU to give the container. 1024 is 1 CPU
ContainerMemory:
Type: Number
Default: 6144
Description: How much memory in megabytes to give the container
DesiredCount:
Type: Number
Default: 1
Description: How many copies of the task to run
Role:
Type: String
Default: ""
Conditions:
HasCustomRole: !Not [ !Equals [!Ref 'Role', ''] ]
Resources:
# A log group for storing the stdout logs from this task's containers
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub ${EnvironmentName}-task-${TaskName}
# A log group for the gpu container
GPULogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: !Sub ${EnvironmentName}-task-tensorflow-gpu
# The task definition. This is a simple metadata description of what
# container to run, and what resource requirements it has.
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Family: !Ref 'TaskName'
Cpu: !Ref 'ContainerCpu'
Memory: !Ref 'ContainerMemory'
TaskRoleArn:
Fn::If:
- 'HasCustomRole'
- !Ref 'Role'
- !Ref "AWS::NoValue"
ContainerDefinitions:
- Name: !Ref 'TaskName'
Image: !Ref 'ImageUrl'
LogConfiguration:
LogDriver: 'awslogs'
Options:
awslogs-group: !Sub ${EnvironmentName}-task-${TaskName}
awslogs-region: !Ref 'AWS::Region'
awslogs-stream-prefix: !Ref 'TaskName'