{"id":4797,"date":"2015-11-17T17:00:13","date_gmt":"2015-11-17T08:00:13","guid":{"rendered":"http:\/\/www.skyarch.net\/blog\/?p=4797"},"modified":"2015-11-17T16:56:18","modified_gmt":"2015-11-17T07:56:18","slug":"s3cmd%e3%81%a7%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%9fiam%e3%83%a6%e3%83%bc%e3%82%b6%e3%81%ae%e6%a8%a9%e9%99%90%e3%81%8c%e5%88%a9%e7%94%a8%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%e5%a0%b4%e5%90%88%e3%81%ae","status":"publish","type":"post","link":"https:\/\/www.skyarch.net\/blog\/s3cmd%e3%81%a7%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%9fiam%e3%83%a6%e3%83%bc%e3%82%b6%e3%81%ae%e6%a8%a9%e9%99%90%e3%81%8c%e5%88%a9%e7%94%a8%e3%81%95%e3%82%8c%e3%81%aa%e3%81%84%e5%a0%b4%e5%90%88%e3%81%ae\/","title":{"rendered":"s3cmd\u3067\u6307\u5b9a\u3057\u305fIAM\u30e6\u30fc\u30b6\u306e\u6a29\u9650\u304c\u5229\u7528\u3055\u308c\u306a\u3044\u5834\u5408\u306e\u30c8\u30e9\u30d6\u30eb\u30b7\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0"},"content":{"rendered":"<h1>\u4e8b\u8c61<\/h1>\n<p>s3cmd\u5229\u7528\u6642\u306b\u9069\u5207\u306b\u4f5c\u6210\u3057\u305fIAM\u30e6\u30fc\u30b6\u6a29\u9650\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u306f\u305a\u304c\u4e0b\u8a18\u306e\u69d8\u306a\u30a8\u30e9\u30fc\u3067\u5f3e\u304b\u308c\u3066\u3057\u307e\u3063\u305f<br \/>\n\u5229\u7528\u74b0\u5883 : s3cmd 1.5.0-alpha3 \/ AmazonLinux2015.09 \u3092\u5229\u7528<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nERROR: S3 error: 403 (AccessDenied): Access Denied\nERROR: Parameter problem: Nothing to download. Expecting S3 URI.\n...\n<\/pre>\n<h2>\u5207\u308a\u5206\u3051<\/h2>\n<p>.s3cfg \u4e2d\u306eKey\u3092\u9069\u5f53\u306a\u7269\u306b\u5909\u66f4\u3057\u3066\u3082\/\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u3067\u30ad\u30fc\u3092\u76f4\u63a5\u6e21\u3057\u3066\u3082\u6319\u52d5\u304c\u5909\u308f\u3089\u306a\u3044<br \/>\n\u2192 \u8a2d\u5b9a\u3057\u305fAccessKey\/SecretKey\u304c\u5229\u7528\u3055\u308c\u3066\u3044\u306a\u3044<br \/>\n\u3067\u306f\u4f55\u3092\u5229\u7528\u3057\u3066\u3044\u308b\u304b... \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u8a2d\u5b9a\u3057\u305fIAM\u30ed\u30fc\u30eb\u304c\u4f7f\u308f\u308c\u3066\u3044\u305f...<\/p>\n<h1>\u5bfe\u51e6\u6cd5<\/h1>\n<blockquote><p>\n  .s3cfg \u4e2d\u306e access_token \u3092\u7a7a\u306b\u8a2d\u5b9a\u3057\u305f\u4e0a\u3067 access_key \u3068 secret_key \u3092\u8a2d\u5b9a\u3059\u308b\n<\/p><\/blockquote>\n<h1>IAM Role\u7121\u3057\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067s3cmd\u8a2d\u5b9a<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# s3cmd --configure\n\nEnter new values or accept defaults in brackets with Enter.\nRefer to user manual for detailed description of all options.\n\nAccess key and Secret key are your identifiers for Amazon S3\nAccess Key: \nSecret Key: \n<\/pre>\n<h1>IAM Role\u6709\u308a\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3067s3cmd\u8a2d\u5b9a<\/h1>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n# s3cmd --configure\n\nEnter new values or accept defaults in brackets with Enter.\nRefer to user manual for detailed description of all options.\n\nAccess key and Secret key are your identifiers for Amazon S3\nAccess Key &#x5B;ASXXXXXX]:  &lt;- .s3cfg \u30d5\u30a1\u30a4\u30eb\u306f\u7121\u3044\u304c\u65e2\u306bKey\u304c\u5165\u3063\u3066\u3044\u308b\nSecret Key &#x5B;iSXXXXXX]:  &lt;- .s3cfg \u30d5\u30a1\u30a4\u30eb\u306f\u7121\u3044\u304c\u65e2\u306bKey\u304c\u5165\u3063\u3066\u3044\u308b\n<\/pre>\n<h1>\u3069\u3053\u304b\u3089 Key \u3092\u81ea\u52d5\u53d6\u5f97\u3057\u3066\u3044\u308b\u304b?<\/h1>\n<p>\u30bd\u30fc\u30b9\u3092\u78ba\u8a8d\u3057\u305f\u6240 Config\u5b9f\u884c\u6642\u306b\u4e0b\u8a18\u51e6\u7406\u304c\u5165\u3063\u3066\u304a\u308a\u307e\u3057\u305f<br \/>\n\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bf\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3057Role\u304c\u8a2d\u5b9a\u3057\u3066\u3042\u308b\u5834\u5408\u3001\u305d\u306e\u30ed\u30fc\u30eb\u306eAccessKey\/SecretKey\/Token \u3092\u53d6\u5f97\u3057\u3066\u304a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>http:\/\/169.254.169.254\/latest\/meta-data\/iam\/security-credentials\/<br \/>\nhttp:\/\/169.254.169.254\/latest\/meta-data\/iam\/security-credentials\/[\u30ed\u30fc\u30eb\u540d]\n<h2>s3cmd\u30bd\u30fc\u30b9\u306b\u3066role\u3092\u53d6\u5f97\u3057\u3066\u3044\u308b\u7b87\u6240<\/h2>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\ndef role_config(self):\r\n        conn = httplib.HTTPConnection(host='169.254.169.254',timeout=0.1)\r\n        try:\r\n            conn.request('GET', &quot;\/latest\/meta-data\/iam\/security-credentials\/&quot;)\r\n            resp = conn.getresponse()\r\n            files = resp.read()\r\n            if resp.status == 200 and len(files)&gt;1:\r\n                conn.request('GET', &quot;\/latest\/meta-data\/iam\/security-credentials\/%s&quot;%files)\r\n                resp=conn.getresponse()\r\n                if resp.status == 200:\r\n                    creds=json.load(resp)\r\n                    Config().update_option('access_key', creds&#x5B;'AccessKeyId'].encode('ascii'))\r\n                    Config().update_option('secret_key', creds&#x5B;'SecretAccessKey'].encode('ascii'))\r\n                    Config().update_option('access_token', creds&#x5B;'Token'].encode('ascii'))\r\n                else:\r\n                    raise IOError\r\n            else:\r\n                raise IOError\r\n        except:\r\n            raise\r\n<\/pre>\n<h3>EC2\u306b\u4ed8\u4e0e\u3057\u305fIAM Role\u3092\u78ba\u8a8d<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ curl http:\/\/169.254.169.254\/latest\/meta-data\/iam\/security-credentials\/\ntestS3\n<\/pre>\n<h3>EC2\u306b\u4ed8\u4e0e\u3057\u305fIAM Role\u306e\u30ad\u30fc\/Token\u3092\u78ba\u8a8d<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n$ curl http:\/\/169.254.169.254\/latest\/meta-data\/iam\/security-credentials\/testS3\n{\n  &quot;Code&quot; : &quot;Success&quot;,\n  &quot;LastUpdated&quot; : &quot;2015-11-17T06:51:35Z&quot;,\n  &quot;Type&quot; : &quot;AWS-HMAC&quot;,\n  &quot;AccessKeyId&quot; : &quot;Axxx&quot;,\n  &quot;SecretAccessKey&quot; : &quot;Kxxx&quot;,\n  &quot;Token&quot; : &quot;AQzxxxxxxxxxxxgU=&quot;,\n  &quot;Expiration&quot; : &quot;2015-11-17T13:09:15Z&quot;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e8b\u8c61 s3cmd\u5229\u7528\u6642\u306b\u9069\u5207\u306b\u4f5c\u6210\u3057\u305fIAM\u30e6\u30fc\u30b6\u6a29\u9650\u3067\u30a2\u30af\u30bb\u30b9\u3057\u305f\u306f\u305a\u304c\u4e0b\u8a18\u306e\u69d8\u306a\u30a8\u30e9\u30fc\u3067\u5f3e\u304b\u308c\u3066\u3057\u307e\u3063\u305f \u5229\u7528\u74b0\u5883 : s3cmd 1.5.0-alpha3 \/ AmazonLinux2015.09 \u3092\u5229\u7528 ERRO&#8230;<\/p>\n","protected":false},"author":2,"featured_media":4806,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"ja","_original_post":"4797","footnotes":""},"categories":[20,19],"tags":[65],"class_list":{"0":"post-4797","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-aws","8":"category-19","9":"tag-python","10":"ja"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/4797","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/comments?post=4797"}],"version-history":[{"count":5,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/4797\/revisions"}],"predecessor-version":[{"id":4809,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/posts\/4797\/revisions\/4809"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media\/4806"}],"wp:attachment":[{"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/media?parent=4797"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/categories?post=4797"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skyarch.net\/blog\/wp-json\/wp\/v2\/tags?post=4797"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}