deployCloudFormationStack(options)
deployCloudFormationStacks(options)
describeCloudFormationFailure(options)
getStackOutputs(options)
getStackResources(options)
getCurrentStackEvents(options)
watchStackResources(options)
printStackResources(options)
import { deployCloudFormationStack } from '@jcoreio/cloudformation-tools'
Deploys a stack. Code is adapted from aws-cli
's
deploy
command. However, it can display stack resources
as they are getting created/updated
(if you set watchResources: true
), and if the update
fails, it will log the failure events.
General AWS service configuration options like region
and credentials
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
If truthy, will watch and print out resource status while the stack create/update is in progress
Alternative to watchResources
. If given, will watch and print out resource status while the stack create/update is in progress.
Destination AWS region for CloudFormation stack
If true
, lists changes and prompts for approval before deploying. Defaults to false
.
The name or the unique ID of the stack for which you are creating a change set. AWS CloudFormation generates the change set by comparing this stack's information with the information that you submit, such as a modified template or different parameter input values.
The path to the file containing the CloudFormation template. You must specify either TemplateFile
or
TemplateBody
.
A structure that contains the body of the revised template, with a minimum length of 1 byte and a maximum length of 51,200 bytes. AWS CloudFormation generates the change set by comparing this template with the template of the stack that you specified.
Parameters
({[string]: any} | Array<{ParameterKey: string, ParameterValue: string, UsePreviousValue?: boolean, ResolvedValue?: string}>
, optional)
A list of Parameter structures that specify input parameters for the change set.
In some cases, you must explicity acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to create the stack.
The Amazon Resource Name (ARN) of an AWS Identity and Access Management (IAM) role that AWS CloudFormation assumes when executing the change set. AWS CloudFormation uses the role's credentials to make calls on your behalf. AWS CloudFormation uses this role for all future operations on the stack. As long as users have permission to operate on the stack, AWS CloudFormation uses this role even if the users don't have permission to pass it. Ensure that the role grants least privilege.
If you don't specify a value, AWS CloudFormation uses the role that was previously associated with the stack. If no role is available, AWS CloudFormation uses a temporary session that is generated from your user credentials.
The Amazon Resource Names (ARNs) of Amazon Simple Notification Service (Amazon SNS) topics that AWS CloudFormation associates with the stack. To remove all associated notification topics, specify an empty list.
Key-value pairs to associate with this stack. AWS CloudFormation also propagates these tags to resources in the stack. You can specify a maximum of 50 tags.
If given, will upload the template body the given S3 bucket.
If true
, stack outputs will be read and returned in the Outputs
property. Defaults to false
.
If true
, will replace an existing stack of the same name if it's in CREATE_FAILED
, ROLLBACK_FAILED
,
ROLLBACK_COMPLETE
or ROLLBACK_IN_PROGRESS
state (note that these only refer to rollback after
create failure, and are distinct from the UPDATE_ROLLBACK_...
states)
If given, this function will be called once the stack create/update is ready to be watched.
A Promise
that resolves or rejects when the deployment succeeds or fails
import { deployCloudFormationStacks } from '@jcoreio/cloudformation-tools'
Deploys multiple stacks in parallel.
General AWS service configuration options like region
and credentials
An array of arguments for deployCloudFormationStack
, without the other options below or the approve
option.
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
If truthy, will watch and print out resource status while the stacks are being created or updated.
If given, will upload the template bodies the given S3 bucket.
A Promise
that will resolve after all stacks are deployed successfully, or reject immediately when any stack
deployment fails. If one stack deployment fails, the other deployments will not be canceled.
import { describeCloudFormationFailure } from '@jcoreio/cloudformation-tools'
Scans stack events for failures and prints them out with nice formatting, to help you debug.
General AWS service configuration options like region
and credentials
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
The name or unique id of a stack to describe failures for
The writable stream to output to. Defaults to process.stderr
.
A Promise
that resolves when done logging, or rejects
if it failed to get stack events
import { getStackOutputs } from '@jcoreio/cloudformation-tools'
Gets a stack's outputs as an object
instead of an array of {OutputKey, OutputValue}
objects.
General AWS service configuration options like region
and credentials
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
The name or unique id of a stack to get outputs of
A Promise
that resolves to an {[OutputKey]: OutputValue}
object, or rejects if it failed to get
the outputs.
import { getStackOutputs } from '@jcoreio/cloudformation-tools'
Gets all of a stack's resources, handling the paging for you.
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
The name or unique id of a stack to get resources of
A Promise
that resolves to array of stack resources,
or rejects if it failed ot get the resources.
import { getCurrentStackEvents } from '@jcoreio/cloudformation-tools'
Gets all of the events from the most recent changeset, handling paging for you.
General AWS service configuration options like region
and credentials
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
The name or unique id of a stack to get events of
A AsyncIterable
that yields stack events.
Prints out one or more stacks' resources and their status in a table every 5 seconds, or on an interval you specify.
An AWS.CloudFormation
instance. Will create one with the default options if you don't provide one
The name or unique id of a stack to watch
The names or unique ids of stacks to watch
The interval delay in milliseconds
If given, the interval will be cleared once this promise resolves or rejects.
The interval ID from setInterval
.
Prints the given resources and their status in a table.
The resources to print out
The stream to print to. Defaults to process.stderr
.
Ensures that a security group with the specified name exists in the VPC, creating it if needed.
General AWS service configuration options like region
and credentials
Name of the security group
Description to use when creating the security group
ID of the VPC. Required because security groups exist within a VPC.
Optional EC2 class instance to use for API calls. If no EC2 class instance
is provided, one will be created using the region
property. Either
ec2
or region
must be provided.
AWS region. Either ec2
or region
must be provided.
A Promise
that resolves to a {securityGroupId}
object, or rejects if it failed to
ensure the security group exists.
Fetches and returns the ID of the VPC where the specified subnet is located.
General AWS service configuration options like region
and credentials
ID of the subnet
Optional EC2 class instance to use for API calls. If no EC2 class instance
is provided, one will be created using the region
property. Either
ec2
or region
must be provided.
AWS region. Either ec2
or region
must be provided.
A Promise
that resolves to a string
with the ID of the VPC
Fetches and returns the CIDR block IP address range of the specified VPC.
General AWS service configuration options like region
and credentials
ID of the VPC
Optional EC2 class instance to use for API calls. If no EC2 class instance
is provided, one will be created using the region
property. Either
ec2
or region
must be provided.
AWS region. Either ec2
or region
must be provided.
A Promise
that resolves to a string
with the IP address range of the VPC