Skip to content
D

Deploy CloudFormation Templates CI/CD Catalog project

Welcome to the Deploy CloudFormation Templates CI/CD Component Wiki!

Overview

The Deploy CloudFormation Template component is designed to automate CloudFormation operations in GitLab CI/CD pipelines. It allows you to deploy, update, and delete CloudFormation stacks using the aws-cicd-components Docker image. The component also handles the uploading of CloudFormation templates to S3, validating those templates, and keeping track of the status of stack operations.

Usage

You can include this component in your GitLab pipeline to manage CloudFormation stacks. You can configure various settings to control how it behaves, such as which stage of the pipeline it runs in, which CloudFormation action to perform (like deploy or destroy), and which S3 bucket to use for uploading templates.

Inputs

The component takes several inputs that allow you to customize its behavior:

  • Log Level: You can adjust how much information is logged during the process. The lowest level gives minimal output, while the highest level provides detailed debugging information.
  • Monitoring: You can configure how frequently the component checks the status of a CloudFormation stack during creation or updates, and set a timeout for how long it waits before considering the process failed.
  • Runner Tags: These define which GitLab runners are eligible to execute the job.
  • Action: This tells the component whether to deploy or delete a CloudFormation stack.
  • Template and Stack Details: You provide information such as the path to the CloudFormation template, the name of the stack, parameters to pass to the stack, and tags to associate with it.
  • S3 Bucket: You specify which S3 bucket the CloudFormation template should be uploaded to before deployment.

AWS CLI Integration

The component uses a Docker image that already includes the AWS CLI, along with several helpful bash utilities. This means you don’t need to worry about installing or configuring the AWS CLI in your pipeline. The image handles all the interactions with AWS, including managing CloudFormation stacks and syncing templates to S3.

Logging Levels

You can control how much logging output is shown. If you prefer minimal logs, you can choose that. Alternatively, if you need more detail for troubleshooting, you can enable more verbose logging, including debug-level information.

CloudFormation Monitoring

When creating, updating, or deleting a CloudFormation stack, the component continuously checks the status of the operation. You can configure how often it checks and how long it should wait before giving up if the operation is taking too long. This ensures that you are always aware of the progress of the stack operation.

Environment Variables

Before using this CICD component, make sure these environment variables are set. The image includes a function to verify they are configured:

  • AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY: AWS credentials provided as environment variables for security.
  • AWS_DEFAULT_REGION: The AWS region where operations like CloudFormation deployments or EC2 management will take place.

You will also need to provide the name of the S3 bucket where the templates will be stored.

Common Use Cases

  • Automated CloudFormation Deployment: This component is ideal for automating the deployment of AWS infrastructure using CloudFormation templates. It runs directly within your GitLab pipeline, ensuring that infrastructure is deployed consistently.
  • Stack Updates: You can easily update existing CloudFormation stacks with this component, reducing the need for manual input.
  • Cleanup: When you need to clean up resources, the component can delete CloudFormation stacks, removing associated AWS resources in the process.

Conclusion

This component simplifies CloudFormation management in CI/CD workflows. It automates the creation, updating, and deletion of CloudFormation stacks, integrates with S3 for template storage, and provides flexible options for logging and monitoring.