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

[billing] MonitorBilling - addTotalCostAnomalyAlarm Fails to Deploy Stack #332

Open
zqumei0 opened this issue Feb 27, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@zqumei0
Copy link
Contributor

zqumei0 commented Feb 27, 2023

Version

6.2.4

Steps and/or minimal code example to reproduce

Create a monitoring facade and then execute monitorBilling() with addTotalCostAnomalyAlarm

export interface MonitoringStackProps {
  readonly stackName: string
}

export class MonitoringStack extends Stack {
  readonly monitoringFacade: MonitoringFacade
  readonly props: MonitoringStackProps

  constructor(scope: App, id: string, props: MonitoringStackProps) {
    super(scope, id, props)
    this.props = props

    this.monitoringFacade = this.createMonitoringFacade()
  }

  private createMonitoringFacade() : MonitoringFacade {
    return new MonitoringFacade(this, `CdkMonitoringTestApp-MonitoringFacade`, {
      alarmFactoryDefaults: {
        actionsEnabled: false,
        alarmNamePrefix: `CdkMonitoringTestAppAlarm`
      },
      dashboardFactory: new DefaultDashboardFactory(this, `CdkMonitoringTestApp-DashboardFactory`, {
        createAlarmDashboard: true,
        createDashboard: true,
        createSummaryDashboard: true,
        dashboardNamePrefix: `CdkMonitoringTestApp-DashboardFactory`
      })
    })
  }

  public monitorAccountBilling() : void {
    this.monitoringFacade.monitorBilling({
      addToAlarmDashboard: true,
      addToDetailDashboard: true,
      addToSummaryDashboard: true,
      addTotalCostAnomalyAlarm: {
        Warning: {
          alarmWhenAboveTheBand: true,
          alarmWhenBelowTheBand: true,
          standardDeviationForAlarm: 0.5,
        }
      }
    })
  }

Expected behavior

This should create a dashboard on billing and an alarm to detect anomaly on total cost

Actual behavior

A runtime error during a cdk deploy that leads to the error below:

8:54:06 PM | CREATE_FAILED        | AWS::CloudWatch::Alarm     | CdkMonitoringTestA...alyWarning970F670F
ComparisonOperators for ranges require ThresholdMetricId to be set (Service: AmazonCloudWatch; Status Code: 400; Error Code: ValidationError; Request ID: 678402c0-da06-4c56-a222-295dbe54bf74; Proxy: null)

Stack Deployments Failed: Error: The stack named CdkMonitoringTestApp-MonitoringStack failed to deploy: UPDATE_ROLLBACK_COMPLETE: ComparisonOperators for ranges require ThresholdMetricId to be set (Service: AmazonCloudWatch; Status Code: 400; Error Code: ValidationError; Request ID: 678402c0-da06-4c56-a222-295dbe54bf74; Proxy: null)

Other details

This may be related to this issue:
aws/aws-cdk#10540

@zqumei0 zqumei0 added the bug Something isn't working label Feb 27, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant