This is a simple, reusable terraform code (modules) to simulate JMeter master slave load testing over the VPC peering. The stack is divided into two parts.
- Application Part (VPC 1) - Consisting of Apache servers in autoscaling having two disks each extended via LVM (Apache logs folder are available on this disk). The apache servers are exposed via private classic load balancer.
- JMeter (VPC 2) - Consisting of JMeter master and client setup in autoscaling to simulate the load on the apache servers.
VPC 1 and VPC 2 are peered to make the communication working.
The client's application is running in VPC 1 assuming to be Apache running in autoscaling mode over multiple availability zones (for the sake of example) and there is an entirely different setup in a different VPC having JMeter master slave setup to run load test on the apache machines exposed over private load balancers. This solution can be used with any infrastructure running on AWS where performance testing has to be done via JMeter setup.
- AWS Cloud - VPC Peering, Private Load balancer, Autoscaling
- Terraform
- Bash
- AWSCLI
- Systems Manager - Parameter Store
- JMeter
The solution is divided into three parts:
- The terraform stack is used to setup first VPC (app-vpc), subnets, NAT, apache servers in autoscaling exposed by the private load balancer. The EC2 servers have userdata to install the apache servers, create LVM out of two disks, moving logs to the lvm mounted disk. Terraform also updates the Load balancer DNS in the SSM parameter store to be used for later.
- The second terraform stack is used to setup second VPC (jmeter-vpc), NAT, jmeter master standalone server and client machines in autoscaling mode. The Jmeter servers have the userdata to install java and jmeter utility into the system
- The third part consists of a pipeline which uses single pipeline to trigger the load test from the master server using a sample JMX which simulates the loadtest. There is a bash script which fetches load balancer DNS from the SSM parameter store and replaces in the file and then performs the load test.
- Appropriate AWS privileges on AWS account covering atleast landing zone creation, SSM, IAM etc.
- Jenkins or any other CICD setup running to trigger the pipelines (Local system can also be used to run the commands)
- Terraform installed on local or CICD server.
- A pre-existing S3 bucket (to store remote terraform state)
- Both the VPCs are in the same account and in the same region.
- Separate running Jenkins or CICD server which is used to spin up the infrastructure.
- The PEM file is already on Jenkins machine so that it can SSH into the master server to run the ondemand load test.
- LVM is needed to extend the disk partition if required at later point of time.
- Create dynamic Security groups and dynamic listener and health-checks for Load Balancer.
- Capability to create Jmeter Master from different AMIs and user.
- Store and use keys from vault/secrets.
- Error Handling while using Jenkins.
- Jenkins jobs to destroy the requested component.
- Use AWS launch template insteas of launch configuration to the latest features and improvements for AWS ASGs.
- Fork the repository
- Submit a pull request to master branch of this repository
- Reach out to email address