1+ # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+ #
3+ # Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+ # software and associated documentation files (the "Software"), to deal in the Software
5+ # without restriction, including without limitation the rights to use, copy, modify,
6+ # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7+ # permit persons to whom the Software is furnished to do so.
8+ #
9+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10+ # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11+ # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12+ # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14+ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+ AWSTemplateFormatVersion : 2010-09-09
16+ Description : Distributed load testing (DLT) using AWS Fargate
17+
18+ Parameters :
19+ FargateClusterName :
20+ Type : String
21+ Default : " dlt-fargate"
22+ DockerImage :
23+ Type : String
24+ DockerTaskMemory :
25+ Type : Number
26+ Default : 2048
27+ AllowedValues :
28+ - 512
29+ - 1024
30+ - 2048
31+ - 3072
32+ - 4096
33+ - 5120
34+ - 6144
35+ - 7168
36+ - 8192
37+ - 16384
38+ DockerTaskCpu :
39+ Type : Number
40+ Default : 512
41+ AllowedValues :
42+ - 256
43+ - 512
44+ - 1024
45+ - 2048
46+ - 4096
47+ Vpc :
48+ Type : AWS::EC2::VPC::Id
49+ Description : VPC where the Fargate cluster will be placed
50+ SubnetA :
51+ Type : AWS::EC2::Subnet::Id
52+ Description : Subnet A of the VPC
53+ SubnetB :
54+ Type : AWS::EC2::Subnet::Id
55+ Description : Subnet B of the VPC
56+ SubnetC :
57+ Type : AWS::EC2::Subnet::Id
58+ Description : Subnet C of the VPC
59+
60+ Metadata :
61+ AWS::CloudFormation::Interface :
62+ ParameterGroups :
63+ -
64+ Label :
65+ default : " Network Configuration"
66+ Parameters :
67+ - Vpc
68+ - SubnetA
69+ - SubnetB
70+ - SubnetC
71+ -
72+ Label :
73+ default : " Fargate and Docker Configuration"
74+ Parameters :
75+ - FargateClusterName
76+ - DockerImage
77+ - DockerTaskMemory
78+ - DockerTaskCpu
79+
80+ Outputs :
81+ SubnetA :
82+ Value : !Ref SubnetA
83+ SubnetB :
84+ Value : !Ref SubnetB
85+ SubnetC :
86+ Value : !Ref SubnetC
87+ FargateClusterName :
88+ Value : !Ref FargateCluster
89+ TaskSecurityGroup :
90+ Value : !Ref FargateTaskSecurityGroup
91+ TaskDefinitionArn :
92+ Value : !Ref FargateTaskDefinition
93+ TaskIAMRole :
94+ Value : !Ref FargateTaskExecutionRole
95+
96+ Resources :
97+ FargateTaskSecurityGroup :
98+ Type : AWS::EC2::SecurityGroup
99+ Properties :
100+ GroupDescription : ' DLT Fargate tasks security group'
101+ VpcId : !Ref Vpc
102+ SecurityGroupEgress :
103+ IpProtocol : ' -1'
104+ CidrIp : 0.0.0.0/0
105+
106+ FargateCluster :
107+ Type : AWS::ECS::Cluster
108+ Properties :
109+ ClusterName : !Ref FargateClusterName
110+
111+ FargateTaskExecutionRole :
112+ Type : AWS::IAM::Role
113+ Properties :
114+ AssumeRolePolicyDocument :
115+ Version : " 2012-10-17"
116+ Statement :
117+ -
118+ Effect : Allow
119+ Action : " sts:AssumeRole"
120+ Principal :
121+ Service : " ecs-tasks.amazonaws.com"
122+ ManagedPolicyArns :
123+ - " arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"
124+
125+ FargateTaskCloudWatchLogGroup :
126+ Type : AWS::Logs::LogGroup
127+ Properties :
128+ RetentionInDays : 365
129+
130+ TaurusLogFilterAvgResponseTime :
131+ Type : AWS::Logs::MetricFilter
132+ Properties :
133+ FilterPattern : " [time, logType=INFO*, logTitle=Current*, numVu, vu, numSucc, succ, numFail, fail, avgRt, x]"
134+ LogGroupName : !Ref FargateTaskCloudWatchLogGroup
135+ MetricTransformations :
136+ -
137+ MetricValue : " $avgRt"
138+ MetricNamespace : " dlt-fargate/taurus"
139+ MetricName : " avgResponseTime"
140+
141+ FargateTaskDefinition :
142+ Type : AWS::ECS::TaskDefinition
143+ Properties :
144+ Cpu : !Ref DockerTaskCpu
145+ ExecutionRoleArn : !GetAtt FargateTaskExecutionRole.Arn
146+ Family : ' dlt-fargate-task'
147+ Memory : !Ref DockerTaskMemory
148+ NetworkMode : awsvpc
149+ RequiresCompatibilities :
150+ - FARGATE
151+ TaskRoleArn : !GetAtt FargateTaskExecutionRole.Arn
152+ ContainerDefinitions :
153+ -
154+ Name : " dlt-fargate-task"
155+ Essential : true
156+ Image : !Ref DockerImage
157+ Memory : !Ref DockerTaskMemory
158+ LogConfiguration :
159+ LogDriver : awslogs
160+ Options :
161+ awslogs-group : !Ref FargateTaskCloudWatchLogGroup
162+ awslogs-region : !Ref "AWS::Region"
163+ awslogs-stream-prefix : " dlt-fargate"
164+ Command :
165+ - " taurus.yml"
0 commit comments