1 Answer
- Newest
- Most votes
- Most comments
0
Hello there,
To get the latest inventory report from your bucket, you can run any of the below commands for the AWS CLI.
- aws s3api list-objects --bucket $BUCKET --query 'Contents[?LastModified>
2023-02-09
].{ Key: Key, LastModified: LastModified }' --output text | sort -k2 | tail -1 - aws s3api list-objects-v2 --bucket $BUCKET --query 'sort_by(Contents, &LastModified)[-1].Key' --output=text
The first command will display the path of the latest file and also the date and time it was created in the bucket.
Once the file has been located and listed, you can then download it to your local machine with the below command
aws s3 cp s3://bucket-name/filename.txt ./
Hope this helps.
answered 2 years ago
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 months ago