-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-test-with-fargate.yml
166 lines (166 loc) 路 4.16 KB
/
load-test-with-fargate.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
AWSTemplateFormatVersion: "2010-09-09"
Description: AWS CloudFormation template to create load testing resources
Parameters:
URL:
Type: String
Description: The URL to load test
DesiredTaskCount:
Type: Number
Description: Number of tasks to run for the load test
Default: 5
MinValue: 1
MaxValue: 20
Tries:
Type: Number
Description: Number of tries per load test
Default: 1000
Sleep:
Type: Number
Description: Time in seconds to sleep between tries
Default: 0.1
MasterRegion:
Type: string
Description: When using Stacksets, the region to deliver all the logs to
Default:
Ref: "AWS::Region"
Resources:
LoadTesterLogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: /ecs/color-info-taskdef
RetentionInDays: 365
LoadTesterTaskDefinition:
Type: AWS::ECS::TaskDefinition
DependsOn:
- LoadTesterLogGroup
Properties:
RequiresCompatibilities:
- FARGATE
Volumes: []
NetworkMode: awsvpc
Memory: 2048
Cpu: 512
ExecutionRoleArn:
Fn::Join:
- ""
- - "arn:aws:iam::"
- Ref: "AWS::AccountId"
- ":role/ecsTaskExecutionRole"
PlacementConstraints: []
Family: simple-load-tester-taskdef
ContainerDefinitions:
- Name: load-test
Image: yashdalfthegray/simple-load-tester:latest
Essential: true
Command:
- "--url"
- Ref: URL
- "--times"
- Ref: Tries
- "--sleep"
- Ref: Sleep
LogConfiguration:
LogDriver: awslogs
Options:
"awslogs-group": "/ecs/simple-load-tester-taskdef"
"awslogs-region":
Ref: MasterRegion
"awslogs-stream-prefix": "ecs"
LoadTesterCluster:
Type: AWS::ECS::Cluster
Properties:
ClusterName: "load-test-cluster"
Vpc:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsSupport: "true"
EnableDnsHostnames: "true"
PublicSubnetAz1:
Type: AWS::EC2::Subnet
Properties:
VpcId:
Ref: Vpc
CidrBlock: 10.0.0.0/24
AvailabilityZone:
Fn::Select:
- "0"
- Fn::GetAZs:
Ref: AWS::Region
PublicSubnetAz2:
Type: AWS::EC2::Subnet
Properties:
VpcId:
Ref: Vpc
CidrBlock: 10.0.1.0/24
AvailabilityZone:
Fn::Select:
- "1"
- Fn::GetAZs:
Ref: AWS::Region
InternetGateway:
Type: AWS::EC2::InternetGateway
AttachGateway:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId:
Ref: Vpc
InternetGatewayId:
Ref: InternetGateway
RouteViaIgw:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: Vpc
PublicRouteViaIgw:
Type: AWS::EC2::Route
DependsOn: AttachGateway
Properties:
RouteTableId:
Ref: RouteViaIgw
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: InternetGateway
PublicSubnet1RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId:
Ref: PublicSubnetAz1
RouteTableId:
Ref: RouteViaIgw
PublicSubnet2RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
SubnetId:
Ref: PublicSubnetAz2
RouteTableId:
Ref: RouteViaIgw
LoadTestSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Security group for the load test tasks
VpcId:
Ref: Vpc
LoadTesterService:
Type: AWS::ECS::Service
DependsOn:
- LoadTesterCluster
- LoadTesterTaskDefinition
Properties:
Cluster:
Ref: LoadTesterCluster
DesiredCount:
Ref: DesiredTaskCount
LaunchType: FARGATE
ServiceName: load-test-service
TaskDefinition:
Ref: LoadTesterTaskDefinition
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
SecurityGroups:
- Ref: LoadTestSecurityGroup
Subnets:
- Ref: PublicSubnetAz1
- Ref: PublicSubnetAz2