Ad
How To Get The Last Access Date Of Any Resource In A Bucket In Amazon S3 In Node.js?
I am trying to get the last access date of a resource in a bucket. But not able find anything related to it. I tried to fetch all the access logs for a bucket and parsed the logs files to check if a resource is accessed.
This is a very complex approach. In the
s3.listObjects
I am getting the below object:-
{ Key: '_636579271588176973_951622.json',
LastModified: 2018-08-02T08:31:29.000Z,
ETag: '"c348574fabf83d603984a60983add161"',
Size: 32172,
StorageClass: 'STANDARD',
Owner: [Object] },
Ad
Answer
S3 is merely an object storage solution from AWS and so doesn't hold information like file access time, etc.
As always there are workarounds to achieve this,
- You may setup CloudTrail to get last access date to a resource based on resource type. Read more here.
- You may make use of Server Access Logging on your bucket, and parse the logs to extract your last access date for the object. Read more here.
Ad
source: stackoverflow.com
Related Questions
- → Maximum call stack exceeded when instantiating class inside of a module
- → Browserify api: how to pass advanced option to script
- → Node.js Passing object from server.js to external modules?
- → gulp-rename makes copies, but does not replace
- → requiring RX.js in node.js
- → Remove an ObjectId from an array of objectId
- → Can not connect to Redis
- → React: How to publish page on server using React-starter-kit
- → Express - better pattern for passing data between middleware functions
- → Can't get plotly + node.js to stream data coming through POST requests
- → IsGenerator implementation
- → Async/Await not waiting
- → (Socket.io on nodejs) Updating div with mysql data stops without showing error
Ad