Created
July 15, 2020 17:46
-
-
Save nuxlli/3fe302567917bd9671a7419349da4efc to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -e | |
bucket_path=$1 | |
bucket_bk_path="$1_$(date +%s)" | |
tmp_file=$(mktemp) | |
# Donwload a temporary file | |
aws s3 cp "${bucket_path}" "${tmp_file}" | |
trap "{ rm -f \"$tmp_file\"; }" EXIT | |
# Edit | |
vim "${tmp_file}" | |
# Backup file before replace | |
aws s3 cp "${bucket_path}" "${bucket_bk_path}" | |
# Replace file | |
aws s3 cp "${tmp_file}" "${bucket_path}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment