【问题标题】:Is there a way to create CloudWatch Billing Alarms for Specific Linked Accounts有没有办法为特定关联账户创建 CloudWatch 账单警报
【发布时间】:2021-02-15 11:14:15
【问题描述】:

我有一个付款人帐户,其中有一个关联帐户,位于“组织 - 合并帐单”中。我想要做的是创建一个 CloudFormation 模板来为每个关联账户创建一个账单警报。原因是,我想要根据帐户类型(例如开发/生产/测试)在不同级别的估计费用警报。

我搜索了 Boto3 文档和 AWS API 文档,但没有提到关联账户指标。不过,我能够从控制台创建它。

https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html

【问题讨论】:

    标签: amazon-cloudformation amazon-cloudwatch


    【解决方案1】:

    我找不到文档,而是使用关联帐户创建了警报,然后我启动了一个 EC2 实例,该实例具有运行 describe-alarms (https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/describe-alarms.html) 的权限。

    这向我返回了一个 JSON,其中显示链接帐户是 CloudWatch::Alarm 的维度属性的一部分。

    下面是一个 CloudFormation sn-p,用于创建特定于该关联帐户的警报。

    CloudWatchAlarm:
        Type: 'AWS::CloudWatch::Alarm'
        Properties:
          AlarmName: !Ref AlarmName
          AlarmDescription: !Join ["", ['CloudWatch Alarm to notify when the estimated charges >= $', !Ref ThresholdAmount, '.']]
          MetricName: EstimatedCharges
          Namespace: AWS/Billing
          Statistic: Maximum
          Period: '21600'
          EvaluationPeriods: '1'
          Threshold: !Ref ThresholdAmount
          ComparisonOperator: GreaterThanOrEqualToThreshold
          AlarmActions:
            - Ref: SNSTopic
          Dimensions:
            - Name: Currency
              Value: USD
            - Name: LinkedAccount
              Value: !Ref LinkedAccountNumber
          InsufficientDataActions:
            - Ref: SNSTopic
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-02
      • 2020-09-10
      • 2018-12-29
      • 1970-01-01
      • 2023-01-23
      • 1970-01-01
      • 2020-11-08
      • 1970-01-01
      相关资源
      最近更新 更多