How to get last modified object from S3 through aws cli
We can list the last modified object from S3 through aws cli using the following command.
#aws s3 ls bucket --recursive | sort | tail -n 1 | awk '{print $4}'
Here we need to replace 'bucket' with the name of the required s3 bucket.
Please note that this command is for getting the latest object only and the list can be increased to any number by increasing the tail command limit.
That's all…