# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy of this # software and associated documentation files (the "Software"), to deal in the Software # without restriction, including without limitation the rights to use, copy, modify, # merge, publish, distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A # PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. AWSTemplateFormatVersion: 2010-09-09 Description: > Distributed load testing (DLT) using AWS Fargate. Creates a Fargate Cluster, a Task Definition, IAM Role and a CloudWatch Log Group Parameters: VpcId: Type: String DockerImage: Type: String TaskExecutionRoleArn: Type: String DockerTaskMemory: Type: Number Default: 2048 DockerTaskCpu: Type: Number Default: 512 Resources: Cluster: Type: AWS::ECS::Cluster FargateTaskSecurityGroup: Type: AWS::EC2::SecurityGroup Properties: GroupDescription: 'DLT Fargate tasks security group' VpcId: !Ref VpcId SecurityGroupEgress: IpProtocol: '-1' CidrIp: 0.0.0.0/0 FargateTaskCloudWatchLogGroup: Type: AWS::Logs::LogGroup Properties: RetentionInDays: 365 TaurusLogFilterAvgResponseTime: Type: AWS::Logs::MetricFilter Properties: FilterPattern: "[time, logType=INFO*, logTitle=Current*, numVu, vu, numSucc, succ, numFail, fail, avgRt, x]" LogGroupName: !Ref FargateTaskCloudWatchLogGroup MetricTransformations: - MetricValue: "$avgRt" MetricNamespace: "dlt-fargate/taurus" MetricName: "avgResponseTime" FargateTaskDefinition: Type: AWS::ECS::TaskDefinition Properties: Cpu: !Ref DockerTaskCpu ExecutionRoleArn: !Ref TaskExecutionRoleArn Memory: !Ref DockerTaskMemory NetworkMode: awsvpc RequiresCompatibilities: - FARGATE TaskRoleArn: !Ref TaskExecutionRoleArn ContainerDefinitions: - Name: "dlt-fargate-task" Essential: true Image: !Ref DockerImage Memory: !Ref DockerTaskMemory LogConfiguration: LogDriver: awslogs Options: awslogs-group: !Ref FargateTaskCloudWatchLogGroup awslogs-region: !Ref "AWS::Region" awslogs-stream-prefix: "dlt-fargate" Command: - "taurus.yml" Outputs: FargateClusterName: Value: !Ref Cluster TaskSecurityGroup: Value: !Ref FargateTaskSecurityGroup TaskDefinitionArn: Value: !Ref FargateTaskDefinition