8
votes

How to export existing, configured and tested AWS CloudWatch alarms to Cloudformation template?

I know about CloudFormer tool, but it supports limited number of AWS services (Amazon VPC, DynamoDB, etc) and don't supports some of services which we use. Which tools and approaches can I use in my case for generating Cloudformation template?

2
You can use the CLI to describe your alarms; the format is json but it is a 90% match to the Cloudformation template.George Rushby
@GeorgeRushby thank you, but my question is about how to export existing CW alarms, not describe them in the template manually.Gleb

2 Answers

2
votes

AWS have recently announced the ability to create a new CloudFormation stack using existing resources or update an existing CloudFormation stack with imported resources. The announcement came via the AWS blog.

The CloudFormation documentation has been updated and includes supported resources (CloudWatch Alarms, VPC and DynamoDB Tables are all supported).

2
votes

You can do it for already existed alarm by the following steps:

  1. Go to the alarm definition in AWS console
  2. From Action (top right) menu select "View Source"
  3. In the bottom of popup dialog with alarm's sources select "CloudFormation YAML" or "CloudFormation JSON"