0.0.7 • Published 1 year ago
@sp-tools/kloud-stack v0.0.7
☁️ kloud-stack
Provide a declarative way to deploy multiple CloudFormation stacks with ease.
Installation
# Via yarn
$ yarn add @sp-tools/kloud-stack
# Via npm
$ npm install @sp-tools/kloud-stack
Usage
- Ensure that the environment variable
AWS_DEFAULT_REGION
is set - At the root of your application add configuration file called
kloud-stack.yml
. kloud-stack run -s <stage>
CLI options
Following is the usage of kloud-stack
CLI.
Usage: kloud-stack [command] <options>
Options:
--stage, -s Specify stage to run on. (required)
--file, -f Path to kloud-stack configuration file (default: "kloud-stack.yml")
--dry -d Execute a dry-run
--version, -v Output the version number
--help, -h Show help
Commands:
run [options] Deploy all cloudformation stacks in config file
kloud-stack.yml
Following is the configuration file will all possible options:
Example - SSM
provider:
name: ssm
stacks:
- templateFile: './sample-stack.yml'
stackName: 'sample-stack-name'
parameters:
Stage: ${opt:stage}
Foo: ${ssm:/foo-service/config/THEFOO}
- templateFile: './sample-stack-two.yml'
stackName: 'second-stack'
parameters:
Stage: ${opt:stage}
Bar: bar-queue-${opt:stage}
Blah: ${cf:blah-service/THEBLAH}
Example - DynamoDB
provider: # If used in conjunction with parameter store. Will support ${ddb:} resolution
name: ddb (optional)
tableName: tableName
stacks:
- templateFile: './cloudformation/global/acm.yml' # path to cloudformation template
stackName: blah-acm-${opt:stage}
parameters:
Stage: ${opt:stage}
- templateFile: './cloudformation/global/internal-domain.yml'
stackName: blah-api-gateway-${opt:stage}
parameters:
Stage: ${opt:stage}
Variables
Options
${opt:stage}
AWS
${aws:accountId}
${aws:region}
Providers
SSM
provider:
name: ssm
To reference ssm parameters, use: ${ssm:/foo-service/config/THEFOO}
DynamoDB
provider:
name: ddb
tableName: ThisTableHasConfigs
To reference ddb parameters, use: ${ddb:/theValue}