# # This sample adds an Amazon DynamoDB table with an Amazon CloudWatch throttling alarm to the # AWS Elastic Beanstalk environment. # # To configure the Alarm, you should create a separate configuration file that contains # an option-settings section such as the following (all properties are showing the default values). # # option_settings: # "aws:elasticbeanstalk:customoption": # DDBAlarmEmail: "nobody@amazon.com" # DDBThrottledRequests: "1" # ## Resources: DDBTable: Type: AWS::DynamoDB::Table Properties: KeySchema: HashKeyElement: AttributeName: id AttributeType: S # create a table with the least available rd and wr throughput ProvisionedThroughput: ReadCapacityUnits: 1 WriteCapacityUnits: 1 DDBAlarmTopic: Type: AWS::SNS::Topic Properties: Subscription: - Endpoint: Fn::GetOptionSetting: OptionName: DDBAlarmEmail DefaultValue: "nobody@amazon.com" Protocol: email DDBThrottledRequestsAlarm: Type: AWS::CloudWatch::Alarm Properties: AlarmDescription: { "Fn::Join" : ["", [{ "Ref" : "AWSEBEnvironmentName" }, ": requests are being throttled." ]]} Namespace: AWS/DynamoDB MetricName: ThrottledRequests Dimensions: - Name: TableName Value : { "Ref" : "DDBTable" } Statistic: Sum Period: 300 EvaluationPeriods: 1 Threshold: Fn::GetOptionSetting: OptionName: DDBThrottledRequests DefaultValue: 1 ComparisonOperator: GreaterThanThreshold AlarmActions: - Ref: DDBAlarmTopic InsufficientDataActions: - Ref: DDBAlarmTopic