# 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: > Master Template for Distributed Load Test Using AWS Fargate. It deploys an ECR Repository, a Fargate Cluster, a VPC, a CloudWatch Log Group and an IAM Execution Role. Parameters: GitRepositoryName: Type: String Default: "distributed-load-testing-using-aws-fargate" Resources: DockerRegistry: Type: AWS::ECR::Repository CloudWatchDashboard: Type: AWS::CloudWatch::Dashboard Properties: DashboardBody: !Sub '{"widgets":[{"type":"metric","x":0,"y":0,"width":8,"height":8,"properties":{"metrics":[["dlt-fargate/taurus","avgResponseTime"]],"view":"timeSeries","stacked":true,"region":"${AWS::Region}","stat":"Average"}}]}' TaskExecutionRole: Type: AWS::IAM::Role Properties: AssumeRolePolicyDocument: Version: "2012-10-17" Statement: - Effect: Allow Action: "sts:AssumeRole" Principal: Service: "ecs-tasks.amazonaws.com" ManagedPolicyArns: - "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" Vpc: Type: AWS::CloudFormation::Stack Properties: TemplateURL: "https://s3.amazonaws.com/distributed-load-testing-using-aws-fargate/templates/fargate-vpc.yaml" FargateCluster: Type: AWS::CloudFormation::Stack DependsOn: Vpc Properties: TemplateURL: "https://s3.amazonaws.com/distributed-load-testing-using-aws-fargate/templates/fargate-cluster.yaml" Parameters: VpcId: !GetAtt Vpc.Outputs.VpcId TaskExecutionRoleArn: !GetAtt TaskExecutionRole.Arn DockerImage: !Join - '' - - !Ref 'AWS::AccountId' - '.dkr.ecr.' - !Ref 'AWS::Region' - '.amazonaws.com/' - !Ref DockerRegistry - ':latest' Pipeline: Type: AWS::CloudFormation::Stack DependsOn: Vpc Properties: TemplateURL: "https://s3.amazonaws.com/distributed-load-testing-using-aws-fargate/templates/pipeline.yaml" Parameters: DockerRegistryArn: !GetAtt DockerRegistry.Arn MasterStackId: !Ref 'AWS::StackName' GitRepositoryName: !Ref GitRepositoryName DockerRegistryURL: !Join - '' - - !Ref 'AWS::AccountId' - '.dkr.ecr.' - !Ref 'AWS::Region' - '.amazonaws.com/' - !Ref DockerRegistry Outputs: GitRepoHttpUrl: Value: !GetAtt Pipeline.Outputs.GitRepoHttpUrl DockerRegistryName: Value: !Ref DockerRegistry DockerRegistryURL: Value: !Join - '' - - !Ref 'AWS::AccountId' - '.dkr.ecr.' - !Ref 'AWS::Region' - '.amazonaws.com/' - !Ref DockerRegistry TaskExecutionRoleArn: Value: !GetAtt TaskExecutionRole.Arn FargateClusterName: Value: !GetAtt FargateCluster.Outputs.FargateClusterName TaskSecurityGroup: Value: !GetAtt FargateCluster.Outputs.TaskSecurityGroup TaskDefinitionArn: Value: !GetAtt FargateCluster.Outputs.TaskDefinitionArn VpcId: Value: !GetAtt Vpc.Outputs.VpcId SubnetA: Value: !GetAtt Vpc.Outputs.SubnetA SubnetB: Value: !GetAtt Vpc.Outputs.SubnetB SubnetC: Value: !GetAtt Vpc.Outputs.SubnetC