AWS for Dev and Test – part 1 QA Environments

I recently presented at an webinar on using  AWS for development and testing, I then figured the work I put into the presentation should be published here in case you’re interested in how we are using AWS for dev and test at JUST EAT.

Creating a QA Environment

When we first started with AWS we created a VPC for our team so as not to interfere with the rest of the company. This meant that the components we deployed could easily talk to each other without accidentally talking to other teams environments, or production. When it came to launching our application, it quickly became apparent that CloudFormation was the way to go for us, as this gave us the ability to have full control over the required stack for our application.

Using the Cloudformation to create a QA environment
Using the Cloudformation to create a QA environment

Through integration with the AWS APIs and Team City we are able to automate tearing down and creating our stacks from scratch. This mean 100% of our server elements in development are reset to a known state on a daily basis.

One thing we do do in our CloudFormations is to use the mappings section to configure the environment size you are building. When the stack is created in AWS we pass in parameters that allow us to configure many aspects of the stack, from the number of instances, to the instance type, to the Zones it is deployed in. This means that for development and testing we run single instances on as smaller types as possible, yet for performance testing we can easily spin up production sized environments. This helps reduce our AWS costs, while still allowing us to have the environment we want when we need it.

"EnvironmentSizes" : {
    "production" : {
        "DesiredCapacity" : 9,
        "MaxCapacity" : "12",
        "MinCapacity" : "9",
        "Ec2InstanceType" : "m1.medium",
        "AvailabilityZones" : ["eu-west-1a","eu-west-1b","eu-west-1c"]
    },
    "qa" : {
        "DesiredCapacity" : 1,
        "MaxCapacity" : "1",
        "MinCapacity" : "1",
        "Ec2InstanceType" : "m1.small",
        "AvailabilityZones" : ["eu-west-1b"]
    }
}

[environment size section of the Mappings in the CloudFormation]

"InstanceType" : {
    "Fn::FindInMap" : [
        "EnvironmentSizes",
            {
                "Ref" : "EnvironmentSize"
            },
        "Ec2InstanceType"
    ]
}

[referenced in the properties of the  AWS::AutoScaling::LaunchConfiguration]
I hope this helps make it clear how we a utilising CloudFormation for our development and  QA environments. Next I will let you know how we are implementing Continuous Deployment with the above setup.