Giter Club home page Giter Club logo

cloudformation-validation-pipeline's Introduction

Usage

A demo and deployment guide describing this solution are available on the AWS Answers website.

To start writing your own tests and pipelines to test your templates it's likely your going to want to customise which tests are run and even write your own tests.

To ensure that any binary dependencies you may have are built for the correct platform it is recommended to create a new ec2 instance using the amzn-ami-hvm-2016.03.3.x86_64-gp2 AMI and run the build process from there.

The following s3 permissions are required for the IAM user/role configured in the aws cli:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "s3:CreateBucket",
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:ListBucket",
                "s3:GetObject"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

Ensure that pip and setuptools are up to date:

sudo -H pip install --upgrade setuptools pip

Clone the validation pipeline repo:

git clone https://github.com/awslabs/aws-cloudformation-validation-pipeline.git

Install:

cd aws-cloudformation-validation-pipeline
sudo -H python setup.py install

Now you're ready to start building tests and pipleines, to get going create a project skeleton:

cd ~/
cfn-validation-pipeline-skeleton
cd validation_pipeline

In the validation_pipeline folder you will find all the required cloudformation templates, lambda function code, html docs and unit tests

Building/deploying dependencies, Lambda function zips and CloudFormation templates to S3 is done using the deployment utility:

cfn-validation-pipeline-deploy my-cfn-pipeline-bucket

Note: this commmand has several configurable options, to view help for the deployment tools run the command with the --help argument

Now you can launch stacks from the cloudformation console using the s3 location for the desired cloudformation template in the output of the previous command.

Creating your own tests

This can be done by creating a new folder in the 'lambda_functions' folder. The folder should contain:

  • python file(s) - this is installed into the lambda function and executed when the pipeline runs.
  • requirements.txt [optional] - a list of all python packages that are required. Can include pip modules or custom modules stored in the 'lambda_functions/lib/' folder

Using the CFNPipeline class in your function greatly simplifies writing tests and is recommended. The included tests can be used as examples on usage for both pre-create and post-create tests. The validate_template and ami_check are fairly simple examples of pre and post create tests respectively. HTML API docs for usage of CFNPipeline are available in the 'docs' folder.

Adding tests to the template and pipeline

Custom tests can be added to the 'cloudformation/central-microservices.template' file and added to the pipeline by modifying 'cloudformation/main-pipeline.template' file.

Once you've authored your new tests and pipeline it can be deployed to s3 using the cfn-validation-pipeline-deploy command.

cloudformation-validation-pipeline's People

Contributors

hyandell avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.