All Projects → awslabs → aws-cloudformation-template-builder

awslabs / aws-cloudformation-template-builder

Licence: Apache-2.0 License
aws-cloudformation-template-builder contains cfn-skeleton is a command line tool and Go library that consumes the published CloudFormation specification and generates skeleton CloudFormation templates with mandatory and optional parameters of chosen resource types prefilled with placeholder values.

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

GitHub version Snap Status

Get it from the Snap Store

AWS Cloudformation Template Builder

This repository contains cfn-skeleton, a command line tool and Go library that consumes the published CloudFormation specification and generates skeleton CloudFormation templates with mandatory and optional parameters of chosen resource types pre-filled with placeholder values.

License

This project is licensed under the Apache 2.0 License.

Installation

You can install cfn-skeleton in one of the following three ways:

  • Use the snap package

  • Download the latest release for your operating system.

  • If you have go installed, run the following:

    GO111MODULE=on go get github.com/awslabs/aws-cloudformation-template-builder/cmd/cfn-skeleton

Usage

cfn-skeleton [OPTIONS] [RESOURCE TYPES...]

  cfn-skeleton is a tool that generates skeleton CloudFormation templates
  containing definitions for the resource types that you specify.

  You can use a short name for a resource type so long as it is unambiguous.
  For example 'Bucket', 'S3::Bucket', and 'AWS::S3::Bucket' refer to the same type.
  But 'Instance' would need disambiguation.

Options:

  -b, --bare  Produce a minimal template, omitting all optional resource properties.
  -j, --json  Output the template in JSON format (default: YAML).
  --help      Show this message and exit.

Resource names must be delimited by spaces. If you specify more than one of the same resource type, you will get multiple resources in the output template; cfn-skeleton will ensure that the names are unique by adding numbers.

Examples

Basic Usage

cfn-skeleton -b Bucket EC2::Instance

Output:

# Template generated by cfn-skeleton
AWSTemplateFormatVersion: "2010-09-09"

Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Properties:
      {}

  MyInstance:
    Type: AWS::EC2::Instance
    Properties:
      {}

Output JSON

To output JSON, use the -j or --json flag.

Note that JSON output will include comments that help you identify optional properties of CloudFormation resources; however, comments are not supported in the JSON specification and will be rejected by AWS CloudFormation. Once you have finished editing your template, ensure that you remove all comments.

cfn-skeleton -b -j Bucket

Output

{  // Template generated by cfn-skeleton
    "AWSTemplateFormatVersion": "2010-09-09",

    "Resources": {
        "MyBucket": {
            "Type": "AWS::S3::Bucket",
            "Properties": {}
        }
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].