amazon web services - AWS S3 Glacier - Programmatically Initiate Restore -
i have been writing web-app using s3 storage , glacier backup. setup lifecycle policy archive it. want write webapp lists archived files, user should able initiate restore , email once restore complete.
now trouble running cant find php sdk command can issue initiaterestore. nice if notified sns when restore complete, sns push json onto sqs , poll sqs , email user when polling detected complete restore.
any or suggestions nice. thanks.
you use aws cli tool (here i'm assuming want restore files in 1 directory):
aws s3 ls s3://mybucket/mydir/ | awk '{if ($4) print $4}' > myfiles.txt x in `cat myfiles.txt` echo "restoring $x" aws s3api restore-object \ --bucket mybucket \ --key "mydir/$x" \ --restore-request '{"days":30}' done
regarding desire notification, cli tool report "a client error (restorealreadyinprogress) occurred: object restore in progress" if request initiated, , different message once restores. run restore command several times, looking "restore done" error/message. pretty hacky of course; there's better way aws cli tool.
caveat: careful glacier restores exceed allotted free-restore amount/period. if restore data quickly, charges can exponentially pile up.
Comments
Post a Comment