{"id":3958,"date":"2019-04-05T00:39:21","date_gmt":"2019-04-04T15:39:21","guid":{"rendered":"https:\/\/greentown.tokyo\/?p=3958"},"modified":"2019-04-07T01:14:15","modified_gmt":"2019-04-06T16:14:15","slug":"amazon-s3","status":"publish","type":"post","link":"https:\/\/greentown.tokyo\/?p=3958","title":{"rendered":"Amazon S3 \u3067\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u8868\u793a\u3059\u308b"},"content":{"rendered":"<p>\u5148\u65e5\u3001AWS\u306e\u30cf\u30f3\u30ba\u30aa\u30f3\u306b\u3044\u3063\u3066\u304d\u305f\u3093\u3067\u3059\u3002<\/p>\n<p>AWS\u306e\u6771\u4eac\u30ea\u30fc\u30b8\u30e7\u30f3\u306b\u306f\u30a8\u30ea\u30a2\u30ea\u30fc\u30b8\u30e7\u30f3\u3063\u3066\u306e\u304c\uff12\u3064\u3042\u3063\u3066<\/p>\n<ul>\n<li>\u6771\u967d\u753a<\/li>\n<li>\u591a\u6469<\/li>\n<\/ul>\n<p>\u306b\u3042\u308b\u3093\u3060\u3063\u3066\u3002<\/p>\n<p>\u30cf\u30f3\u30ba\u30aa\u30f3\u3067\u306f<\/p>\n<p>VPC\u3067\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4f5c\u308b \u2192 \u30b5\u30d6\u30cd\u30c3\u30c8\u3075\u305f\u3064\u4f5c\u308b \u2192\u00a0EC2\u7acb\u3066\u308b \u2192 EC2\u306bWordPress\u5165\u308c\u308b \u2192 GW\u4f5c\u3063\u3066VPC\u3068\u30a2\u30bf\u30c3\u30c1\u3059\u308b \u2192 \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30b0\u30eb\u30fc\u30d7\uff08FireWall\uff09\u4f5c\u308b \u2192\u00a0ElasticIP\u3063\u3066\u306e\u3067\u30d1\u30b0\u30ea\u30c3\u30afIP\u3092\u56fa\u5b9a\u5316\u3059\u308b\uff08AWS\u306e\u30b0\u30ed\u30fc\u30d0\u30ebIP\u306f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u518d\u8d77\u52d5\u3059\u308b\u305f\u3073\u306b\u5909\u308f\u3063\u3066\u3057\u307e\u3046\u304b\u3089\uff09 \u2192 <span style=\"color: #ff00ff;\"><strong>\u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b5\u30fc\u3092\u8a2d\u5b9a\u3059\u308b<\/strong><\/span><\/p>\n<p>\u3066\u3053\u3068\u3092\u3001\u3060\u3044\u305f\u30441\u6642\u9593\u534a\u304f\u3089\u3044\u3067\u3084\u3063\u305f\u3093\u3067\u3059\u304c\u3001\u30b5\u30af\u30c3\u3068\u3067\u304d\u3066\u3001<span style=\"color: #ff00ff;\"><strong>\u304b\u306a\u308a\u30d3\u30d3\u308a\u307e\u3057\u305f<\/strong><\/span>\u3002<\/p>\n<p>\u3080\u304b\u30fc\u3057FireWall\u88fd\u54c1\u306e\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u305f\u6642\u306b\u3001\u30ed\u30fc\u30c9\u30d0\u30e9\u30f3\u30b5\u30fc\u3068\u304b\u6570\u5343\u4e07\u5186\u3067\u30d9\u30f3\u30bf\u30fc\u306b\u304a\u9858\u3044\u3057\u3066\u305f\u308a\u3068\u304b\u3057\u3066\u305f\u306e\u306b\u3001\u4eca\u3084\u500b\u4eba\u3067\u3053\u3093\u306a\u7c21\u5358\u306b\u3067\u304d\u3066\u3057\u307e\u3046\u3068\u306f\u30fb\u30fb\u885d\u6483\u7684\u3067\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6628\u65e5\u3001AWS\u306bMongo\u3061\u3083\u3093\u304c\u306a\u3044\u306a\u3044\uff01\uff01\u3063\u3066\u3055\u308f\u3044\u3067\u3044\u305f\u3089<\/p>\n<p>\u300cDynamoDB\u304c\u30e2\u30f3\u30b4\u3060\u3088\u30fb\u30fb\u300d<\/p>\n<p>\u3068\u8a00\u308f\u308c\u3066\u3001\u3061\u3087\u3063\u3074\u308a\u30cf\u30ba\u30ab\u30b7\u30a4\u601d\u3044\u3092\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>Python\u3067DynamoDB\u3092\u64cd\u4f5c\u3059\u308b\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3092\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u6848\u5916\u7c21\u5358\u306b\u3067\u304d\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u4eca\u65e5\u306f<\/p>\n<p><span style=\"color: #993366;\"><strong>AWS Fargate\u3001Lambda\u3001DynamoDB \u3092\u4f7f\u3063\u3066\u3001\u6700\u65b0\u306e\u30a6\u30a7\u30d6\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3059\u308b<\/strong><\/span><\/p>\n<p>\u3068\u3044\u3046\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306e<strong><span style=\"color: #ff6600;\">\u30e2\u30b8\u30e5\u30fc\u30eb\uff11<\/span><\/strong>\u306b\u30c1\u30e3\u30ec\u30f3\u30b8\u3057\u305f\u306e\u3067\u3057\u305f\u2193<\/p>\n<h2>Amazon S3<\/h2>\n<h3>S3\uff08Simple Storage Service\uff09\u3068\u306f<\/h3>\n<p>\u9759\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\uff08html, js, css, \u30e1\u30c7\u30a3\u30a2\u30b3\u30f3\u30c6\u30f3\u30c4\uff09\u3092\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u3059\u308b\u30b9\u30c8\u30ec\u30fc\u30b8\u30b5\u30fc\u30d3\u30b9\u3002<\/p>\n<p>\u5404\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092HTTP\u3067\u63d0\u4f9b\u53ef\u80fd\u306b\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/57055db6c4068b0a183b972d46c7cf7b.png\"><img decoding=\"async\" class=\"alignnone wp-image-3975 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/57055db6c4068b0a183b972d46c7cf7b.png\" alt=\"\" width=\"602\" height=\"236\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/57055db6c4068b0a183b972d46c7cf7b.png 602w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/57055db6c4068b0a183b972d46c7cf7b-300x118.png 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h6>S3 \u30d0\u30b1\u30c3\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h6>\n<pre class=\"theme:dark-terminal lang:default decode:true\">$ aws s3 mb s3:\/\/mikkegt\r\nmake_bucket: mikkegt<\/pre>\n<p>Amazon S3 \u306f\u3001GET\u3001PUT\u3001LIST\u3001DELETE \u306e\u30aa\u30da\u30ec\u30fc\u30b7\u30e7\u30f3\u306b\u91cd\u70b9\u3092\u7f6e\u3044\u3066\u3044\u308b\u3002<\/p>\n<p>\u5927\u6587\u5b57\u3084\u30a2\u30f3\u30c0\u30fc\u30b9\u30b3\u30a2\u3092\u542b\u3080\u30d0\u30b1\u30c3\u30c8\u540d\u306f\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u306a\u3044\uff08\u3044\u307e\u3093\u3068\u3053\uff09<\/p>\n<p>https:\/\/mikkegt.s3.amazonaws.com<\/p>\n<p>\u3068\u304b\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>\u30d0\u30b1\u30c3\u30c8\u3092\u9759\u7684\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u30db\u30b9\u30c6\u30a3\u30f3\u30b0\u306b\u4f7f\u7528\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b<\/h6>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ aws s3 website s3:\/\/mikkegt --index-document index.html\r\n$<\/pre>\n<p>\u30d0\u30b1\u30c3\u30c8\u7528\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u30d1\u30d6\u30ea\u30c3\u30af DNS \u540d\u3092\u4f7f\u7528\u3057\u3066\u3001\u305d\u306e\u30d0\u30b1\u30c3\u30c8\u5185\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3002\u6307\u5b9a\u3057\u305f\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306e\u30db\u30fc\u30e0\u30da\u30fc\u30b8 (\u307b\u3068\u3093\u3069\u306e\u5834\u5408\u3001index.html) \u3092\u3001DNS \u540d\u306e\u30d9\u30fc\u30b9\u30d1\u30b9\u306b\u5bfe\u3059\u308b\u30b5\u30a4\u30c8\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u53c2\u7167\u5148\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h6>\u30d0\u30b1\u30c3\u30c8\u30dd\u30ea\u30b7\u30fc\u3092\u4f5c\u6210\u3057\u30d1\u30d6\u30ea\u30c3\u30af\u306b\u3059\u308b<\/h6>\n<p>\u30d0\u30b1\u30c3\u30c8\u30dd\u30ea\u30b7\u30fc\u304c\u66f8\u3044\u3066\u3042\u308bJSON\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f<\/p>\n<p>~\/environment\/aws-modern-application-workshop\/module-1\/aws-cli\/website-bucket-policy.json<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">{\r\n    \"Version\": \"2008-10-17\",\r\n    \"Id\": \"PolicyForCloudFrontPrivateContent\",\r\n    \"Statement\": [\r\n        {\r\n            \"Sid\": \"1\",\r\n            \"Effect\": \"Allow\",\r\n            \"Principal\": {\r\n                \"AWS\": \"*\"\r\n            },\r\n            \"Action\": \"s3:GetObject\",\r\n            \"Resource\": \"arn:aws:s3:::mikkegt\/*\"\r\n        }\r\n    ]\r\n}<\/pre>\n<p>\uff12\u7b87\u6240\u66f8\u304d\u63db\u3048\u308b\u3002<\/p>\n<p><span class=\"ymarker-s\">arn:aws:iam::cloudfront:user\/CloudFront Origin Access Identity REPLACE_ME_CLOUDFRONT_ORIGIN_ACCESS_IDENTITY_ID<\/span><br \/>\n\u2193<br \/>\n<span class=\"ymarker-s\">*<\/span><\/p>\n<p><span class=\"ymarker-s\">REPLACE_ME_BUCKET_NAME<\/span><br \/>\n\u2193<br \/>\n<span class=\"ymarker-s\">mikkegt<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>\u30a6\u30a7\u30d6\u30b5\u30a4\u30c8\u306b\u30d1\u30d6\u30ea\u30c3\u30af\u30d0\u30b1\u30c3\u30c8\u30dd\u30ea\u30b7\u30fc\u3092\u8ffd\u52a0\u3002<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ aws s3api put-bucket-policy --bucket mikkegt --policy file:\/\/~\/environment\/aws-modern-application-workshop\/module-1\/aws-cli\/website-bucket-policy.json\r\n$<\/pre>\n<p>&nbsp;<\/p>\n<h6>\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u306e\u521d\u56de\u306e\u30a4\u30c6\u30ec\u30fc\u30b7\u30e7\u30f3\u3092\u30d0\u30b1\u30c3\u30c8\u306b\u8ffd\u52a0\u3059\u308b<\/h6>\n<p>\uff08\u672c\u6765\u306a\u3089\u81ea\u5206\u3067\u4f5c\u3063\u305f\uff09index.html \u3092 S3\u30d0\u30b1\u30c3\u30c8\u306b\u30b3\u30d4\u30fc\u3059\u308b<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">$ aws s3 cp ~\/environment\/aws-modern-application-workshop\/module-1\/web\/index.html s3:\/\/mikkegt\/index.html\r\nupload: module-1\/web\/index.html to s3:\/\/mikkegt\/index.html\r\n$<\/pre>\n<p>\u3067\u3001\u30ea\u30fc\u30b8\u30e7\u30f3\u304c\u30b7\u30f3\u30ac\u30dd\u30fc\u30eb\u306a\u306e\u3067\u300cap-southeast-1\u300d\u3092\u4f7f\u3046\u3002<\/p>\n<p>\u2193\u8ab2\u91d1\u3055\u308c\u3061\u3083\u3046\u304b\u3089\u3001\u5f8c\u3067\u6d88\u3059\u3051\u3069<\/p>\n<p>http:\/\/mikkegt.s3-website-ap-southeast-1.amazonaws.com<\/p>\n<p>\u304b<\/p>\n<p>http:\/\/mikkegt.s3-website.ap-southeast-1.amazonaws.com<\/p>\n<p>\u3067\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068<\/p>\n<p><a href=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/a6c0bfc284ec72298be1ab9f023538c8.png\"><img decoding=\"async\" class=\"alignnone wp-image-3965 size-full\" src=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/a6c0bfc284ec72298be1ab9f023538c8.png\" alt=\"\" width=\"2048\" height=\"1043\" srcset=\"https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/a6c0bfc284ec72298be1ab9f023538c8.png 2048w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/a6c0bfc284ec72298be1ab9f023538c8-300x153.png 300w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/a6c0bfc284ec72298be1ab9f023538c8-768x391.png 768w, https:\/\/greentown.tokyo\/wp-content\/uploads\/2019\/04\/a6c0bfc284ec72298be1ab9f023538c8-1024x522.png 1024w\" sizes=\"(max-width: 2048px) 100vw, 2048px\" \/><\/a><\/p>\n<p>\u304a\u3049\u3049\u301c<\/p>\n<p>\u3067\u3051\u305f\u3002<\/p>\n<p>\u306a\u3093\u304bGAE\u307f\u305f\u3044\u3060\u306a\u301c\u3068\u304b\u601d\u3044\u306a\u304b\u3089\u4f5c\u696d\u3057\u305f\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u7d9a\u304d\u306f\u307e\u305f\u660e\u65e5\u301c\u3002\u660e\u65e5\uff1f<\/p>\n<p>\u660e\u65e5\u306f\u3067\u3059\u306d\u3001Firebase\u3068\u304b\u3067SNOW\u307f\u305f\u3044\u306a\u753b\u50cf\u8a8d\u8b58\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u30cf\u30f3\u30ba\u30aa\u30f3\u306b\u3044\u3063\u3066\u304f\u308b\u301c\u3002<\/p>\n<p>AWS\u3001\u307b\u3063\u3068\u304f\u3068\u8ab2\u91d1\u3055\u308c\u3061\u3083\u3046\u304b\u3082\u306a\u306e\u3067\u3001\u3055\u3063\u3055\u3068\u7d42\u308f\u3089\u305b\u306d\u3070\u3002<\/p>\n<p>\u4eca\u56de\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306fPython\u3067\u3084\u3063\u3066\u3044\u304f\u306e\u3067\u3059\u304c\u3001GO\u30d0\u30fc\u30b8\u30e7\u30f3\u3082\u3042\u308b\u306e\u3067\u3001\u305d\u3063\u3061\u307e\u3067\u624b\u304c\u307e\u308f\u308b\u3068\u3044\u3044\u306a\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u65e5\u3001AWS\u306e\u30cf\u30f3\u30ba\u30aa\u30f3\u306b\u3044\u3063\u3066\u304d\u305f\u3093\u3067\u3059\u3002 AWS\u306e\u6771\u4eac\u30ea\u30fc\u30b8\u30e7\u30f3\u306b\u306f\u30a8\u30ea\u30a2\u30ea\u30fc\u30b8\u30e7\u30f3\u3063\u3066\u306e\u304c\uff12\u3064\u3042\u3063\u3066 \u6771\u967d\u753a \u591a\u6469 \u306b\u3042\u308b\u3093\u3060\u3063\u3066\u3002 \u30cf\u30f3\u30ba\u30aa\u30f3\u3067\u306f VPC\u3067\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u4f5c\u308b \u2192 \u30b5\u30d6\u30cd\u30c3\u30c8\u3075\u305f &#8230; <\/p>\n","protected":false},"author":1,"featured_media":3968,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99],"tags":[],"class_list":["post-3958","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws"],"_links":{"self":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3958"}],"collection":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3958"}],"version-history":[{"count":13,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3958\/revisions"}],"predecessor-version":[{"id":3976,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/posts\/3958\/revisions\/3976"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=\/wp\/v2\/media\/3968"}],"wp:attachment":[{"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/greentown.tokyo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}