-
Notifications
You must be signed in to change notification settings - Fork 227
/
fargate-task.json
86 lines (86 loc) · 3.12 KB
/
fargate-task.json
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
{
"Description": "Container Fargate Task Definition (fdp-1qj64b32n)",
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"ECRImageURI": {
"Type": "String",
"Description" : "URI for the container from Amazon Elastic Container Registry."
},
"ContainerDefinitionName": {
"Type": "String",
"Description" : "This will set the Task and Container Definition name in Fargate."
},
"ContainerPort": {
"Type":"Number",
"Description" : "port number exposed from the container image.",
"Default":80
},
"ContainerSize": {
"Type":"String",
"Description" : "Size of container for Fargate task.",
"Default":"Small",
"AllowedValues": ["Small","Medium","Large"]
}
},
"Mappings" : {
"MapContainerSize" : {
"Small" : {
"cpu" : "512" ,
"mem" : "1024"
},
"Medium" : {
"cpu" : "1024",
"mem" : "2048"
},
"Large" : {
"cpu" : "4096",
"mem" : "8192"
}
}
},
"Resources": {
"TaskLogGroup": {
"Type" : "AWS::Logs::LogGroup",
"Properties" : {
"LogGroupName" : {"Fn::Sub":"/ecs/${ContainerDefinitionName}"},
"RetentionInDays" : 30
}
},
"taskdefinition": {
"Type": "AWS::ECS::TaskDefinition",
"Properties" : {
"ExecutionRoleArn": {"Fn::ImportValue": "ECSTaskExecutionRole"},
"RequiresCompatibilities": [
"FARGATE"
],
"Memory": { "Fn::FindInMap" : [ "MapContainerSize", { "Ref" : "ContainerSize" }, "mem"]},
"Family": {"Ref":"ContainerDefinitionName"},
"NetworkMode": "awsvpc",
"Cpu": { "Fn::FindInMap" : [ "MapContainerSize", { "Ref" : "ContainerSize" }, "cpu"]},
"ContainerDefinitions" : [
{
"PortMappings": [
{ "ContainerPort": {"Ref": "ContainerPort"} }
],
"LogConfiguration": {
"LogDriver": "awslogs",
"Options": {
"awslogs-group": {"Ref":"TaskLogGroup"},
"awslogs-region": {"Ref":"AWS::Region"},
"awslogs-stream-prefix": "ecs"
}
},
"Environment": [
{
"Name": "AWS_REGION",
"Value": {"Ref":"AWS::Region"}
}
],
"Image": {"Ref":"ECRImageURI"},
"Name": {"Ref":"ContainerDefinitionName"}
}
]
}
}
}
}