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