Step 1 – Create S3 bucket
- Navigate to Amazon S3 dashboard
- Click on Create bucket
- Bucket name: provide a unique name
- Leave everything else as default
- Click on Create bucket
Step 2 – Create SNS Topic
- Navigate to Amazon SNS dashboard
- Click on Topics on the left menu
- Click on Create Topic
- Select Standard
- Topic name: s3topic
- Leave everything else as default
- Click on Create Topic
Step 3 – Modify SNS Access Policy
- Click on Edit on the s3topic screen
- Expand Access Policy
- Select the entire JSON text and delete it
- Paste the following in the JSON editor and click on Save Changes
{
"Version": "2012-10-17",
"Id": "example-ID",
"Statement": [
{
"Sid": "example-statement-ID",
"Effect": "Allow",
"Principal": {
"AWS":"*"
},
"Action": [
"SNS:Publish"
],
"Resource": "<sns-topic-arn>",
"Condition": {
"ArnLike": { "aws:SourceArn": "arn:aws:s3:*:*:<bucketname>" },
"StringEquals": { "aws:SourceAccount": "<your-account-id>" }
}
}
]
}
Note: Your account id can be found on the top right corner. Expand the account name drop down and there should be a 12 or so digit number next to “My Account”
Step 4 – Create Event Notification for S3
- Navigate to Amazon S3 dashboard
- Click on your bucket
- Click on Properties tab
- Scroll down to Event notifications
- Click on Create event notification
- Event name: s3putevent
- Under Event Types, select Put
- Under Destination, select SNS topic
- Select the previously created s3topic from the drop down
- Click on Save changes
Step 5 – Create Subscription to SNS Topic
- Click on Create subscription
- Select the protocol you want to use, for instance, Email or HTTP
- If you chose Email, provide an email you have access to as the Endpoint or if you chose HTTP, provide a web server that can receive SNS notifications
- If you used an email, make sure you confirm subscription. If you used an HTTP endpoint, grab the Subscription URL that pops up in your application server logs and confirm subscription on the SNS console.
Step 6 – Test the integration by uploading a file to S3
- Navigate to Amazon S3 dashboard
- Click on your bucket
- Click on Upload
- You should have received an email!