AWS CloudFormation Component ⎯⎯⎯ Easily Deploy AWS Cloudformation templates using Serverless Components, and pass their outputs to other Serverless Components.
npm install -g serverless
After installation, make sure you connect your AWS account by setting a provider in the org setting page on the Serverless Dashboard.
The easiest way to get started with by initializing the aws-cloudformation-starter
template. You can do that by running the following command:
serverless init aws-cloudformation-starter
cd aws-cloudformation-starter
You can configure your component & CloudFormation stack by editing the serverless.yml
file in the root of the initialized template:
name: aws-cloudformation-starter
component: aws-cloudformation
inputs:
name: my-stack
template:
AWSTemplateFormatVersion: '2010-09-09'
Description: Example stack 1
Resources:
LogGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: /log/group/one
RetentionInDays: 14
Outputs:
LogGroupArn:
Value:
Fn::GetAtt:
- LogGroup
- Arn
Inputs can contain the following properties:
name
[required]. the name of the stacktemplate
[required], the template to deploy.capabilities
, possible values areCAPABILITY_IAM
,CAPABILITY_NAMED_IAM
, andCAPABILITY_AUTO_EXPAND
.enableTerminationProtection
, possible values aretrue
andfalse
. Default isfalse
.role
, role arn for the role which CloudFormation assumes to create the stack.
See Request Parameters for more info about capabilities, enableTerminationProtection, and role.
You can deploy your stack with the following command:
serverless deploy
Once that is done, you'll see your stack outputs in the CLI, which you could then reference in another component.
To remove your entire stack, just run:
serverless remove