使用CloudFormation创建新的DynamoDB表时禁用/防止CloudWatch警报

时间:2018-07-03 16:24:19

标签: amazon-dynamodb amazon-cloudformation amazon-cloudwatch

我有几个通过CloudFormation创建的非扩展DynamoDB表。每个表都会自动创建CloudWatch警报(每个GSI还会创建更多警报)。在PROD中这是可以的,但在DEV中这会增加成本。例如,对于具有GSI的action表,我创建了以下警报:

action-ReadCapacityUnitsLimit-BasicAlarm
action-WriteCapacityUnitsLimit-BasicAlarm
action-siteId-lastCaptured-index-ReadCapacityUnitsLimit-BasicAlarm
action-siteId-lastCaptured-index-WriteCapacityUnitsLimit-BasicAlarm

每个表的CF模板都很简单。例如:

tableuser:
  Type: 'AWS::DynamoDB::Table'
  DependsOn: tablepage
  Properties:
    TableName: user
    AttributeDefinitions:
      - AttributeName: id
        AttributeType: S
    KeySchema:
      - AttributeName: id
        KeyType: HASH
    PointInTimeRecoverySpecification:
      PointInTimeRecoveryEnabled: true
    ProvisionedThroughput:
      ReadCapacityUnits:
        Ref: 5
      WriteCapacityUnits:
        Ref: 5

如何为CloudFormation创建的DynamoDB表禁用CloudWatch警报?当然,我更愿意通过CloudFormation模板本身来执行此操作,但是由于我没有指定其创建方式,因此不确定是否可行?

1 个答案:

答案 0 :(得分:1)

如果您选择按需容量(https://aws.amazon.com/dynamodb/pricing/)而不是按需提供,则不会创建警报。

代替

ProvisionedThroughput:
  ReadCapacityUnits:
    Ref: 5
  WriteCapacityUnits:
    Ref: 5

你说

BillingMode: PAY_PER_REQUEST