Skip to content

Instantly share code, notes, and snippets.

@documents-design
Last active April 29, 2019 08:47
Show Gist options
  • Select an option

  • Save documents-design/d6ad4378e322e296fc2d25ba4aef663c to your computer and use it in GitHub Desktop.

Select an option

Save documents-design/d6ad4378e322e296fc2d25ba4aef663c to your computer and use it in GitHub Desktop.
Retrieve backups from AWS glacier with awscli

Install pip if needed, then aws-cli

sudo apt install python-pip

pip install awscli

aws configure

Entrer les informations de compte (clef secrète, etc)

Lancer une récupération d'inventaire

$ aws glacier initiate-job --account-id {account-id} --vault-name {vault-name} --job-parameters "{"Type": "inventory-retrieval"}"

{ "location": "...", "jobId": "..." }

Lancer une demande de progression du job précédent

$ aws glacier describe-job --account-id {account-id} --vault-name {vault-name} --job-id "..."

{ "InventoryRetrievalParameters": { "Format": "JSON" }, "VaultARN": "...", "Completed": false, "JobId": "...", "Action": "InventoryRetrieval", "CreationDate": "2019-04-29T08:35:12.939Z", "StatusCode": "InProgress" }

Une fois terminé, sortir dans job_output.json la liste des archives

$ aws glacier get-job-output --account-id {account-id} --vault-name {vault-name} --job-id "..." job_output.json

Parcourir cette liste

Une fois les archives trouvées, lancer une récupération d'archive

$ aws glacier initiate-job --account-id {account-id} --vault-name {vault-name} --job-parameters "{"Type": "archive-retrieval", "ArchiveId": "id-archive"}"

Vérifier le progrès de ce job de temps en temps avec describe-job vu plus haut

Le télécharger avec get-job-output comme vu plus haut, en indiquant le nom de fichier désiré.

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