Created
October 19, 2016 19:47
-
-
Save korya/3d7ef6d37f71d56fa8a74aad7e6f8ba0 to your computer and use it in GitHub Desktop.
S3: read latest version of removed object
This file contains hidden or 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
getLatestVersion() { | |
local path="$1" | |
aws s3api list-object-versions --output json --bucket iguides.plntr.ca --prefix "$path" | jq '.Versions[0].VersionId' -r | |
} | |
filename=[remove-file-name] | |
path="ig8OKNNO6IIPDD1/gallery/${filename}" | |
versionId="$(getLatestVersion "$path")" | |
echo "filename: $filename" | |
echo "path: $path" | |
echo "version-id: $versionId" | |
aws s3api get-object --bucket iguides.plntr.ca --key "$path" --version-id "$versionId" "$filename" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment