I have a javascript lambda function that is triggered by file upload, reads the content, validates, converts data records contained therein into an array and puts data into a DynamoDB table. When everything is OK, the file (S3 object) is moved to another folder in the same bucket - the function copies the original object to another folder and deletes the original. This action takes some time and generates "unnecessary" data transfer. Is there a possibility to "modify" the object key, effectively moving it?
CodePudding user response:
Amazon S3 does not have a 'rename' or 'modify' function. All objects are immutable and the Key cannot be changed -- it is the unique identifier of the object.
To 'move' an object, the correct process is to CopyObject()
and then DeleteObject()
. This creates a new object with the desired Key.