GitXplorerGitXplorer
m

cfn-featurestack

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
26602207d3eda2cbe6437210ec635b258e81b9b3

Added output logging

committed 6 years ago
Unverified
a27cf56701c083f365d0a06f93033e0cd4267141

1.0.1

committed 6 years ago
Unverified
c2a38b22f9f6ec9b91f28fa05a446f0a3d103f93

package-lock cleanup

committed 6 years ago
Unverified
d47eed67f423fb0cee5064fd5e7fb87f0fb636d8

1.0.0

committed 6 years ago
Unverified
31b91edbe7f4cdaa70366727b8054ce9cf8d1d0e

documentation

committed 6 years ago
Unverified
e326d3129f2a3faca701591712ac6166419d2e2c

Removed unnecessary required param

committed 6 years ago

README

The README file for this repository.

cfn-featurestack

Simple utility for creating temporary AWS CloudFormation stacks (featurestacks) for feature branches

Configuration

cfn-featurestack will by default use any locally pre-configured AWS account. You can pre-configure your account by any of the following methods:

  • With aws-cli, by running aws-cli configure (Recommended for local environments)
  • Set AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_PROFILE and AWS_REGION environment variables (Recommended for server/container environments)
  • Directly configure to .aws\config and .aws\credentials files

Additionally, you can define your AWS access and secret keys as parameters, but this is not recommended as they A) can end to version control or B) will stay readable in logs.

Usage

cfn-featurestack will add IsFeatureStack parameter to your stack parameters, which enables you to set conditions for CloudFormation not to create specific resources for featurestacks (such as CloudFront distributions and Route53 domain names).

Preparing CloudFormation template

  1. Add IsFeatureStack parameter and conditions for it.
Parameters:
  IsFeatureStack:
    Description: "Is this a feature stack. (Defaults to \"false\")"
    Type: String
    Default: "false"

Conditions:
  IsNotFeatureStack: !Equals [ !Ref IsFeatureStack, "false" ]
  IsFeatureStack: !Equals [ !Ref IsFeatureStack, "true" ]
  1. Add IsNotFeatureStack to any resource that must be unique across stacks and cannot be duplicated to feature stacks, such as CloudFront distributions and Route53 domain names.
Resources:
  CloudFrontDistribution:
    Type: AWS::CloudFront::Distribution
    Condition: IsNotFeatureStack
    Properties:
      # ...

Command line use

Install

npm install cfn-featurestack -g

Usage

cfn-featurestack --template=./cfn/cfn-stack.yaml

See options for more details.

Package.json script use

Install

npm install cfn-featurestack --save-dev

Usage

Add deploy script to package.json:

{
  "scripts": {
    "deploy": "cfn-featurestack --template=./cfn/cfn-stack.yaml"
  }
}

See options for more details.

Options

template

Path to template file

parameters

Path to parameters file (.json). Multiple parameters options are allowed and values are combined in the order they are defined, with values from latter overwriting previous

Valid .json files:

  • aws-cli cloudformation type:
[
  {
    "ParameterKey": "FirstParam",
    "ParameterValue": "first-param-value"
  },
  {
    "ParameterKey": "SecondParam",
    "ParameterValue": "second-param-value"
  }
]
  • AWS CodePipeline parameters type:
{
  "Parameters": {
    "FirstParam": "first-param-value",
    "SecondParam": "second-param-value"
  }
}
  • Plain JSON object
{
  "FirstParam": "first-param-value",
  "SecondParam": "second-param-value"
}

Multiple parameters files

cfn-featurestack --template=./cfn/cfn-stack.yaml --parameters=./cfn/params1.json --parameters=./cfn/params2.json

region

AWS region

capabilities

AWS IAM capabilities

Valid values:

  • CAPABILITY_IAM
  • CAPABILITY_NAMED_IAM

profile

Load profile from shared credentials file (in .aws\credentials)

access-key

AWS Access Key

secret-key

AWS Secret Access Key

version

Show version number

help

Show help