How to change file upload date in Amazon S3 using AWS CLI

Question:

I need to move some files (thousands) to Amazon S3 bucket, from where they will be displayed to the end-user by another application (instead of the current one).

Problem is, that these files have creation/upload date now (dates very between 2012 and 2017, when they were uploaded to current application), and when I move them they all start to be of the same date. That is a problem because when you look at the files in the new application, you don’t understand the time hierarchy which is sometimes very important.

Is there any way I can modify upload date of a file(s) in S3?

Answer:

The Last Modification Date is generated by Amazon S3 and cannot be set via the API.

If dates and other information (eg user) are important to your application, you can store it as metadata on the object. Then, retrieve the metadata when displaying dates, user, etc.

Leave a Reply