(cloudwatch): add validation for metric id field on CfnAlarm #26674
Labels
@aws-cdk/aws-cloudwatch
Related to Amazon CloudWatch
feature-request
A feature should be added or improved.
Describe the feature
When creating alarms via the L1 construct, it's possible to create an alarm which is totally valid according to CDK but fails to deploy with a cryptic error as follows:
Invalid metrics list (Service: AmazonCloudWatch; Status Code: 400; Error Code: ValidationError; Request ID: 980ecb87-eb02-4eb8-80f3-dfe53d25f442; Proxy: null)
This is caused by metric Ids failing validation (see CloudFormation docs here)
It would be great if CDK validated this field and caught bad IDs up front.
Example CDK code which causes this kind of deployment error:
Use Case
Better developer experience when creating alarms
Proposed Solution
Add validation in CDK
Other Information
No response
Acknowledgements
CDK version used
2.87.0
Environment details (OS name and version, etc.)
Mac OS
The text was updated successfully, but these errors were encountered: