AWS Cloudformation script

Code to spawn one locust.io master (not finished). Also note, lots of there parameters will be subject to a specific AWS account (i.e. the security groups)

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "LocustMaster": {
      "Type": "AWS::EC2::Instance",
      "Properties": {
        "ImageId": "ami-bff32ccc",
        "SecurityGroupIds": ["sg-72f39316", "sg-99f292fd"],
        "KeyName" : "development-vpc-search",
        "Tags": [
          {
            "Key" : "Name",
            "Value": "locust-master"
          }
        ],
        "InstanceType": "t2.micro",
        "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
             "#!/bin/bash -xe\n",
             "yum update -y aws-cfn-bootstrap\n",
             "/opt/aws/bin/cfn-init -v ",
             "         --stack ", { "Ref" : "AWS::StackName" },
             "         --resource LocustMaster ",
             "         --configsets Install ",
             "         --region ", { "Ref" : "AWS::Region" }, "\n"
        ]]}}
      },
      "Metadata" : {
        "AWS::CloudFormation::Init" : {
          "configSets" : {
            "Install" : [ "Install" ]
          },
          "Install" : {
            "files" : {
              "/home/ec2-user/locustfile.py" : {
                "content" : "hey",
                "mode"  : "000644",
                "owner" : "root",
                "group" : "root"
              }
            },
            "commands" : {
              "install_locust" : {
                "command" : "wget http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz#md5=62a9f08dd5dc69d76734568a6c040508 && tar -xvf pip*.gz && cd pip* && python setup.py install && yum -y install gcc-c++ && pip install locustio && pip install pyzmq",
                "cwd" : "~",
                "ignoreErrors" : "false"
              }
            }
          }
        }
      }
    }
  }
}
 

 

Details
Updated: 10th March 2016

Play Blokr Now FREE!
blokr.io the web game where you can eat other blocks!