How to configure CI/CD Slack notifications?
To configure CI/CD Slack notifications, you need to create a new AWS Chatbot client that connects to your Slack organization as an app. Unfortunately, notifications need to be configured using the AWS web panel.
Create a new AWS Chatbot Client
The very first thing we need to do is to create an AWS Chatbot client that is going to be connected to your Slack organisation as an app.
To create a new AWS Chatbot client, follow these steps:
Open the "AWS Chatbot" service
Press "Configure new client" button
Select "Slack"
Follow through the OAuth process
You should be able to see your client with a Workspace ID matching your organization.
Create a new channel
Next, select a channel to which the AWS Chatbot will post the messages from your CI/CD. Follow these steps:
Press the "Create new channel" button
Fill out the fields:
Name – whatever value, it can be for example:
{project-name}-ci
Channel type:
Public – select channel from the list
Private – paste the ID from the channel URL ( you can copy it from Slack)
Permissions – Create a new IAM role using a template
- Channel guardrail policies – Choose
AWSDenyAll
.
- Channel guardrail policies – Choose
SNS Topic – leave empty. It'll be created for us.
Connect the AWS Chatbot to CodePipeline
The last thing to do is to connect the created AWS Chatbot channel and our pipeline in CodePipeline.
You need to follow this step for every environment of your app.
- Fill out the name and choose a detail type
- Select the triggers that should lead to a notification. On the screenshot you can see the triggers that work well for us.
- Choose the target type as "AWS Chatbot" and the target should be the channel you created in the previous step.
That's it! You should be able to receive Slack notifications during next run of your pipeline.