Skip to content
Branch: master
Find file History
ckamps and Chuck Meyer #118: Increase Lambda function timeout to 15 minutes to align with pr…
…evious function code changes (#119)

* StackSetsResource: catch throttling exception. Expand retries to take advantage of 15 minute Lambda timeout. Enhance error messages when exceptions occur to provide context as to which operation was underway.

* #118: increase timeout to max of 15 minutes to match support in code
Latest commit 0e5872f Nov 21, 2018


AWS CloudFormation Lambda-backed Custom Resource for launching StackSets.

The lambda function is written in Python and based on the Custom Resource framework.

  • FunctionCode contains the lambda function and helper libraries.
  • Templates contains the function deploy template and a sample StackSet resource.


Using the aws cli:

You can install the function using the CloudFormation package and deploy commands. You will need an S3 bucket to store the lambda function code. Once you've created the bucket, run the following CLI commands to create the function stack:

aws cloudformation package \
  --template-file Templates/stackset-function-template.yaml \
  --s3-bucket *Your S3 bucket* \
  --s3-prefix *Your S3 object prefix* \
  --output-template-file Templates/packaged-stackset-function-template.yaml
aws cloudformation deploy \
  --template-file Templates/packaged-stackset-function-template.yaml \
  --stack-name StackSetCustomResource \
  --capabilities CAPABILITY_IAM

Alternatively, if you'd like to override one or more of the function stack template parameters:

aws cloudformation deploy \
  --template-file Templates/packaged-stackset-function-template.yaml \
  --stack-name StackSetCustomResource \
  --parameter-overrides RoleName=custom-resource-stacksets RolePath=/company/ \
  --capabilities CAPABILITY_IAM

CloudFormation will package up the python files, upload them to your S3 bucket, create the lambda function with appropriate permissions and export the Lambda function ARN as StackSetCustomResource for use in other stacks.

Sample CloudFormation snippet:

The following YAML snippet demonstrates how to define a StackSet within your template using the exported ARN of the lambda function:

    Type: Custom::StackSet
        Fn::ImportValue: StackSetCustomResource
      StackSetName: EventDynamoDB
      StackSetDescription: Deploy DynamoDB for event tables in dev and production
        - ReadCapacity: 20
        - WriteCapacity: 20
      Capabilities: !Ref "AWSS::NoValue"
      AdministrationRoleARN: MyStackSetAdministrationRoleARN
      ExecutionRoleName: MyStackSetExecutionRoleName
      OperationPreferences: {
        "RegionOrder": , [ "us-east-2", "us-west-2" ]
        "FailureToleranceCount": 0,
        "MaxConcurrentCount": 3
        - Environment: Testing
        - Creator: Chuck
        # Dev
        - Regions:
            - us-east-2
            - XXXXXXXXXXXX
        # Production
        - Regions:
            - us-east-2
            - us-west-2
            - YYYYYYYYYYYY
            - ReadCapacity: 50
            - WriteCapacity: 50


[ ] Support retaining stacks on delete
[ ] Support account gate functions
You can’t perform that action at this time.