Two different types of integration with slack.
First part integrates an S3 bucket to slack via lambda function. When file is uploaded to an S3 bucket, invokes a lambda function to post message to Slack channel with url included.
Second part sends a message to Slack channel when CPU Utilization of an EC2 instance goes above threshhold.
Creates a new Slack application configured to a specific channel in a workspace. Activate incoming webhooks to allow POST message from external sources (AWS Lambda in this case). In AWS Console, create a lambda function with Python 3.9 and a role that has permissions to CloudWatch logs and S3 (read & write). The policy used in the role is AWSLambdaExecute. In the function code, use urllib3 to send the POST request to the slack channel.
The CloudWatch Alarm pushes an SNS notification that invokes a lambda function as well as pushes message to email. The lambda function takes the json data from SNS and reformats to a structured message and POSTS to the Slack channel via incoming webhooks.