Explore Courses Blog Tutorials Interview Questions
0 votes
in AWS by (19.1k points)

I need to pass user-metadata when I perform a put action to add new objects to an s3 bucket. After the file is uploaded (object is created), I would like the s3:ObjectCreated:put to pass a notification to a rest api method call for further processing.

I have found doc on how to pass user-metadata to the put operation, but not doc on how to make the sns message contain the user-metadata when sending the message to the rest api method.

Would the sns message automatically contain the user-metadata for the newly created object or would I have to perform some additional configuration to make this happen?


Should I generate a head request like this using node.js:

       let authString: string = "AWS AKIAIOSFODNN7EXAMPLE:02236Q3V0RonhpaBX5sCYVf1bNRuU=";

        var options = {

            host: '',

            path: '/filename.jpg',

            method: 'HEAD',

            headers: { 'Authorization': authString, 'Date': 'Date: Wed, 28 Oct 2009 22:32:00 GMT' }


        var req = https.request(options, function(res) {

            res.on('data', function(d) {




1 Answer

0 votes
by (44.4k points)

Your code that receives the SNS message will need to send a HEAD request to the bucket to fetch the object's metadata. This operation goes under various names similar to getObjectMetadata in the SDKs.

It isn't included in the event notification.

Or you could code a Lambda function to receive the initial event, fetch the metadata, and combine everything into a new notification message structure containing everything you need, and send it back over to SNS or SQS or directly to your API.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories