Skip to content

Notifies in Slack when dynamoDB table autoscaling takes place

License

Notifications You must be signed in to change notification settings

Signiant/dynamodb-autoscaling-to-slack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dynamodb-autoscaling-to-slack

Notifies in Slack when dynamoDB table autoscaling takes place

Build Status

Purpose

DynamoDB native autoscaling is fantastic but what happens if you want to see when it's actually scaling tables? This project will use a lambda function to notify a slack channel when a table or index is autoscaled (up or down)

Sample Output

Sample Slack Posts

Installing and Configuring

Slack Setup

Before installing anything to AWS, you will need to a "bot" in Slack to handle the posting for you. You need an API token for this bot and provide it in the CloudFormation setup parameters.

The old method, which is now deprecated;

  • In Slack, choose Manage Apps -> Custom Integrations -> Bots
    • Add a new bot configuration
    • username: dynamodb-notifier
    • Copy the API Token.
    • Don't worry about other parameters - the notifier over-rides them anyway

Current working method;

  • Generate a legacy API Token (scroll down to "Legacy token generator", you may need to be logged in to slack workspace account)

Optionally install the DDB custom emoji;

  • In Slack, upload a custom emoji and name it :dynamodb-autoscaling:
    • You can use any image here...one is provided in the emoji folder of this project also

AWS Setup

You must have Cloudtrail enabled in your AWS account for this solution to work. It uses a Cloudwatch rule triggered on a Cloudtrail event to capture the UpdateTable calls made by autoscaling (when setting up the trail, ensure it is monitoring "Write" Management Events)

  • Grab the latest Lambda function zip from Releases
  • Create a new cloudformation stack using the template in the cfn folder

The stack asks for the function zip file location in S3, the slack API Key and the slack channel to post notifications to. Once the stack is created, a cloudwatch event is created to subscribe the lambda function to the UpdateTable dynamodb call when it comes from application-autoscaling.amazonaws.com.