Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exequielrafaela/3294d5c0481cfd751dfa91ca269e67fe to your computer and use it in GitHub Desktop.
Save exequielrafaela/3294d5c0481cfd751dfa91ca269e67fe to your computer and use it in GitHub Desktop.
aws s3api delete-objects from aws s3api list
AWS_SHARED_CREDENTIALS_FILE="/home/user/.aws/test/credentials" \
AWS_CONFIG_FILE="/home/user/.aws/test/config" \
aws s3api delete-objects \
--profile test-shared-devops \
--bucket test-shared-gdrive-backup \
--delete \
"$(AWS_SHARED_CREDENTIALS_FILE="/home/user/.aws/test/credentials" AWS_CONFIG_FILE="/home/user/.aws/test/config" aws s3api list-object-versions \
--profile test-shared-devops \
--bucket test-shared-gdrive-backup | jq '{Objects: [.Versions[] | {Key:.Key, VersionId : .VersionId}], Quiet: false}')"
#
## Shell Console Output
#
# {
# "Deleted": [
# {
# "Key": "Drive_folder_name/Drive_subfolder_name KB/GCP/Architecting with GCP Fundamentals:\nInfrastructure.zip",
# "VersionId": "LVoxxxxxxxxxxxxxxxxxxxxxxxx"
# }
# ]
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment