Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Infrastructure Test Examples

This repository contains examples for testing your infrastructure code written with the AWS CDK. Unit tests are written with the Jest testing framework. Integration tests are written with the InSpec testing and auditing framework.

Getting Started

  1. Install the AWS CDK
    npm install -g aws-cdk
    You can find more CDK setup details here. The examples in this project are written with Typescript.
  2. Install InSpec using these instructions.
  3. Install dependencies
    npm install
  4. Run unit tests
    npm run build && npm run test
  5. Setup your AWS credentials for InSpec
    Following the instructions here, you can use environment variables or a profile in ~/.aws/credentials.
  6. Synthesize cdk synth
  7. Deploy your changes
    cdk deploy --all --parameters FullStackAppStack:keyPairName=<your key pair name> --parameters S3BucketStack:bucketName=<your bucket name> --outputs-file inspec/files/outputs.json
  8. Run InSpec tests
    inspec exec inspec -t aws://
    If you get an error about the lockfile, delete inspec/inspec.lock and rerun the command.

Other useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template
  • cdk destroy destroys the stack and all associated resources
  • inspec exec inspec -t aws:// runs the inspec integration tests for the inspec test profile

About

Examples for testing your cloud infrastructure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published