Skip to content

Easily Deploy AWS CloudFormation templates using Serverless Components.

Notifications You must be signed in to change notification settings

serverless-components/aws-cloudformation

Repository files navigation

Serverless Components


AWS CloudFormation Component ⎯⎯⎯ Easily Deploy AWS Cloudformation templates using Serverless Components, and pass their outputs to other Serverless Components.

 

  1. Install
  2. Initialize
  3. Configure
  4. Deploy
  5. Remove

 

1. Install

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.

2. Initialize

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

3. Configure

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 stack
  • template [required], the template to deploy.
  • capabilities, possible values are CAPABILITY_IAM, CAPABILITY_NAMED_IAM, and CAPABILITY_AUTO_EXPAND.
  • enableTerminationProtection, possible values are true and false. Default is false.
  • role, role arn for the role which CloudFormation assumes to create the stack.

See Request Parameters for more info about capabilities, enableTerminationProtection, and role.

4. Deploy

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.

5. Remove

To remove your entire stack, just run:

serverless remove

Releases

No releases published

Packages

No packages published