1.0.3 • Published 6 years ago

cfn-package-cli v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

cfn-package

A packaging tool for your Cloudformation stacks.

CodeFactor

Current version: 1.0.0

Lead Maintainer: Halim Qarroum

Table of contents

Installation

Using NPM

# Installs the `cfn-package` command-line.
npm install --save cfn-package-cli

# Installs the `cfn-python-lint` tool.
pip install cfn-lint

# Installs the `cfn-nag` security audit tool.
gem install cfn-nag

Please make sure that the aws-cli is installed on your system, and has the appropriate permissions to upload S3 assets to the given bucket and validate your template.

Features

  • Recursively packages your Cloudformation stacks and sub-stacks into one ready-to-deploy template.
  • Runs the AWS static and advanced linters on your templates.
  • Runs cfn_nag to detect security issues with your templates.
  • Automatically runs an npm install on your Node.js Lambda functions to generate the node_modules directory before packaging them up.

Description

The cfn-package tool makes it possible to package your Cloudformation templates using the regular package command given a project on the filesystem containing multiple nested Cloudformation stacks. The resulting packaged Cloudformation template you can then reference in your deployment will be named cfn.package.yml by default, and placed at the root of the directory you referenced when running the command.

This tool also enforces error free deployments while packaging your template by running the validate-template command, as well as the AWS cfn-lint command as well. To avoid possible security vulnerabilities in your architecture, cfn_nag is also executed across all your templates at packaging time.

Note that in order to use the aforementioned third-party tools, you need to have them available in your PATH. If a third party tool is not available, a warning will be issued by cfn-package.

Usage

You will find below a description of the options made available by cfn-package, as well as different usage examples of how to package your templates.

Available options

The cfn-package command implements different options that you can use as part of your continuous integration process to package your Cloudformation stacks.

  • --bucket - The name of the S3 bucket to which the generated assets will be uploaded by the AWS CLI.
  • --template - The path to the root cloudformation template you would like to package.
  • --enforce-missing-tools - Issues an error if one of the validation tools are not available on the local machine.
  • --output-file - Specifies an alternative file on the filesystem for the generated packaged template. The default is to write the resulting packaged template into a cfn.package.yml file in the same directory as the given template.
  • --log-output-file - Specifies a file on the filesystem to which debugging logs will be written.

Packaging a directory

In order to package a directory containing your AWS Cloudformation templates along with every nested templates, run the following command.

cfn-package --template ./cloudformation/cloudformation-template.yml --bucket my-output-bucket

See also

  • aws-blocks - A package manager for AWS Cloudformation and a repository for reusable stacks.
  • cfn_nag - Linting tool for CloudFormation templates.
  • cfn-python-lint - CloudFormation Linter.