Last active
June 16, 2021 10:26
-
-
Save MrHassanMurtaza/fd116038505bccd81f01a66f2755f1b8 to your computer and use it in GitHub Desktop.
Getting latest s3 bucket's object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
set -e | |
S3_BUCKET="" | |
S3_PREFIX="" | |
OBJECT="$(aws s3 ls s3://$S3_BUCKET/$S3_PREFIX | sort | tail -n 1 | awk '{print $4}')" | |
[ -z "$OBJECT" ] && echo "Object not found in S3 Bucket." && exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment