Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Provisioning Example for Distributed Execution Using IaC - Terraform/AWS/EC2 #1933

Merged
merged 5 commits into from
Nov 14, 2021

Conversation

marcosborges
Copy link
Contributor

The proposal is to offer an uncomplicated example of distributed load execution.

With just a few steps we have Locust provisioned and distributed in the number of nodes provided, running in the aws cloud under ec2.

1. AWS Authentication

export AWS_ACCESS_KEY_ID=AIAXXXXXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=T9HyXXXXXXXXXXXXXXXXXXXXXXXXXXXX

2. Configure your provisioning

  • Don't forget to provide the correct subnet name in the variable file
  • Define location and file of your locust plan script
  • Define the number of nodes to create

variables.tf

variable "node_size" {
    description = "Size of total nodes"
    default = 2
}

variable "loadtest_dir_source" {
    default = "plan/"
}

variable "locust_plan_filename" {
    default = "basic.py"
}

variable "subnet_name" {
    default = "subnet-prd-a"
    description = "Subnet name"
}

3. Execute Terraform

cd examples/distribuited_execution_terraform/aws
terraform init
terraform apply --auto-approve

4. Access UI

Click on the link below to access the UI:

Result exemple:

Apply complete! Resources: 14 added, 0 changed, 0 destroyed.

Outputs:

dashboard_url = "http://3.237.255.123"
leader_private_ip = "10.17.5.119"
leader_public_ip = "3.237.255.123"
nodes_private_ip = [
  "10.17.5.167",
  "10.17.5.39",
]
nodes_public_ip = [
  "3.235.45.218",
  "100.24.124.0",
]

locust-home


5. Cleanup

terraform destroy --auto-approve

6. More information

@marcosborges marcosborges changed the title New Provisioning Example for Distributed Execution Using IaS - Terraform/AWS/EC2 New Provisioning Example for Distributed Execution Using IaC - Terraform/AWS/EC2 Nov 14, 2021
@cyberw
Copy link
Collaborator

cyberw commented Nov 14, 2021

Cool stuff!

  • Autoformat the code using Black (that's why the build is failing)
  • Link it from the documentation somewhere to make sure people can find it! Put it as a new paragraph in "Running in docker" (we should probably rename that page to something like "Cloud integration" or something, but I can do that later if you cant be bothered to figure out how to do it :)
  • distribuited_execution_terraform <- typo in the directory name :) (or maybe the directory could just be called "terraform"?)

@cyberw
Copy link
Collaborator

cyberw commented Nov 14, 2021

Perhaps you could also show how locust settings can be set? (locust supports environment vars, command line and .conf-file, whatever is easiest, but you dont have to support all of them)

@marcosborges
Copy link
Contributor Author

Thanks @cyberw , I will do what you said and updates PR.

@marcosborges
Copy link
Contributor Author

Hi @cyberw , I made the first considerations you pointed out.

Could you please validate if it is as expected?

Tks.

Obs: I'll prepare an example covering the other ways to configure locust and I promise to send it in the next PR.

@cyberw cyberw merged commit f969f5a into locustio:master Nov 14, 2021
@cyberw
Copy link
Collaborator

cyberw commented Nov 14, 2021

The docs ended up a little weird. Can you take a look? https://docs.locust.io/en/latest/running-cloud-integration.html

@cyberw
Copy link
Collaborator

cyberw commented Nov 14, 2021

Perhaps it is better to make the documentation shorter and just link to the markdown file?

@cyberw
Copy link
Collaborator

cyberw commented Nov 14, 2021

(the documentation could state what what it is useful for and give a brief description, but the details are a little too verbose to have in the docs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants