Created
April 11, 2022 07:01
-
-
Save bdmbdsm/585fb1fee38eddc6d3b99f1044703b84 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
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 |
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
indentation brakes after gist save, so fix it yourself, future me