Articles → AWS → AWS S3 event notification

AWS S3 event notification






Steps




  1. Create a SNS topic and subscription.
  2. Create a S3 bucket.
  3. Update S3 access policy of SNS topic.
  4. Create an event notification in S3 bucket.
  5. Upload the file.
  6. Email notification.



Create a SNS topic and subscription




Picture showing the new topic created in SNS

Click to Enlarge

Picture showing the subscription created in SNS

Click to Enlarge


Create a S3 bucket




Picture showing the new S3 bucket created in AWS

Click to Enlarge


Update S3 access policy of SNS topic




Picture showing the Access policy tab in S3 bucket

Click to Enlarge



Picture showing specifying the S3 ARN in bucket access policy

Click to Enlarge

{
  "Version": "2008-10-17",
  "Id": "__default_policy_ID",
  "Statement": [
    {
      "Sid": "__default_statement_ID",
      "Effect": "Allow",
      "Principal": {
        "AWS": "*"
      },
      "Action": [
        "SNS:GetTopicAttributes",
        "SNS:SetTopicAttributes",
        "SNS:AddPermission",
        "SNS:RemovePermission",
        "SNS:DeleteTopic",
        "SNS:Subscribe",
        "SNS:ListSubscriptionsByTopic",
        "SNS:Publish"
      ],
      "Resource": "arn:aws:sns:ap-south-1:462618770999:mytopic",
      "Condition": {
        "ArnLike": {
          "aws:SourceArn": "arn:aws:s3:::gyansangrah-bucket"
        }
      }
    }
  ]
}



Create an event notification in S3 bucket




Picture showing the Properties tab of the RDS

Click to Enlarge



Picture showing the Create event notification button for creating the new event notification

Click to Enlarge



Picture showing the screen to specify the event name, event type and destination in the create event notification screen

Click to Enlarge




Upload the file




Picture showing the image upload on the S3 bucket

Click to Enlarge


Email notification




Picture showing the email notification received when a file is uploaded on the S3 bucket

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, January 4, 2022

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250