Configuring SNS Push Notifications on S3 Bucket Events Inside of the AWS Console

45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

In this live AWS environment, you will configure an S3 bucket to trigger AWS Simple Notification Service notifications whenever an object is added to an S3 bucket. This scenario will help you understand how you can architect your application to respond to S3 bucket events using other services such as SNS, AWS, Lambda, and others.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create an S3 Bucket

Create an S3 bucket inside the AWS console:

  1. Navigate to the S3 portion of the console.
  2. Click Create Bucket.
  3. Give your bucket a unique name and continue to create the bucket without adding additional configuration.
Create an SNS Topic

Navigate to the Simple Notification Service portion of the AWS Console and create an SNS Topic:

  1. Go to the SNS dashboard in the AWS Console.
  2. Create an SNS Topic.
  3. (Eventually) edit the topic’s resource policy so that the S3 bucket will be able to send events to that topic.

Ignore any KMS errors – the error won’t impact the Hands-On lab.

Configure the Bucket — Part 1

Setting up events allows us to receive notifications whenever there are events happening in our bucket that we want to be notified about.

Navigate back in the S3 Management Console:

  1. Configure your bucket settings.
  2. Event name: "S3ObjectCreated".

We’ll then receive an error: "Unable to validate the following destination configurations. Permissions on the destination do not allow S3 to publish notifications from this bucket." The reason we got this is because we haven’t yet configured our SNS topic policy to accept notification events from our S3 bucket. Let’s do that now.

Modify the SNS Topic Policy

Navigate to Simple Notifications Services Console.

Add the following code:

{
        "Effect": "Allow",
        "Principal": {
            "AWS": "*"
    },
        "Action": "SNS:Publish",
        "Resource": "SNS_ARN_REPLACE_ME",
        "Condition": {
            "StringEquals": {
                "aws:SourceArn": "S3_BUCKET_ARN_REPLACE_ME"
            }
        }
    },

In the SNS:Publish section, where it says, SNS_ARN_REPLACE_ME, paste in the SNS topic you added to that text file or note a minute ago. Then, copy and paste your S3 bucket ARN where it says S3_BUCKET_ARN_REPLACE_ME.

Make sure to leave the comma after the last bracket in our new statement, as this allows us to have more than one statement for this SNS topic’s policy.

Create the Bucket – Part 2

Navigate back in the S3 Management Console.

  1. Configure bucket settings again.

This time, we should see we now have one active notification.

Create the Email Subscription and Create the SMS Subscription

Create the Email Subscription

  1. Navigate to Simple Notification Service.
  2. Configure email settings.
  3. Accept confirmation AWS email from inbox.
  4. If successful, subscription confirmation page will appear.

Create the SMS Subscription

  1. Navigate to SNS Topics.
  2. Select S3Events.
  3. Insert "HELLO" under Subject-optional.
  4. Insert "This is a test message" under Message body.
  5. Save changes.
  6. If successful, Amazon S3 Notification email sent to your inbox.

Additional Resources

Make sure you are in us-east-1 (Northern Virginia) for this activity.

Note: Please delete your email in the SNS section before closing the lab.

Code for this environment:

{
        "Effect": "Allow",
        "Principal": {
            "AWS": "*"
    },
        "Action": "SNS:Publish",
        "Resource": "SNS_ARN_REPLACE_ME",
        "Condition": {
            "StringEquals": {
                "aws:SourceArn": "S3_BUCKET_ARN_REPLACEME"
            }
        }
    },

Important - the SNS console may look slightly different than on the video

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!