{"id":1859,"date":"2012-08-24T22:46:06","date_gmt":"2012-08-24T13:46:06","guid":{"rendered":"http:\/\/borg4.vdomains.jp\/~goro\/diary\/?p=1859"},"modified":"2012-08-24T22:46:06","modified_gmt":"2012-08-24T13:46:06","slug":"python-%e3%81%a7%e5%bc%84%e3%82%8b-amazon-glacier","status":"publish","type":"post","link":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/2012\/1859","title":{"rendered":"python \u3067\u5f04\u308b Amazon Glacier"},"content":{"rendered":"<p>\u524d\u56de\u898b\u3064\u3051\u305f\u00a0<a href=\"https:\/\/gist.github.com\/3424090\">Amazon Glacier from Python.<\/a>\u00a0\u3092\u8a66\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u30bd\u30fc\u30b9\u5185\u90e8\u306b\u66f8\u304b\u308c\u305f\u6570\u884c\u306e\u307f<span style=\"color: #888888;\">(\u3068\u30bd\u30fc\u30b9\u81ea\u4f53)<\/span>\u3068\u304b\u3001 <a href=\"https:\/\/github.com\/boto\/boto\">boto<\/a> \u306e git \u5148\u7aef\u304c\u5fc5\u8981\u3060\u3068\u304b\u82e5\u5e72\u6577\u5c45\u304c\u9ad8\u3044\u306e\u3067\u3059\u304c\u3001 eclipse \u5165\u308c\u305f\u308a .Net SDK \u5165\u308c\u308b\u305f\u3081\u306b Windows \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304b\u3089\u59cb\u3081\u308b\u3053\u3068\u3092\u8003\u3048\u308c\u3070\u307e\u3060\u30de\u30b7\u3067\u3057\u3087\u3046\u3002<\/p>\n<p><!--more--><\/p>\n<p>boto \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306f <a href=\"http:\/\/cvsweb.netbsd.org\/bsdweb.cgi\/pkgsrc\/net\/py-boto\/?only_with_tag=MAIN\">net\/py-boto<\/a> \u304c\u3042\u3063\u305f\u306e\u3067\u3001\u305d\u308c\u3092\u4e38\u30d1\u30af\u30ea\u3057\u3066 local\/py-boto2 \u3092\u4f5c\u6210\u3057\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3057\u305f\u3002 git \u5148\u7aef\u304c\u5fc5\u8981\u306a\u5834\u5408\u3001\u3069\u3046\u3084\u3063\u3066\u5165\u308c\u308b\u306e\u304c\u6b63\u7fa9\u306a\u3093\u3067\u3057\u3087\u3046\u304b\u306d??<\/p>\n<p>\u3067 glacier.py \u306e\u5148\u982d\u306b<\/p>\n<pre># Example:\r\n#\r\n# glacierconn = GlacierConnection(AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY)\r\n# writer = GlacierWriter(glacierconn, GLACIER_VAULT)\r\n# writer.write(somedata)\r\n# writer.write(someotherdata)\r\n# writer.close()\r\n# # Get the id of the newly created archive\r\n# archive_id = writer.get_archive_id()<\/pre>\n<p>\u3068\u3001\u5177\u4f53\u4f8b\u304c\u3042\u308b\u306e\u3067\u305d\u308c\u306b\u6e96\u3058\u3066\u4f7f\u3048\u3070\u3044\u3044\u306e\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3053\u3093\u306a\u611f\u3058\u306e\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u305f\u306e\u3067\u3059\u304c<\/p>\n<pre>#!\/usr\/pkg\/bin\/python2.7\r\n\r\nAWSAccesskey=\"<em>YOUR_AWS_ACCESS_KEY<\/em>\"\r\nAWSSecretAccesskey=\"<em>YOUR_AWS_SECRET_ACCESS_KEY<\/em>\"\r\nAWSregion=\"<em>AWS_REGION<\/em>\"\r\nVaultName=\"<em>VAULT_NAME<\/em>\"\r\n\r\nfrom glacier import GlacierConnection\r\nfrom glacier import GlacierWriter\r\n\r\nf = open('.\/glacier.py','r')\r\nputsdata = f.read()\r\nf.close()\r\n\r\nglacierconn = GlacierConnection(AWSAccesskey, AWSSecretAccesskey, AWSregion)\r\nwriter = GlacierWriter(glacierconn, VaultName)\r\nwriter.write(putsdata)\r\nwriter.close()\r\nprint writer.get_archive_id()<\/pre>\n<p>\u5b9f\u884c\u3059\u308b\u3068\u3001\u6700\u5f8c\u306e get_archive_id() \u3067\u3061\u3083\u3093\u3068\u7cde\u9577\u3044\u30a2\u30fc\u30ab\u30a4\u30d6 ID \u304c\u62fe\u3048\u3066\u308b\u306e\u306b\u3082\u95a2\u308f\u3089\u305a\u3001 AWS \u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u306b\u306f\u306a\u306b\u3082\u8868\u793a\u3055\u308c\u306a\u3044\u306e\u3067\u3059\u3002 glacier.py \u306f\u30b5\u30a4\u30ba\u306b\u95a2\u308f\u3089\u305a multipart upload \u3092\u5229\u7528\u3057\u3066\u30a2\u30c3\u30d7\u3059\u308b\u306e\u3067\u8a66\u3057\u306b single upload \u3092\u5229\u7528\u3059\u308b\u306e\u3092\u4f5c\u3063\u305f\u3093\u3060\u3051\u3069\u3001\u7d50\u679c\u306f\u540c\u3058\u2026\u3002<br \/>\n\u3053\u308c\u306f\u8ae6\u3081\u3066\u3061\u3083\u3093\u3068 SDK \u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b eclipse \u3067\u3082\u5165\u308c\u306a\u304d\u3083\u306a\u308b\u307e\u3044\u304b\u3001\u3068\u601d\u3044\u306a\u304c\u3089 API \u3092\u773a\u3081\u3066\u3044\u305f\u3089!!<br \/>\n<a href=\"http:\/\/docs.amazonwebservices.com\/amazonglacier\/latest\/dev\/uploading-an-archive.html\">Uploading an Archive in Amazon Glacier<\/a> \u306b<\/p>\n<blockquote><p>After you upload an archive, if you immediately download the vault inventory, it might not show the archive you uploaded in the list because Amazon Glacier prepares the vault inventory <span style=\"color: #ff0000;\">only about once a day<\/span>.<\/p><\/blockquote>\n<p>\u2026\u3058\u3083\u30fc\u3057\u3087\u3046\u304c\u306a\u3044\u3067\u3059\u3088\u30cd! \u3066\u306a\u308f\u3051\u3067\u5f85\u3063\u3066\u305f\u3089\u3053\u3093\u306a\u611f\u3058\u306b\u751f\u3048\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"http:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-content\/uploads\/2012\/08\/awsglacierconsole.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-1876\" title=\"awsglacierconsole\" src=\"http:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-content\/uploads\/2012\/08\/awsglacierconsole-300x246.png\" alt=\"\" width=\"300\" height=\"246\" srcset=\"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-content\/uploads\/2012\/08\/awsglacierconsole-300x246.png 300w, https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-content\/uploads\/2012\/08\/awsglacierconsole-1024x839.png 1024w, https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-content\/uploads\/2012\/08\/awsglacierconsole.png 1118w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3057\u304b\u3057\u5f53\u7136\u306a\u304c\u3089\u4fdd\u5b58\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u8eab\u306f\u78ba\u8a8d\u3067\u304d\u306a\u3044\u3088\u3046\u3067\u3059<span style=\"color: #888888;\">(\u3068\u3044\u3046\u304b\u78ba\u8a8d\u51fa\u6765\u308b\u306e\u306f\u30c8\u30fc\u30bf\u30eb\u306e\u30b5\u30a4\u30ba\u3068\u30a2\u30fc\u30ab\u30a4\u30d6\u306e\u500b\u6570\u3060\u3051)<\/span><\/p>\n<p>\u4ed6\u306b\u3082 <a href=\"http:\/\/docs.amazonwebservices.com\/amazonglacier\/latest\/dev\/working-with-archives.html\">Working with Archives in Amazon Glacier<\/a>\u00a0\u306b\u306f<\/p>\n<blockquote><p><strong>Updating an Archive in Amazon Glacier<\/strong><br \/>\nAfter you upload an archive, <span style=\"color: #ff0000;\">you cannot update its content or its description<\/span>. The only way you can update the archive content or its description is by deleting the archive and uploading another archive. Note that each time you upload an archive, Amazon Glacier returns to you a unique archive ID.<\/p><\/blockquote>\n<p>\u3068\u304b<\/p>\n<blockquote><p><strong>Note<\/strong><br \/>\nIf you are an Amazon Simple Storage Service (Amazon S3) customer, you know that when you upload an object to a bucket, you can assign the object an object key such as\u00a0MyDocument.txt\u00a0or\u00a0SomePhoto.jpg. In Amazon Glacier, <span style=\"color: #ff0000;\">you cannot assign a key name to the archives you upload<\/span>.<\/p><\/blockquote>\n<p>\u3068\u304b\u697d\u3057\u3052\u306a\u3053\u3068\u304c\u66f8\u3044\u3066\u3042\u308b\u306e\u3067\u4f0a\u9054\u306b\u5b89\u3044\u308f\u3051\u3067\u306f\u306a\u3044\u3088\u3046\u3067(\u7b11)<\/p>\n<p>\u3061\u306a\u307f\u306b GlacierConnection \u306e\u4e09\u756a\u76ee\u306e\u5f15\u6570\u3092\u6307\u5b9a\u3057\u306a\u3044\u3068\u30c7\u30d5\u30a9\u30eb\u30c8\u306e us-east-1(Virginia) \u306b\u306a\u308a\u307e\u3059\u3002\u3053\u3053\u306e\u6307\u5b9a\u306f AWS \u30b3\u30f3\u30bd\u30fc\u30eb\u306e APN \u3067\u78ba\u8a8d\u51fa\u6765\u308b\u306e\u3067\u3061\u3083\u3093\u3068\u6307\u5b9a\u3057\u3066\u3042\u3052\u307e\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u898b\u3064\u3051\u305f\u00a0Amazon Glacier from Python.\u00a0\u3092\u8a66\u3057\u307e\u3057\u305f\u3002 \u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306f\u30bd\u30fc\u30b9\u5185\u90e8\u306b\u66f8\u304b\u308c\u305f\u6570\u884c\u306e\u307f(\u3068\u30bd\u30fc\u30b9\u81ea\u4f53)\u3068\u304b\u3001 boto \u306e git \u5148\u7aef\u304c\u5fc5\u8981\u3060\u3068\u304b\u82e5\u5e72\u6577\u5c45\u304c\u9ad8\u3044\u306e\u3067\u3059\u304c\u3001 ec [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":1876,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[63,64],"class_list":["post-1859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-misc","tag-aws","tag-glacier"],"_links":{"self":[{"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/posts\/1859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/comments?post=1859"}],"version-history":[{"count":18,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/posts\/1859\/revisions"}],"predecessor-version":[{"id":1878,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/posts\/1859\/revisions\/1878"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/media\/1876"}],"wp:attachment":[{"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/media?parent=1859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/categories?post=1859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/borg4.vdomains.jp\/~goro\/diary\/wp-json\/wp\/v2\/tags?post=1859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}