{"id":12540,"date":"2020-12-28T22:48:07","date_gmt":"2020-12-28T13:48:07","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=12540"},"modified":"2023-05-27T18:12:09","modified_gmt":"2023-05-27T09:12:09","slug":"%e3%80%90aws%e3%80%91%e3%80%8c%e3%83%a6%e3%83%bc%e3%82%b6%e3%83%bc%e3%83%87%e3%83%bc%e3%82%bf%e3%80%8d%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=12540","title":{"rendered":"\u3010AWS\u3011EC2\u300c\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u300d\u3001\u300c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bf\u30c7\u30fc\u30bf\u300d\u306b\u3064\u3044\u3066"},"content":{"rendered":"<h2>\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3068\u306f\uff1f<\/h2>\n<p>EC2\u304c\u521d\u56de\u306b\u5b9f\u884c\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4e8b\u3067\u5b9f\u884c\u6a29\u9650\u306froot\u6a29\u9650\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h3>\u7528\u9014<\/h3>\n<p>\u521d\u56de\u8d77\u52d5\u6642\u306b\u7279\u5b9a\u306e\u76ee\u7684\u3092\u9054\u6210\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002<\/p>\n<h3>\u4f8b<\/h3>\n<pre class=\"lang:default decode:true \">yum update<\/pre>\n<h3>\u3069\u3053\u3067\u8a2d\u5b9a\u3067\u304d\u308b\u304b\uff1f<\/h3>\n<p>EC2\u4f5c\u6210\u6642\u306b<span style=\"color: #ff0000;\"><strong>\u300c\u9ad8\u5ea6\u306a\u8a73\u7d30\u300d<\/strong><\/span>\u306e\u4e2d\u3067\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<h3>\u8a18\u8ff0\u5f62\u5f0f<\/h3>\n<p>\u4e0b\u8a18\u306e\u3044\u305a\u308c\u304b\u304b\u3089\u9078\u3076\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<ul>\n<li>\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u5f62\u5f0f<\/li>\n<li>cloud-init\u5f62\u5f0f<\/li>\n<\/ul>\n<h4>\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u5f62\u5f0f<\/h4>\n<p>1\u884c\u76ee\u306f\u300c#!\/bin\/bash\u300d\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">#!\/bin\/bash\r\nyum update -y\r\namazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2\r\nyum install -y httpd mariadb-server\r\n<\/pre>\n<h4>cloud-init\u5f62\u5f0f<\/h4>\n<p>1\u884c\u76ee\u306f\u300c#cloud-config\u300d\u304b\u3089\u59cb\u307e\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">#cloud-config\r\nrepo_update: true\r\nrepo_upgrade: all\r\n\r\npackages:\r\n - httpd\r\n - mariadb-server\r\n\r\nruncmd:\r\n - [ sh, -c, \"amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2\" ]\r\n - systemctl start httpd\r\n - sudo systemctl enable httpd<\/pre>\n<h3>\u5b9f\u884c\u30ed\u30b0<\/h3>\n<p>\u306a\u304a\u3001\u4e0b\u8a18\u306e\u5834\u6240\u306b\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3067\u5b9f\u884c\u3057\u305f\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30ed\u30b0\u304c\u51fa\u529b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true \">\/var\/log\/cloud-init-output.log<\/pre>\n<h2>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30e1\u30bf\u30c7\u30fc\u30bf<\/h2>\n<p>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u4e2d\u306b\u57cb\u3081\u8fbc\u307e\u308c\u305f\u30c7\u30fc\u30bf<\/p>\n<h3>\u4f8b<\/h3>\n<ul>\n<li>EC2\u306eIP\u30a2\u30c9\u30ec\u30b9<\/li>\n<li>EC2\u306e\u30db\u30b9\u30c8\u30cd\u30fc\u30e0<\/li>\n<li>EC2\u304c\u5229\u7528\u3057\u3066\u3044\u308bAMI\u306eID\u756a\u53f7<\/li>\n<\/ul>\n<h3>\u30b3\u30de\u30f3\u30c9<\/h3>\n<p>\u4e0b\u8a18\u30b3\u30de\u30f3\u30c9\u3067EC2\u30e1\u30bf\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">ec2-metadata -\u30aa\u30d7\u30b7\u30e7\u30f3<\/pre>\n<p>\u307e\u305f\u3001curl\u30b3\u30de\u30f3\u30c9\u3067\u53d6\u5f97\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3060\u3063\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<h4>\u300cec2-metadata\u30b3\u30de\u30f3\u30c9\u300d\u3068\u300ccurl\u30b3\u30de\u30f3\u30c9\u300d\u306e\u4f7f\u3044\u5206\u3051<\/h4>\n<p>ec2-metadata\u30b3\u30de\u30f3\u30c9\u306f\u7c21\u6f54\u3067\u3059\u304c\u3001\u53d6\u5f97\u7d50\u679c\u306b\u4f59\u8a08\u306a\u6587\u5b57\u5217\u3082\u5165\u3063\u3066\u304d\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u76ee\u8996\u78ba\u8a8d\u3059\u308b\u3068\u304d\u306e\u307f\u4f7f\u3046\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002curl\u30b3\u30de\u30f3\u30c9\u306f\u53d6\u5f97\u7d50\u679c\u304c\u7c21\u6f54\u306a\u306e\u3067\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u305d\u306e\u307e\u307e\u30c7\u30fc\u30bf\u51e6\u7406\u3057\u305f\u3044\u5834\u5408\u7b49\u306b\u4f7f\u3046\u3088\u3046\u306b\u3057\u307e\u3057\u3087\u3046\u3002\u4f8b\u3048\u3070\u3001\u4e0a\u8a18\u3067\u3054\u7d39\u4ecb\u3055\u305b\u3066\u3044\u305f\u3060\u3044\u305f\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3067\u30db\u30b9\u30c8\u540d\u3092\u8a2d\u5b9a\u3059\u308b\u3068\u3044\u3046\u51e6\u7406\u3067\u30db\u30b9\u30c8\u540d\u3092curl\u3067\u53d6\u5f97\u3057\u3066\u8a2d\u5b9a\u3059\u308b\u3068\u3044\u3046\u3088\u3046\u306a\u3053\u3068\u3082\u3057\u305f\u308a\u3057\u307e\u3059\u3002<\/p>\n<p>\u306a\u304a\u3001ec2-metadata\u30b3\u30de\u30f3\u30c9\u306fAmazon Linux\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u4ed6\u306eOS\u306e\u5834\u5408\u306f<span style=\"color: #ff0000;\"><strong>\u30af\u30e9\u30a6\u30c9\u30e6\u30fc\u30c6\u30a3\u30eb\u30ba<\/strong><\/span>\u3068\u3044\u3046\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u6ce8\u610f\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u30e6\u30fc\u30b6\u30fc\u30c7\u30fc\u30bf\u3068\u306f\uff1f EC2\u304c\u521d\u56de\u306b\u5b9f\u884c\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4e8b\u3067\u5b9f\u884c\u6a29\u9650\u306froot\u6a29\u9650\u306b\u306a\u308a\u307e\u3059\u3002 \u7528\u9014 \u521d\u56de\u8d77\u52d5\u6642\u306b\u7279\u5b9a\u306e\u76ee\u7684\u3092\u9054\u6210\u3057\u305f\u3044\u5834\u5408\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002 \u4f8b yum update \u3069\u3053\u3067\u8a2d\u5b9a\u3067\u304d\u308b\u304b\uff1f EC2\u4f5c\u6210\u6642\u306b\u300c [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[80],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/12540"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12540"}],"version-history":[{"count":9,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/12540\/revisions"}],"predecessor-version":[{"id":20106,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/12540\/revisions\/20106"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12540"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}