Recently, I was cleaning up unused resources on one of our client’s AWS networks, which requires high attention to detail. Like anything you ever “hit delete” on, no matter how many times you do it or even consider yourself an expert, it can still be nerve-wracking. After several days of monitoring, and several sets of eyes confirming zero use, the day came for me to delete unused Virtual Private Clouds (VPCs), subnets, security groups, peering connections, and more.

Cue “DELETE.”

Almost immediately after the deletes were completed, the client started reporting strange network behavior.

I’m going to cut to the chase – it wasn’t the deletes. AWS had network issues in the client’s primary region, while I was performing the work. It took me 20 minutes to discover that, though, and I had several near-heart attacks during that time.

This process would have gone more smoothly, or even been delayed until a better time, had I thought to check the AWS Health Dashboard before starting this process. I didn’t, though, and I realized I very rarely do.

My misfortune is now your “lesson learned,” because I wouldn’t wish that experience on any cloud professional. So, now I deliver Health Checks to our team Slack so we all work smarter.

What follows are the results of several hours of web searching and several rejections of solutions that I deemed “too complicated.” I’m all about simplicity, if possible, which is why I’m providing just two steps!

Step 1: Prepare the Slack connection

The first thing you’ll need is a Slack channel for your status updates. I highly recommend a channel dedicated to the updates, rather than using one that tends to see a lot of chatter.

An admin will need to perform the next step. You need a webhook. As of September 21, 2023, Slack has partially rolled out a new interface. I’ll be focusing on the new interface for this tutorial and assuming admin access.

Admin, look for the “Manage apps” option:

Look for the Manage apps option

This will open a browser window, where you will look for the “Build” option.

Look for the “Build” option

“Create New App” opens a pop-up where you’ll select “From scratch.”

Create New App opens a pop-up where you’ll select From scratch Create New App opens a pop-up where you’ll select From scratch

Next, you’ll select the appropriate Slack space for it, and you’ll name your new app.

Select the appropriate Slack space

On the Basic Information page, look for “Incoming Webhooks.”

Look for “Incoming Webhooks”

This will open a new section where you will “Add New Webhook to Workspace.”

“Add New Webhook to Workspace”

On the next page, you will select the Slack channel you created for notifications and allow access.

Select the Slack channel you created for notifications and allow access

Now, you’ll see your brand new webhook for posting to your Slack channel! Keep this handy. You’re going to need this URL for the AWS portion of the tutorial.

You’ll see your brand new webhook for posting to your Slack channel

Step 2: Connect AWS to Slack

I’m going to assume existing accounts and a basic working knowledge of AWS. Although the stack creation is automated through CloudFormation, we will be looking at the resulting Lambda application and changing (depending on your alerting preferences) the resulting EventBridge.

We start at the Github repo for AWS Health Tools. There are a lot of great notifiers here, so if you’re using something other than Slack, take a look and see if yours already exists. For this tutorial, we’re going straight to the notifier for Slack.

They’ve made this so easy by providing a deploy button! You don’t even need to clone the repo. If you’re not already logged into your AWS account, you’ll need to log in, now.

They've provided a deploy button

This brings up a prefilled “Create Stack” page. You’ll notice the CloudFormation template is already uploaded to an S3 bucket, so you don’t even need to upload the YAML file from the repo. Like I said, easy!

“Create Stack” page

Name your stack something unique but identifiable. I used “AWSHealthSlackNotifier,” just to be 100% clear about what I’d created. This is also where you’re going to use the URL for the webhook you created in the Slack portion of this tutorial. Paste that and the channel name (without the #).

Name your stack something unique but identifiable

Nothing else in the rest of the stack creation is required. Feel free to adjust to your needs, of course. If you don’t specify things like an IAM role, one will be created.

On the last page, acknowledge that an IAM role might be created or you won’t be able to submit.

Acknowledge that an IAM role might be created

If you’re satisfied with receiving all the possible alerts, this is the end of the tutorial for you.

And if you are not…here’s a bonus tip!

I had a category that I didn’t want going to Slack, so I’ll show you how to exclude those.

Take a look at the Event Log tab on your personal health dashboard to see the most recent alerts you’ve received. In my case, I wanted everything except “Notifications”, so I updated the EventBridge rule. You can go straight to the EventBridge page and search under “Rules.” I actually prefer to get there through the Lambda page, just to make sure I’m looking at the right thing.

Search for your new Lambda under Applications:

Search for your new Lambda under Applications

Scroll down to the Resources section and click on the CloudWatchEventRule.

Resources section and click on the CloudWatchEventRule

By default, your event rule will process everything from aws.health. Edit the rule.

Your event rule will process everything from aws.health

Change your event rule to exclude everything but notifications. Visit EventBridge Rule Patterns for more information on how to customize your new rule. Visit Data Types under AWS Health API for more types you can add to your query.

{
"source": ["aws.health"],
"detail": {
"eventTypeCategory": [{
"anything-but": ["accountNotification"] }] }
}

source_aws.health

Click “Next” through to the “Review and Update” page, then click “Update rule.”

Click “Next” through to the “Review and Update” page, then click “Update rule.”

That’s it! You’ve created an EventBridge event that kicks off a Lambda that reports personalized AWS Health events to a status channel in your Slack. Nice work!