top of page

IaC testers introduction (AWS)

In this weeks blog post we wanted to share what we think is a good foundation / entry level introduction to Infrastructure as Code (IaC) for testers.


For this introduction we are using AWS. We will put out some content on Azure and Google Cloud, if we get feedback that people would see value in that!


Like the last how-to type blog we did on Jenkins, some basic knowledge is assumed. This isn't intended to replace other resources or general training (of which there's loads of great free or cheap stuff), we'd like to help testers with applicable knowledge and skills to test IaC.


If you choose to physically follow along, by the end of this post you'll have defined an EC2 instance in code, deployed it to your account through CloudFormation then checked its deployment status through the console.


Note - if you follow along you'll need an AWS account before you start, and you may get charged for what you use or create.


A game changing capability that cloud vendors provide is the ability to define the Infrastructure you need as code. For testers this opens up the opportunity to get involved with what might have been classed as Operational Acceptance Testing, using some functional testing skills.



To start off let's define a YAML file detailing the EC2 instance we would like to create, like the example above. In this case the smallest EC2 with a linux ami will be created. Save it, source it, you could try out AWS CodeCommit.


Next up we're going to use CloudFormation to create a EC2 instance in our account, from the CLI. The reason for using the CLI and not the AWS Console is to encourage a step towards using AWS (or any other cloud providers services) programmatically. This will hopefully allow us as testers to get closer to and influence the introduction of testing into a CI/CD practice for the team we are in!


To set up the AWS CLI follow the guide here - https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html


AWS provides plenty of night time reading guides, API and CLI reference docs here - https://docs.aws.amazon.com/index.html


Once you have the AWS CLI installed and working, you can run a simple command to use CloudFormation to 'form' your EC2, example format below.


aws cloudformation create-stack --stack-name "somenameforyourstack" --template-body file://"yourfilename".yaml (or .json if you like working with that format)


If the command is successfully submitted you'll see something like this.



There's more info you can pass in, the CLI reference is here https://docs.aws.amazon.com/cli/latest/reference/cloudformation/create-stack.html


You could use the CLI or an API to get the status of a stack, for now let's mix it up and use the UI. Navigate to CloudFormation, and all being well you'll see CloudFormation doing its magic, like the picture below


Once CloudFormation tells you the process is complete, its time to check that what you wanted to be created, has actually been created!


Lets do this via a simple CLI command - aws ec2 describe-instances. This will return a load of information about the EC2 instances you have running in your account, like the example below.



To back that up, go and have a look in the console, you'll see your EC2 up and running there. At this point if you are worried about getting billed, stop or terminate what you have created.


So the idea of this blog was to give a very basic level introduction to IaC (for testers!), using AWS, with the programmatic interfaces available.


Hopefully you've come to realisation that the programmatic interfaces provide us with plenty of opportunity for test automation. The foundations are here for us to specific expected results, run a test then get the actual results back programatically, for the IaC we had. We'll explore and describe how we may go about doing that in future posts.


We hope you learnt something, we'd welcome feedback on this blog and also any thoughts on what you like to see us put out in the future.


Thanks for reading, any questions I'm reachable at linford@loupetestware.com


Recent Posts

See All
bottom of page