Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit c056fa4

Browse files
committed
Removed support for private VPC connectivity and updated instructions
1 parent 6b84893 commit c056fa4

File tree

5 files changed

+51
-337
lines changed

5 files changed

+51
-337
lines changed

README.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,16 @@ Now, set the origin to be your new CodeCommit repository.
8989
git remote add origin {code_commit_repository_url}
9090
```
9191

92-
Finally, push the code. Note that after you push this, the deployment pipeline will be triggered automatically
93-
and therefore running the load tests scenarios in the Fargate cluster(s).
94-
92+
Finally, push the code. This will trigger the Code Pipeline which will run the tests in the Fargate cluster.
93+
9594
```bash
9695
git push -u origin master
9796
```
9897

9998
### 5. Monitor the test execution in CloudWatch
10099

101100
The CloudFormation template should have created a [CloudWatch Metric Filter](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html)
102-
that will capture the average response time for each HTTP request that was issued to your system under test. You should
103-
see something like this in the template:
104-
105-
```yaml
106-
TaurusLogFilterAvgResponseTime:
107-
Type: AWS::Logs::MetricFilter
108-
Properties:
109-
FilterPattern: "[time, logType=INFO*, logTitle=Current*, numVu, vu, numSucc, succ, numFail, fail, avgRt, x]"
110-
LogGroupName: !Ref FargateTaskCloudWatchLogGroup
111-
MetricTransformations:
112-
-
113-
MetricValue: "$avgRt"
114-
MetricNamespace: "dlt-fargate/taurus"
115-
MetricName: "avgResponseTime"
116-
```
101+
that will capture the average response time for each HTTP request that was issued to your system under test.
117102

118103
What this filter is doing, is parsing the Taurus logs that match that given format and assigning a variable name to each
119104
value in the log. We are going to ignore all values in the log except for `avgRt` which is captured as a new metric and
@@ -127,34 +112,52 @@ The Dashboard will look something like this:
127112

128113
## Launch in Additional Regions (Optional)
129114

130-
It may be likely that running this solution from a single AWS region is enough to load test your application. However,
131-
if you want to take it a step further, you can do so by deploying Fargate clusters in multiple regions and make this a
132-
real distributed load test simulation. For this, I have created a separate CloudFormation template for you to launch the
133-
solution in additional regions. The difference between this template and the Master one, is that this one doesn't
134-
create the ECR Docker Registry and the IAM Execution Role, as you can share these resources across all Fargate deployments.
115+
It may be likely that running this solution from a single AWS region is enough to load test your service. However,
116+
if you want to take it a step further, you can deploy Fargate clusters in multiple regions and make it a
117+
multi-region load test simulation. In order to do this, I created a separate CloudFormation template that launches this
118+
solution in additional regions. The difference between this template and the Master one is that this one does not
119+
create the ECR Docker Registry, the CodePipeline and IAM Roles, as those resources will be shared across all your regions.
135120

136-
Use the following buttons to launch the solution in the desired additional regions:
121+
Use the following links to launch the solution in the desired additional regions:
137122

138123
Additional Region | Region Code | Launch
139124
------|-----|-----
140125
US East (N. Virginia) | us-east-1 | [![Launch in us-east-1](https://camo.githubusercontent.com/210bb3bfeebe0dd2b4db57ef83837273e1a51891/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f636c6f7564666f726d6174696f6e2d6578616d706c65732f636c6f7564666f726d6174696f6e2d6c61756e63682d737461636b2e706e67)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=DistributedLoadTesting&templateURL=https://s3.amazonaws.com/distributed-load-testing-using-aws-fargate/templates/additional-region.yaml)
141126
US East (Ohio) | us-east-2 | [![Launch in us-east-2](https://camo.githubusercontent.com/210bb3bfeebe0dd2b4db57ef83837273e1a51891/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f636c6f7564666f726d6174696f6e2d6578616d706c65732f636c6f7564666f726d6174696f6e2d6c61756e63682d737461636b2e706e67)](https://console.aws.amazon.com/cloudformation/home?region=us-east-2#/stacks/new?stackName=DistributedLoadTesting&templateURL=https://s3.amazonaws.com/distributed-load-testing-using-aws-fargate/templates/additional-region.yaml)
142127
US West (Oregon) | us-west-2 | [![Launch in us-west-2](https://camo.githubusercontent.com/210bb3bfeebe0dd2b4db57ef83837273e1a51891/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f636c6f7564666f726d6174696f6e2d6578616d706c65732f636c6f7564666f726d6174696f6e2d6c61756e63682d737461636b2e706e67)](https://console.aws.amazon.com/cloudformation/home?region=us-west-2#/stacks/new?stackName=DistributedLoadTesting&templateURL=https://s3.amazonaws.com/distributed-load-testing-using-aws-fargate/templates/additional-region.yaml)
143-
144128

145-
## Run Locally
129+
Once the stack creation has been completed, go back to the region where you launched the `Master` stack and follow these
130+
steps:
131+
132+
![AddRegion](docs/add-region.gif)
133+
134+
1. Go to CodePipeline, then select the pipeline created by the master stack
135+
2. Click on the `LoadTest` step to edit it.
136+
3. Go to Edit > Environment
137+
4. Expand the `Additional Configuration` section
138+
5. Add 2 new environment variables to have your additional region added.
139+
140+
Name | Value
141+
---------------------|---------------------
142+
REGION_2 | Additional region (i.e. us-east-1)
143+
REGION_2_STACK_NAME | CloudFormation stack name of the additional region (i.e. DistributedLoadTesting)
144+
145+
Save the changes and you are done! You can repeat those steps for every additional region.
146+
147+
## How to Run Locally
146148

147-
Build the image by issuing the following command in the root directory of this project.
149+
It's a good practice to run your tests locally before pushing them to CodeCommit to make sure they run correctly in a
150+
Docker container. To do this, build the image by issuing the following command in the root directory of this project.
148151

149152
```bash
150153
docker build -t load-tests-using-fargate .
151154
```
152155

153-
Then run the docker container locally.
156+
Then run the container locally.
154157

155158
```bash
156159
docker run -it load-tests-using-fargate taurus.yml
157160
```
158161

159-
If the docker ran as expected, you can push the changes to your AWS CodeCommit repository and let the pipeline
162+
If you are happy with the result, you can push the changes to the CodeCommit repository and let the pipeline
160163
do the rest.

bin/runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
# Will be passed as environment variable to the Fargate docker containers.
2121
# Useful with the Elasticsearch example as the test suite will read the cluster URL from this variable.
22-
ENDPOINT_UNDER_TEST = 'http://strawberry.banana.com'
22+
ENDPOINT_UNDER_TEST = os.getenv('ENDPOINT_UNDER_TEST', 'http://strawberry.banana.com')
2323
TASK_COUNT = int(os.getenv('TASK_COUNT', 3))
2424

2525
def get_regions_from_environment_variables():

cloudformation/main.yml

Lines changed: 0 additions & 257 deletions
This file was deleted.

docs/add-region.gif

1.3 MB
Loading

0 commit comments

Comments
 (0)