aws / aws-greengrass-core-sdk-js

Greengrass Nodejs SDK
https://aws.github.io/aws-greengrass-core-sdk-js/
Apache License 2.0
19 stars 18 forks source link

Feature Request: Allow Specification of Object Tags when Creating S3 Export Task for Stream Manager #18

Open lummish opened 3 years ago

lummish commented 3 years ago

Description

Currently, a user is unable to directly specify tags for an object created using an S3 Export Task and Stream Manager.

Initially, I suspected it might be possible to specify tags as user metadata by specifying the key of the metadata attribute as "x-amz-tagging," however this does not appear to be the case; from AWS support:

While testing, I did actually attempt to use the "x-amz-tagging" key in the User Metadata while using the regular JS SDK. What ended up happening was that the object had the User Metadata added with the key "x-amz-meta-x-amz-tagging". Based on this I believe you would likely expect the same behaviour from the Greengrass SDK.

I wanted to try to confirm this by checking the Greengrass SDK Source available on Github here. In the S3 example code on line 71 here, you can find the task definition for the S3 Export being created. It is then sent using the StreamManagerClient on line 77, after being validated and serialized to JSON Bytes. I checked through this code and found that the local validation for the User Metadata is not altering the data at all. My conclusion then is that the altering of the Key is being performed at the other end of the connection.

Ultimately I'm not sure if this feature request belongs with the SDK, but I'm also unsure how I would go about creating a feature request for the closed source core/stream manager implementation.

For now, the following two workarounds have been recommended by AWS support:

  1. Add the desired tags to the export task as user metadata and use an S3 event notification to trigger a lambda reads the object's metadata then applies it as tags.
  2. Monitor status messages for the S3 tasks on the Greengrass core and generate the "Put Object Tagging" request when a status message is received indicating a successful upload.

These are reasonably simple workarounds, however it seems that in either case the user is forced to deploy some additional logic just to add tags to S3 Objects. This seems unnecessarily complicated to me.

Instead, users should be able to specify the tags for their object at the time of export task creation using the Greengrass/Stream Manager SDK.

sushantAtAws commented 3 years ago

Hi Lummis, I have put this request in our backlog. Thanks for bringing this up.