feat(cloudwatch): EC2 actions#13281
Conversation
|
Title does not follow the guidelines of Conventional Commits. Please adjust title before merge. |
Pull request has been modified.
rix0rrr
left a comment
There was a problem hiding this comment.
Almost there, thanks for the work!
| this.alarmActionArns.push(...actions.map(a => { | ||
| const actionArn = a.bind(this, this).alarmActionArn; | ||
|
|
||
| const ec2ActionsRegexp: RegExp = /arn:aws:automate:[a-z|\d|-]+:ec2:[a-z]+/; |
There was a problem hiding this comment.
I don't mind this functionality living here, but could you factor it out into a separate (private) function?
| // Check per-instance metric | ||
| const metricConfig = this.metric.toMetricConfig(); | ||
| if (metricConfig.metricStat?.dimensions?.length != 1 || metricConfig.metricStat?.dimensions![0].name != 'InstanceId') { | ||
| throw new Error('EC2 alarm actions must use an EC2 Per-Instance Metric'); |
There was a problem hiding this comment.
The error message should show the incorrect configuration.
How about:
`EC2 alarm actions requires an EC2 Per-Instance Metric (${JSON.stringify(metricConfig)} does not have an 'InstanceId' dimension)`
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Fixes aws#13228 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Fixes #13228
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license