AWS bash

AWS (EC2 API) bash scripts - spark up - tear down

Download the scripts here: AWS up down scripts

Before downloading, please read our terms and conditions

This page has been added because we came across a particular issue when running commercial level CI tests using jmeter. In the real world you are likely to come across various instabilities in your environments at one stage or another. We then need to tidy up gracefully ready for the next run.

Running CI in earnest has highlighted an issue with reliability, particularly with our old Hudson, as was. If we lose communication, the load injectors can be left up and running in AWS with no context in any jobs to clean them up. This causes a problem for the next night’s run ‘cos we can run out of AWS  fixed ip addresses, or even AWS project allocated resources if it was allowed to build up.

So I now run a clean up script in the mornings from an independent Jenkins box which checks AWS specifically for any of these project injectors. When I spark up the injectors, I name them for each project so later I can run this:

    Name="jmeter-ec2-<project name>" terminate="TRUE" ./tear-down-ec2.sh

I developed a tear down script to do the above. And in the process, in order to test it, pulled out a spark-up script from my general jmeter CI solution. So this page now presents two scripts to independently spark up and tear down AWS instances.

The instances are based on several parameters set in a config file, including an AMI image and an AWS instance size:

LOCAL_HOME="/usr/local/jmeter"    
REMOTE_HOME="/usr/local/jmeter"                         
AMI_ID="ami-1a6exxxx"                       .
INSTANCE_TYPE="m1.medium"                  
INSTANCE_SECURITYGROUP="linux-security-group"           
AMAZON_KEYPAIR_NAME="myKeyPair"           
PEM_FILE="myKeyPair.pem"                  
#PEM_PATH="/usr/local/ec2-api-tools"        
PEM_PATH="$HOME/.ssh"       

(the full config file is in the zip)

To run these scripts you just need the ec2 api installed. And although these scripts were developed for linux, a windows version would be very similar and I can verify that the ec2 api has worked fine for me on a windows box as well.

The spark up script is called like this:

  • Name="jmeter-ec2-<project name>" count=”3” ./spark-up-ec2.sh

 

 

[Home] [About (CV)] [Contact Us] [JMeter Cloud] [webPageTest] [_64 images] [asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave] [LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH] [Bash methods] [Jenkins V2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over] [VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal]

In the Cartesian Elements Ltd group of companies