Yes, using the following commands in the CLI you can get the last modified objects in the bucket:
Listing all the objects in the bucket:
$ aws s3 ls $BUCKET --recursive
Note: The objects in the displayed list will be sorted alphabetically by key. The first column that you will see will be the column of the modified time.
Sorting the objects displayed in the list as per the last modified time:
$ aws s3 ls $BUCKET --recursive | sort
Note: The last row will display the last modified object along with its respective modified time.
To select the last row and extract the name of the object from that row:
$ aws s3 ls $BUCKET --recursive | sort | tail -n 1 | awk '{print $4}'
- 'tail -n' selects the last row
- awk '{print $4}' extracts the 4th column in the last row, which is the name of the object.
To download the extracted object:
$ aws s3 cp s3://$BUCKET/$KEY ./latest-object