Get the latest AWS service and feature announcements delivered directly into the Slack channel of your choice.
All of this is powered by a simple Lambda function and a DynamoDB table to maintain a history of what was already sent:
You'll need to create a Slack app in your workspace first. If you don't know how, ask your Slack administrator for help.
Once you have the app created, you'll need to activate incoming webhooks. Once activated, grab the incoming webhook URL and save it for later.
Since these URL(s) contain sensitive information, you should store them in AWS Secrets Manager with encryption.
First, come up with a sensible name for this secret within AWS Secrets Manager. As a best practice, use a naming scheme that uses a hierarchy so you can easily restrict access by their ARNs. Once you have a name, export it into your environment as we'll reference it a few times:
export SLACK_WEBHOOK_SECRET_NAME=your/path/to/slack/webhooks
Now run the following to create and store the secret:
# Write a file locally with the URLs in this format
cat > secret.json
{
"urls": [
"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"
]
}
# Store this in AWS Secrets Manager
aws secretsmanager create-secret \
--name ${SLACK_WEBHOOK_SECRET_NAME} \
--description "The Slack Webhook URL(s) for the AWS New Releases Slack app" \
--secret-string file://secret.json
--tags Key=Project,Value="AWS New Releases Chatbot"
# Overwrite + delete the file
shred -u secret.json
# OS X users can use 'rm -P secret.json'
This will use the default KMS key for encryption. If you wish to use your own key, you'll need to make sure the Lambda execution role has access to use this key as well.
This application was built with the AWS CDK. You'll need to install the AWS CDK Toolkit before moving on.
Now that you have a Slack app configured and the AWS CDK Toolkit installed, you'll need to deploy this application into your AWS account. Clone this project, cd
into the project directory and run:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Deploy the application and enjoy!
cdk deploy aws-newrelease-slack-dev -c slack_webhook_secret_name=${SLACK_WEBHOOK_SECRET_NAME}
If you'd like to have a production environment, create a production version of the Slack webhooks in AWS Secrets Manager, then run:
cdk deploy aws-newrelease-slack-prod -c slack_webhook_secret_name=your/prod/webhooks-name