Skip to content

Instantly share code, notes, and snippets.

@bdmbdsm
Created April 11, 2022 07:01
Show Gist options
  • Save bdmbdsm/585fb1fee38eddc6d3b99f1044703b84 to your computer and use it in GitHub Desktop.
Save bdmbdsm/585fb1fee38eddc6d3b99f1044703b84 to your computer and use it in GitHub Desktop.
FILENAME=file_to_backup.md
VAULT="vault_name"
DESCRIPTION="$(FILENAME) $(shell date --iso-8601=seconds)"
CHECKSUM=$(shell sha256sum $(FILENAME) | head -c 64)
PROFILE="personal" # avoiding default profile
REGION="us-west-2"
backup:
aws glacier upload-archive \
--account-id - \
--vault-name $(VAULT) \
--checksum $(CHECKSUM) \
--archive-description $(DESCRIPTION) \
--region $(REGION) \
--body $(FILENAME) \
--profile $(PROFILE)
inventory_retrieval.json:
aws glacier initiate-job \
--account-id - \
--vault-name $(VAULT) \
--region $(REGION) \
--profile $(PROFILE) \
--job-parameters '{"Type": "inventory-retrieval"}' > inventory_retrieval.json
describe_job.json: inventory_retrieval.json
aws glacier describe-job \
--account-id - \
--vault-name $(VAULT) \
--region $(REGION) \
--profile $(PROFILE) \
--job-id $(shell cat inventory_retrieval.json | jq '.jobId') > describe_job.json
output: describe_job.json
aws glacier get-job-output \
--account-id - \
--vault-name $(VAULT) \
--region $(REGION) \
--profile $(PROFILE) \
--job-id $(shell cat describe_job.json | jq '.JobId') \
output
.PHONY: backup
@bdmbdsm
Copy link
Author

bdmbdsm commented Apr 11, 2022

indentation brakes after gist save, so fix it yourself, future me

@bdmbdsm
Copy link
Author

bdmbdsm commented Apr 11, 2022

indentation is perfect in the revisions diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment