nragusa / aws-newrelease-slack

An AWS CDK application that sends AWS new service and feature release announcements to a Slack channel of your choice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS New Releases to Slack

Get the latest AWS service and feature announcements delivered directly into the Slack channel of your choice.

Example Screenshot

All of this is powered by a simple Lambda function and a DynamoDB table to maintain a history of what was already sent:

Architecture

Pre-Reqs

Slack App

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.

Add Slack WebhookURLs to Secrets Manager

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.

AWS CDK

This application was built with the AWS CDK. You'll need to install the AWS CDK Toolkit before moving on.

Installation

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

About

An AWS CDK application that sends AWS new service and feature release announcements to a Slack channel of your choice


Languages

Language:Python 97.5%Language:Batchfile 2.5%