{"id":2321,"date":"2015-11-01T01:12:26","date_gmt":"2015-10-31T16:12:26","guid":{"rendered":"http:\/\/tech.akat.info\/?p=2321"},"modified":"2015-11-01T01:12:26","modified_gmt":"2015-10-31T16:12:26","slug":"s3%e3%81%b8%e3%81%ae%e3%83%90%e3%83%83%e3%82%af%e3%82%a2%e3%83%83%e3%83%97%e5%8f%96%e5%be%97","status":"publish","type":"post","link":"https:\/\/tech.akat.info\/?p=2321","title":{"rendered":"S3\u3078\u306e\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u53d6\u5f97"},"content":{"rendered":"<p>s3cmd + debian8 \u3067\u5b9f\u73fe\u3059\u308b<\/p>\n<h1>\u4e8b\u524d\u6e96\u5099<\/h1>\n<p>S3\u3092\u64cd\u4f5c\u3067\u304d\u308b\u30e6\u30fc\u30b6\u3092IAM\u3067\u4f5c\u6210\u3057\u3066\u304a\u304f<br \/>\n<a href=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/11\/2015-10-31_202237.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/tech.akat.info\/wp-content\/uploads\/2015\/11\/2015-10-31_202237-292x300.png\" alt=\"2015-10-31_202237\" width=\"292\" height=\"300\" class=\"alignnone size-medium wp-image-2322\" srcset=\"https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/11\/2015-10-31_202237-292x300.png 292w, https:\/\/tech.akat.info\/wp-content\/uploads\/2015\/11\/2015-10-31_202237.png 483w\" sizes=\"(max-width: 292px) 100vw, 292px\" \/><\/a><\/p>\n<h1>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nroot@hostname:\/home\/shimizu# aptitude install s3cmd\r\n\u4ee5\u4e0b\u306e\u65b0\u898f\u30d1\u30c3\u30b1\u30fc\u30b8\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3059:\r\n  python-dateutil{a} python-magic{a} s3cmd\r\n...\r\n\r\nroot@hostname:\/home\/shimizu# s3cmd --configure\r\nEnter new values or accept defaults in brackets with Enter.\r\nRefer to user manual for detailed description of all options.\r\n\r\nAccess key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.\r\nAccess Key: *****\r\nSecret Key: *****\r\n\r\nEncryption password is used to protect your files from reading\r\nby unauthorized persons while in transfer to S3\r\nEncryption password: *****\r\nPath to GPG program &#x5B;\/usr\/bin\/gpg]:\r\n\r\nWhen using secure HTTPS protocol all communication with Amazon S3\r\nservers is protected from 3rd party eavesdropping. This method is\r\nslower than plain HTTP and can't be used if you're behind a proxy\r\nUse HTTPS protocol &#x5B;No]:\r\n\r\nOn some networks all internet access must go through a HTTP proxy.\r\nTry setting it here if you can't connect to S3 directly\r\nHTTP Proxy server name:*****\r\n\r\n...\r\nConfiguration saved to '\/root\/.s3cfg'\r\n\r\nroot@hostname:\/home\/shimizu# s3cmd --version\r\ns3cmd version 1.5.0-rc1\r\n<\/pre>\n<h1>s3cmd\u64cd\u4f5c<\/h1>\n<p>\u3059\u3079\u3066\u306fman\u30b3\u30de\u30f3\u30c9\u306b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nCOMMANDS\r\n s3cmd can do several actions specified by the following commands.\r\n\r\n s3cmd mb s3:\/\/BUCKET\r\n        Make bucket\r\n\r\n s3cmd rb s3:\/\/BUCKET\r\n        Remove bucket\r\n\r\n s3cmd ls &#x5B;s3:\/\/BUCKET&#x5B;\/PREFIX]]\r\n        List objects or buckets\r\n\r\n s3cmd la\r\n        List all object in all buckets\r\n\r\n s3cmd put FILE &#x5B;FILE...] s3:\/\/BUCKET&#x5B;\/PREFIX]\r\n        Put file into bucket\r\n\r\n s3cmd get s3:\/\/BUCKET\/OBJECT LOCAL_FILE\r\n        Get file from bucket\r\n\r\n s3cmd del s3:\/\/BUCKET\/OBJECT\r\n        Delete file from bucket\r\n\r\n s3cmd rm s3:\/\/BUCKET\/OBJECT\r\n        Delete file from bucket (alias for del)\r\n s3cmd restore s3:\/\/BUCKET\/OBJECT\r\n        Restore file from Glacier storage\r\n\r\n s3cmd sync LOCAL_DIR s3:\/\/BUCKET&#x5B;\/PREFIX] or s3:\/\/BUCKET&#x5B;\/PREFIX] LOCAL_DIR\r\n        Synchronize a directory tree to S3 (checks files freshness using size and md5 checksum, unless overriden bns, se e below)\r\n\r\n s3cmd du &#x5B;s3:\/\/BUCKET&#x5B;\/PREFIX]]\r\n        Disk usage by buckets\r\n\r\n s3cmd info s3:\/\/BUCKET&#x5B;\/OBJECT]\r\n        Get various information about Buckets or Files\r\n\r\n s3cmd cp s3:\/\/BUCKET1\/OBJECT1 s3:\/\/BUCKET2&#x5B;\/OBJECT2]\r\n        Copy object\r\n\r\n s3cmd modify s3:\/\/BUCKET1\/OBJECT\r\n        Modify object metadata\r\n\r\n s3cmd mv s3:\/\/BUCKET1\/OBJECT1 s3:\/\/BUCKET2&#x5B;\/OBJECT2]\r\n        Move object\r\n\r\n s3cmd setacl s3:\/\/BUCKET&#x5B;\/OBJECT]\r\n        Modify Access control list for Bucket or Files\r\n\r\n s3cmd setpolicy FILE s3:\/\/BUCKET\r\n        Modify Bucket Policy\r\n\r\n s3cmd delpolicy s3:\/\/BUCKET\r\n        Delete Bucket Policy\r\n\r\n s3cmd multipart s3:\/\/BUCKET &#x5B;Id]\r\n        show multipart uploads\r\n\r\n s3cmd abortmp s3:\/\/BUCKET\/OBJECT Id\r\n        abort a multipart upload\r\n\r\n s3cmd listmp s3:\/\/BUCKET\/OBJECT Id\r\n        list parts of a multipart upload\r\n\r\n s3cmd accesslog s3:\/\/BUCKET\r\n        Enable\/disable bucket access logging\r\n\r\n s3cmd sign STRING-TO-SIGN\r\n        Sign arbitrary string using the secret key\r\n\r\n s3cmd signurl s3:\/\/BUCKET\/OBJECT expiry_epoch\r\n        Sign an S3 URL to provide limited public access with expiry\r\n\r\n s3cmd fixbucket s3:\/\/BUCKET&#x5B;\/PREFIX]\r\n        Fix invalid file names in a bucket\r\n\r\n s3cmd expire s3:\/\/BUCKET\r\n        Set or delete expiration rule for the bucket\r\n\r\n s3cmd setlifecycle s3:\/\/BUCKET\r\n        Upload a lifecycle policy for the bucket\r\n\r\n s3cmd dellifecycle s3:\/\/BUCKET\r\n        Remove a lifecycle policy for the bucket\r\n<\/pre>\n<p>\u3088\u304f\u4f7f\u3044\u305d\u3046\u306a\u30b3\u30de\u30f3\u30c9\u3092\u8a66\u3057\u3066\u307f\u308b<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n### bucket\u4f5c\u6210 ###\r\nroot@hostname:\/home\/shimizu# s3cmd mb s3:\/\/www.akat.info.bk\r\nBucket 's3:\/\/www.akat.info.bk\/' created\r\n\r\n### bucket\u8868\u793a ###\r\nroot@hostname:\/home\/shimizu# s3cmd ls\r\n2014-07-02 15:22  s3:\/\/www.akat.info\r\n\r\n### \u30d5\u30a1\u30a4\u30eb\u3092\u9001\u308b ###\r\nroot@hostname:\/home\/shimizu# s3cmd put test.txt s3:\/\/www.akat.info\r\ntest.txt -&gt; s3:\/\/www.akat.info\/test.txt  &#x5B;1 of 1]\r\n 25623 of 25623   100% in    0s   279.38 kB\/s  done\r\n\r\n### \u78ba\u8a8d\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu# s3cmd la\r\n\r\n2015-10-31 13:59     25623   s3:\/\/www.akat.info\/test.txt\r\n\r\n### \u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u5f97\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu# s3cmd get s3:\/\/www.akat.info\/test.txt\r\n\r\n### \u5bb9\u91cf\u304c\u5927\u304d\u3044\u3068\u30ea\u30c8\u30e9\u30a4\u304c\u4f55\u56de\u3082\u304b\u304b\u3063\u3066\u30a8\u30e9\u30fc ###\r\nroot@hostname:\/home\/shimizu# s3cmd put 5G.file s3:\/\/www.akat.info\r\n...\r\nWARNING: Upload failed: \/5G.file?partNumber=23&amp;uploadId=... (&#x5B;Errno 104] Connection reset by peer)\r\nWARNING: Retrying on lower speed (throttle=0.00)\r\n...\r\n\r\n### \u5bb9\u91cf\u304c\u5927\u304d\u3044\u30d5\u30a1\u30a4\u30eb\u3092\u9001\u308b\u5834\u5408(--multipart-chunk-size-mb\u3068\u3044\u3046\u30aa\u30d7\u30b7\u30e7\u30f3\u3082\u3042\u308a) ###\r\nroot@hostname:\/home\/shimizu# s3cmd  --multipart-chunk-size-mb=5 put 5G.file s3:\/\/www.akat.info\r\n\r\n### \u5bb9\u91cf\u7b97\u51fa ###\r\nroot@hostname:\/home\/shimizu# s3cmd du s3:\/\/www.akat.info\r\n5368709120   s3:\/\/www.akat.info\/\r\n\r\n### s3\u9593\u3067\u30b3\u30d4\u30fc(\u79fb\u52d5\u3082\u53ef\u80fd) ###\r\nroot@hostname:\/home\/shimizu# s3cmd cp s3:\/\/www.akat.info\/test.txt s3:\/\/www.akat.info.bk\/\r\nFile s3:\/\/www.akat.info\/test.txt copied to s3:\/\/www.akat.info.bk\/test.txt\r\nroot@hostname:\/home\/shimizu# s3cmd la\r\n2015-10-31 13:59     25623   s3:\/\/www.akat.info\/test.txt\r\n\r\n2015-10-31 14:07     25623   s3:\/\/www.akat.info.bk\/test.txt\r\n\r\n### \u671f\u9650\u4ed8\u304d\u30a2\u30af\u30bb\u30b9 ###\r\nroot@hostname:\/home\/shimizu# s3cmd signurl s3:\/\/www.akat.info\/test.txt 300\r\nhttp:\/\/www.akat.info.s3.amazonaws.com\/test.txt?AWSAccessKeyId=AKIAIKWXKI6T6S3VPCPA&Expires=300&Signature=5MEpFuEGrOzTgCNVDpAfsLMn02Q%3D\r\n\u2026URL\u306f\u3067\u304d\u305f\u304c\u3001\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068\u306a\u305c\u304b\u3046\u307e\u304f\u3044\u304b\u306a\u304b\u3063\u305f\r\n\r\n### sync\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu# s3cmd sync testdir s3:\/\/www.akat.info\r\ntestdir\/test -&gt; s3:\/\/www.akat.info\/testdir\/test  &#x5B;1 of 2]\r\n 4 of 4   100% in    0s    43.85 B\/s  done\r\ntestdir\/test2 -&gt; s3:\/\/www.akat.info\/testdir\/test2  &#x5B;2 of 2]\r\n 13 of 13   100% in    0s   276.01 B\/s  done\r\nDone. Uploaded 17 bytes in 0.2 seconds, 104.52 B\/s.  Copied 0 files saving 0 bytes transfer.\r\n\r\n### \u5b8c\u5168\u540c\u671f\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu# s3cmd --delete-removed sync test3.txt s3:\/\/www.akat.info\r\nFile s3:\/\/www.akat.info\/delete.txt deleted\r\nFile s3:\/\/www.akat.info\/testdir\/test deleted\r\nFile s3:\/\/www.akat.info\/testdir\/test2 deleted\r\ntest3.txt -&gt; s3:\/\/www.akat.info\/test3.txt  &#x5B;1 of 1]\r\n 0 of 0     0% in    0s     0.00 B\/s  done\r\n\r\n### restore\u3059\u308b ###\r\nroot@hostname:\/home\/shimizu# s3cmd sync s3:\/\/www.akat.info\/test3.txt testdir\/\r\n<\/pre>\n<h1>\u53c2\u8003URL<\/h1>\n<p><a href=\"http:\/\/blog.makotokw.com\/2014\/05\/03\/backup-to-amazon-s3\/\">\u30b5\u30fc\u30d0\u306e\u30c7\u30fc\u30bf\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092Amazon S3\u306b\u7f6e\u304f<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>s3cmd + debian8 \u3067\u5b9f\u73fe\u3059\u308b \u4e8b\u524d\u6e96\u5099 S3\u3092\u64cd\u4f5c\u3067\u304d\u308b\u30e6\u30fc\u30b6\u3092IAM\u3067\u4f5c\u6210\u3057\u3066\u304a\u304f \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3068\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7 root@hostname:\/home\/shimizu# aptitude install  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27],"tags":[],"_links":{"self":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/2321"}],"collection":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2321"}],"version-history":[{"count":1,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/2321\/revisions"}],"predecessor-version":[{"id":2323,"href":"https:\/\/tech.akat.info\/index.php?rest_route=\/wp\/v2\/posts\/2321\/revisions\/2323"}],"wp:attachment":[{"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tech.akat.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}