Last active
March 10, 2022 07:48
-
-
Save hfreire/89a2bd48b683a8078549fec908b31efc to your computer and use it in GitHub Desktop.
Upload/download to/from AWS Glacier using aws-cli
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
# create a vault | |
aws glacier create-vault --account-id - --vault-name my-vault-name | |
# check that the vault was created successfully | |
aws glacier describe-vault --account-id - --vault-name my-vault-name | |
# upload a file to the vault | |
aws glacier upload-archive --vault-name my-vault-name --account-id - --archive-description "my-archive-description" --body my-text-file.txt | |
# request an inventory of the vault | |
aws glacier initiate-job --account-id - --vault my-vault-name --job-parameters '{ "Type": "inventory-retrieval" }' | |
# get a list of the current jobs | |
aws glacier list-jobs --account-id - --vault-name my-vault-name | |
# get inventory result | |
aws glacier get-job-output --account-id - --vault-name my-vault-name --job-id my-job-id inventory.json | |
# request a file download from the vault | |
cat << EOF | tee request.json | |
{ | |
"Type": "archive-retrieval", | |
"ArchiveId": my-archive-id, | |
"Description": "my-archive-description", | |
"SNSTopic":"my-sns-topic" | |
} | |
EOF | |
aws glacier initiate-job --account-id - --vault-name my-vault-name --job-parameters file://request.json | |
# download file | |
aws glacier get-job-output --account-id - --vault-name my-vault-name --job-id my-job-id my-text-file.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I execute the command
aws glacier initiate-job --account-id - --vault sandbox --job-parameters '{ "Type": "inventory-retrieval" }'
I also got this error message
Unknown options: inventory-retrieval, }', Type:
Do you have same issue like this before?