-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AWS::CloudWatch::Alarm - allow tags #64
Comments
@luiseduardocolon It has been sitting in status "We're working on it" since Jan 11th. Any update for this? My finance dept. is killing me for not being able to filter on tags for our alarms. |
Also hoping this gets implemented soon. We want to set incident priority and urgency based on CloudWatch alarm tags, and not have to configure these separately in another system. |
@luiseduardocolon any updates on this ? |
THIS. It would be so much easier to tag alarms and then create a CloudWatch event rule which forwards alarm state changes to a Lambda which checks the tags and forwards messages.. Thats my plan once tagging is available |
Argh. Just ran into this one. |
Adding my plus-one here. We have so many teams and applications we don't know who to contact about cleaning up their alarms that point to resources that may no longer exist. |
+1 as well - this would be huge for us to be able to fully utilize tags for automating dashboard creation. |
+1 We need cloudwatch alarm tags so we can allow people to tag their alarms with information that's needed for our shared lambda functions. |
Hoping to implement the following in one go: https://aws.amazon.com/about-aws/whats-new/2019/04/you-can-now-use-resource-level-permissions-for-amazon-cloudwatch/ would be nice to deploy tagged cloudwatch alarms via CFN alongside the policy that applies to them. |
using description for tags. so desperate we are. no patience we have. |
Just ran into this one as well :( any ETAs? |
If anyone needs a solution to this before it's supported natively, this is the custom resource Lambda that I'm using: const response = require('cfn-response');
const AWS = require('aws-sdk');
const cloudwatch = new AWS.CloudWatch();
exports.handler = async (event, context) => {
console.log(event);
try {
const tags = event.ResourceProperties.Tags;
const arn = event.ResourceProperties.AlarmArn;
if (!tags || !tags.length || !arn) {
console.error('AlarmArn and Tags properties must be defined');
await response.send(event, context, response.FAILED, {});
}
if (event.RequestType === 'Create') {
// Create all tags on the custom resource
await cloudwatch.tagResource({
ResourceARN: arn,
Tags: tags,
}).promise();
} else if (event.RequestType === 'Update') {
// Remove tags that were present in the old resource properties, but are
// no longer present
const previousTags = event.OldResourceProperties.Tags;
const currentTagKeys = tags.map(t => t.Key);
const staleTags = previousTags.filter(p => !currentTagKeys.includes(p.Key));
if (staleTags.length) {
await cloudwatch.untagResource({
ResourceARN: arn,
TagKeys: staleTags.map(t => t.Key),
}).promise();
}
// Create/update all values present in the current resource properties
await cloudwatch.tagResource({
ResourceARN: arn,
Tags: tags,
}).promise();
} else if (event.RequestType === 'Delete') {
// Remove all tags on the custom resource
await cloudwatch.untagResource({
ResourceARN: arn,
TagKeys: tags.map(t => t.Key),
}).promise();
}
await response.send(event, context, response.SUCCESS, {});
} catch (error) {
console.error(error);
await response.send(event, context, response.FAILED, {});
}
}; Which would work with a custom resource like this: MyAlarmTags:
Type: Custom::CloudWatchAlarmTags
Properties:
ServiceToken: !Ref CloudWatchAlarmTaggerServiceToken
AlarmArn: !GetAtt MyAlarm.Arn
Tags:
- { Key: Severity, Value: Critical }
- { Key: LogGroup, Value: arn:aws:logs:us-east-1:1234567890:log-group:my-service-logs } |
Is there any news about this? please. |
+1 |
+1 |
+1 from 2021! |
+1 |
+1 we needs this |
I remember being at reInvent where AWS were talking about their differentiator being that they were customer obsessed. Waiting 5 years for this does not feel customer obsessed. Please add this soon. |
I just ran into this one as well :( |
Pls |
+1 |
Just for the record: +1 |
Any updates for adding tags to cloudwatch alarms via cloudformation? |
Today, I run the following test via CloudFormation - Spoiler: I was able to add Tags via CFN to Test Cases with Stack-Level-Tags
---
AWSTemplateFormatVersion: '2010-09-09'
Description: CFN Drift detection test for AWS::CloudWatch::Alarm - test for new stack
Resources:
SampleAlarmWithStackTags:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmDescription: We like Alarms with Tags and without Drifts
AlarmName: TestAlarm-rogo
ComparisonOperator: GreaterThanOrEqualToThreshold
MetricName: HTTPCode_Target_5XX_Count
Namespace: AWS/ApplicationELB
EvaluationPeriods: 1
Period: 900
Statistic: Sum
Threshold: 100
Result
Things are moving forward! 🛼🛼 - I guess/hope it's an interim step before |
I also just tested this in AWSTemplateFormatVersion: 2010-09-09
Description: CFN Drift detection test for AWS::CloudWatch::Alarm - test for new stack
Resources:
SampleAlarmWithStackTags:
Type: AWS::CloudWatch::Alarm
Properties:
ComparisonOperator: GreaterThanOrEqualToThreshold
MetricName: RunningInstancesCount
Namespace: AWSLicenseManager/licenseUsage
Dimensions:
- Name: SubscriptionName
Value: "Red Hat Enterprise Linux Server"
EvaluationPeriods: 1
Period: 900
Statistic: Sum
Threshold: 100
Tags:
- Key: Name
Value: Test Thanks a lot to the CloudWatch devs, but for the love of god don't disable it 😂 |
Hi all, |
Thank you so much! |
After 5 years, literally yesterday I finally carved out some time to deployed a custom resource for tagging alarms across our AWS Organization. This is great news, but the timing 😭 |
Oh man, I feel you farski!!! Fantastic it’s being worked on, but I too finally got a working solution up and running today, throttling retries and all 😂 |
So just to confirm what's coming in the next few days will only apply to stack level tags propagating to alarms correctly? Or individual alarm resource tags as well? |
@bdoyle0182 From @r-heimann's message it looks like alarm resource tags are on the way. Let's be patient so @j-schwerer can complete the deployment. We've waited 5 years so 5 more days won't kill us :-) Thanks to the CloudWatch and CloudFormation service teams for listening to the community! |
Hi all, yes indeed individual alarm resource tags are in scope as well. I'm as impatient as you to see this deployment completed. |
Amazing! So happy to see this being added. I asked because I tested this through cdk yesterday and seemed only the stack level tags got applied. However I think it's just a cdk update needed as it's not adding the resource tag to the template output |
Just wanted to let you know that (in
This feels like an awesome, out-of-the-box working implementation. Although I'm only talking about "pure" CloudFormation, not entirely sure what has to be done for CDK support. |
Hi all, many many thanks for the great interaction here. It is my pleasure and privilege to confirm you that you can officially use it now, expect what's new post and doc updates in the coming hours |
Re: @r-heimann 's comment; when should we expect CDK support to roll out? Currently, using best-practices CDK (making use of |
We have also seen an issue where only tags that have new values are being applied to the alarm resources. |
As this is supported we are going to close this issue. We can work on new issues as needed. https://aws.amazon.com/about-aws/whats-new/2024/04/amazon-cloudwatch-tagging-alarms-cloudformation/ |
This should come shortly. CDK works off of the specs/schemas so they will be building out the layer 1 tag support shortly as those files are updated with the tagging property. |
If you are using higher-level constructs (e.g. L2), it needs implementation/a PR: aws/aws-cdk#29759 (👍 would be good as well.) In case you are using L1 in CDK, it should get available soon after CDK L1 CloudFormation resource definitions update as part of an upcoming CDK release. |
(1: And I thought Alarms supported tags from way before Apr 2024) I am creating a CW Alarm with Tags using CloudFormation. It works! However, when the alarm is triggered and sent to the SNS topic, the Tags property does not arrive. I just want to know if this is by design or could it be a missing piece or bug? When I configure the Subscription, I also see a checkbox "Enable raw delivery" but that doesn't seem to make a difference. Hopefully I can get an answer 🤞 |
Hi Kat Lim, thanks for the question. Alarms don't propagate the tags to the notifications. Some customers use a Lambda to create a customized notification, including enriching the notification with a subset of the alarm tags, when they need. As this thread is closed, would it make sense to take future questions that don't fit in CloudFormation roadmap to the AWS repost site? |
1. Title
CloudWatch supports tagging and untagging alarms, and it should be supported in CloudFormation.
2. Scope of request
Allow for tags on create, updating tags, etc.
3. Expected behavior
See 2 above.
4. Test case recommendation
5. Links to existing API doc
API Docs: https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_TagResource.html
6. Category tag
Management
7. Any additional context
The documentation on this feature is sparse.
Existing resource: AWS::CloudWatch::Alarm.
This is supported by Boto: CloudWatch.Client.tag_resource.
The text was updated successfully, but these errors were encountered: