How to Receive S3 notifications in a Slack Channel

February 5, 2023 3 min read
Jay Ding
blog image

One of the most common scenarios when working with Amazon S3 is to perform specific actions whenever changes (e.g., file uploaded or file deleted) happen in the S3 buckets.

This article shows how to automatically get notified in a Slack channel whenever changes happen in your S3 buckets.

To achieve that, we need one program to receive S3 events and transform them into custom notifications and we also need another program to receive transformed notifications and send them to our Slack channel.

Luckily, Vanus has already provided many out-of-the-box Connectors that enable you to integrate with popular services or applications without writing any codes.

Here is how we can do this within 5 mins.

  1. Go to Vanus Playground (an online K8s playground).

  2. Click “Continue with GitHub” to prepare an interactive K8s environment(Use your GitHub account to sign in).


  1. Wait for preparing the K8s environment (usually less than 1 min). The terminal is ready when you see something like this:


  1. Install Vanus.
kubectl apply -f
  1. Install vsctl (the command line tool).
curl -O
chmod ug+x vsctl
mv vsctl /usr/local/bin
  1. Set the endpoint for vsctl.
  1. Create an Eventbus to store your events.
vsctl eventbus create --name s3-slack-scenario
  1. Set the config file for the S3 Source.
mkdir -p s3-slack-scenario/s3-source;
mkdir -p s3-slack-scenario/slack-sink;
cd s3-slack-scenario/s3-source;

cat << EOF > config.yml
  secret_access_key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
s3_bucket_arn: "arn:aws:s3:::<buckeName>"
s3_events: ["s3:ObjectCreated:*","s3:ObjectRemoved:*"]
region: "us-west-2"

NOTE: Remember to replace values of access_key_id, secret_access_key, s3_bucket_arn and region with yours. You also need to ensure the IAM user behind the access_key_id and secret_access_key have certain permissions to allow S3 Source work properly.

  1. Run the S3 Source.
nohup docker run --rm --network=host \
  -v ${PWD}:/vanus-connect/config \
  --name source-aws-s3 > s3.log &
  1. Create a Slack app.

Create a new app on Slack.


  1. Select from scratch to create an app .


  1. Pick a workspace to develop your app in.


  1. Click on permissions in the central menu.


  1. Click Add an Oauth Scope and add chat:write and chat:write.public to the scope.


  1. Install this oauth token to your workspace:


  1. Copy the Bot User OAuth for later usage.


  1. Get the slack-sink yaml file and edit the configuration in it.
cd ../slack-sink;
curl -O

vi slack-sink.yaml

NOTE: Remember to replace values of default, app_name, token and default_channel with yours.

The token value should be the Bot User OAuth in previous step.

The default and app name MUST be the same.

  1. Run the Slack Sink.
kubectl apply -f slack-sink.yaml
  1. Create a subscription
vsctl subscription create --name s3-slack-subscription \
  --eventbus s3-slack-scenario \
  --sink 'http://sink-slack:8080' \
  --filters '[
      "exact": {
  ]' \
  --transformer '{
      "define": {
        "subject" : "$.subject",
        "bucket": "$"
      "template": "{\"subject\": \"AWS S3 Notifications\",\"message\":\"Hello, a new file <subject> has been uploaded to your bucket <bucket>.\"}"
  1. Upload a file to your bucket.


  1. Finally, you can see a notification in your Slack channel.


Now, you’ve successfully received S3 notifications in your Slack channel. Actually, you can integrate with any external services with Vanus and its’ filter and transformer. Learn more about Vanus here.

Vanus is an open-source, cloud-native, Serverless message queue for building EDA applications with Ease.

Try it and have fun with Vanus, guys.