Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

(cloudwatch): Alarm on CloudFront metrics even if the stack is not in us-east-1 #30483

Closed
2 tasks
mariotsi opened this issue Jun 7, 2024 · 3 comments
Closed
2 tasks
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch duplicate This issue is a duplicate. feature-request A feature should be added or improved.

Comments

@mariotsi
Copy link

mariotsi commented Jun 7, 2024

Describe the feature

Hoping that #16351 is outdated. I would like to create Alarms on metics in other regions.

Use Case

I've a CloudFormation stack in us-west-2 and I would like to alarm on a CloudFront's 4xxErrorRate and other metrics. AFAIK being CloufFront Global it emits metrics in us-east-1.

When on the Metric I specify region = us-east-1 it fails with
Error: Cannot create an Alarm in region 'us-west-2' based on metric '5xxErrorRate' in 'us-east-1'

I don't see a way of alarming on my CF distribution with the current setup. I've the same issue with e Route53 Health Check

Proposed Solution

No response

Other Information

Alarm configuration

new Alarm(scope, id, {
      alarmName: `AlarmName`,
      alarmDescription: `Alarm  errors by CloudFront for the * website`,
      metric: new Metric({
        region: 'us-east-1',
        metricName: `4xxErrorRate`
        namespace: 'AWS/CloudFront',
        statistic: Stats.AVERAGE,
        period: Duration.minutes(1),
        dimensionsMap: {
          DistributionId: cfDistribution.attrId,
          Region: 'Global'
        }
      }),
      comparisonOperator: ComparisonOperator.GREATER_THAN_THRESHOLD,
      threshold: 5,
      evaluationPeriods: 10,
      treatMissingData: TreatMissingData.NOT_BREACHING
    })

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.143.0

Environment details (OS name and version, etc.)

MacOs 14.4.1

@mariotsi mariotsi added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2024
@github-actions github-actions bot added the @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch label Jun 7, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 7, 2024
@khushail
Copy link
Contributor

khushail commented Jun 7, 2024

Hi @mariotsi , thanks for reaching out.

As mentioned in the cloudwatch docs, cross-region functionality is not supported by Cloudwatch alarms, so CDK can't do anything unless cloudwatch supports it.

Cross-Region functionality is not supported for alarms, so you can't create an alarm in one Region that watches a metric in a different Region.

@khushail khushail closed this as completed Jun 7, 2024
Copy link

github-actions bot commented Jun 7, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@khushail khushail added duplicate This issue is a duplicate. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jun 7, 2024
@aws-cdk-automation
Copy link
Collaborator

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.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch duplicate This issue is a duplicate. feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants