-
Notifications
You must be signed in to change notification settings - Fork 4k
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-cdk-lib/aws-cloudwatch: Tags don't attach to CloudWatch alarms #29759
Comments
It's officially in the cloud formation release notes now as well https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html |
Thanks @BerradaYassine for requesting this. Thanks @bdoyle0182 for sharing the link. |
@khushail "@aws-cdk/aws-service-spec": "^0.0.63", |
Wonderful, thanks for the quick turnaround |
Great hint, @Konosh93 / @bdoyle0182 - Now, it becomes less magic ;)
Now, we just need to wait for the next CDK release, which cover/include this PR. :) |
Closing this issue as the feature request for tags now exist in L1 Construct for Cloudwatch alarms. |
|
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the bug
#25489 (comment)
Similarly to the closed issue above, I would like to add tags to Cloudwatch alarm through CDK. Recently AWS added support for cloud formation to add tags to Cloudwatch alarm
Expected Behavior
Tags can be added to the resource and verified on the AWS console.
Current Behavior
The tags don't attach to the resource.
Reproduction Steps
import * as cdk from 'aws-cdk-lib';
import * as sns from 'aws-cdk-lib/aws-sns';
import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';
import { Construct } from 'constructs';
export class MyStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const topic = new sns.Topic(this, 'Topic', {
displayName: 'My SNS topic',
});
const _alarm = new cloudwatch.Alarm(this, 'Alarm', {
metric: topic.metricNumberOfMessagesPublished(),
threshold: 10,
evaluationPeriods: 1,
alarmName: 'My SNS alarm',
alarmDescription: 'Triggered when message count exceeds 10',
comparisonOperator:
cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
});
}
}
and then
import * as cdk from 'aws-cdk-lib';
const env = {
account: process.env.AWS_ACCOUNT_ID,
region: process.env.AWS_REGION,
};
const app = new cdk.App();
new MyStack(app, 'stack', {
env,
tags: {
testTag: 'testValue',
},
});
cdk.Tags.of(app).add('testTag', 'testValue');
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.136.0
Framework Version
No response
Node.js Version
v16.18.1
OS
14.4.1
Language
TypeScript
Language Version
4.8.4
Other information
No response
The text was updated successfully, but these errors were encountered: