Skip to content
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

feat(cloudwatch): EC2 actions #13281

Merged
merged 9 commits into from
Mar 4, 2021

Conversation

cyuste
Copy link
Contributor

@cyuste cyuste commented Feb 25, 2021

Fixes #13228

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link

gitpod-io bot commented Feb 25, 2021

@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Feb 25, 2021
@mergify
Copy link
Contributor

mergify bot commented Feb 25, 2021

Title does not follow the guidelines of Conventional Commits. Please adjust title before merge.

@cyuste cyuste changed the title feat(cw-actions) Add ec2 actions feat(cw-actions): Add ec2 actions Feb 25, 2021
packages/@aws-cdk/aws-cloudwatch-actions/lib/ec2.ts Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-cloudwatch-actions/lib/ec2.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed rix0rrr’s stale review February 25, 2021 22:15

Pull request has been modified.

rix0rrr
rix0rrr previously requested changes Mar 3, 2021
Copy link
Contributor

@rix0rrr rix0rrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]+/;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)`

@mergify mergify bot dismissed rix0rrr’s stale review March 3, 2021 16:11

Pull request has been modified.

@mergify
Copy link
Contributor

mergify bot commented Mar 4, 2021

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).

@rix0rrr rix0rrr added the pr/do-not-merge This PR should not be merged at this time. label Mar 4, 2021
@rix0rrr rix0rrr changed the title feat(cw-actions): Add ec2 actions feat(cloudwatch): EC2 actions Mar 4, 2021
@github-actions github-actions bot added the @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch label Mar 4, 2021
@rix0rrr rix0rrr removed the pr/do-not-merge This PR should not be merged at this time. label Mar 4, 2021
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: d259dc6
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Mar 4, 2021

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).

This was referenced Mar 8, 2021
cornerwings pushed a commit to cornerwings/aws-cdk that referenced this pull request Mar 8, 2021
Fixes aws#13228
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws-cloudwatch-actions: add EC2 actions
4 participants