{"id":3205,"date":"2022-11-30T22:16:36","date_gmt":"2022-11-30T13:16:36","guid":{"rendered":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/?p=3205"},"modified":"2022-11-30T22:16:36","modified_gmt":"2022-11-30T13:16:36","slug":"ssm-resize-instance","status":"publish","type":"post","link":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/blog\/2022\/11\/30\/ssm-resize-instance\/","title":{"rendered":"EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30b5\u30a4\u30ba\u3092SSM\u3067\u81ea\u52d5\u5909\u66f4\u3057\u3066\u307f\u305f"},"content":{"rendered":"
\u3057\u3085\u3093\u307a\u3044\u3067\u3059\u3002
\n\u696d\u52d9\u3067EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30b5\u30a4\u30ba\u3092\u591c\u9593\u306b\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u305f\u3081\u3001\u6307\u5b9a\u65e5\u6642\u306b\u81ea\u52d5\u5909\u66f4\u3067\u304d\u306a\u3044\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002
\n\u4eca\u56de\u306fAWS Systems Manager\u306e\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u5b9f\u73fe\u3057\u305f\u306e\u3067\u3001\u305d\u306e\u8981\u9818\u3092\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3059\u3002
\n\u3088\u308a\u30d9\u30bf\u30fc\u306a\u65b9\u6cd5\u306f\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4e00\u4f8b\u3068\u3057\u3066\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n
\u4eca\u56de\u306ft2.micro\u306eEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u7528\u610f\u3057\u307e\u3057\u305f\u3002\u3053\u308c\u3092t2.small\u306b\u30b9\u30b1\u30fc\u30eb\u30a2\u30c3\u30d7\u3057\u307e\u3059\u3002
\n<\/p>\n
\u524d\u63d0\u3068\u3057\u3066\u3001\u5f53\u8a72\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306f\u65e2\u306bSystems Manager\u306e\u30de\u30cd\u30fc\u30b8\u30c9\u30ce\u30fc\u30c9\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u3082\u306e\u3068\u3057\u307e\u3059\u3002 Systems Manager\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3092\u958b\u304d\u3001\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 \u3064\u3065\u3044\u3066\u3001\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u30bf\u30b9\u30af\u5b9f\u884c\u306b\u5fc5\u8981\u306aIAM\u30ed\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002 \u4e0a\u8a18\u30dd\u30ea\u30b7\u30fc\u3092\u30a2\u30bf\u30c3\u30c1\u3057\u305fIAM\u30ed\u30fc\u30eb\u3068\u3057\u3066\u300cresize-test-ssm-role\u300d\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n \u3064\u3065\u3044\u3066\u3001\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u306b\u30bf\u30b9\u30af\u3092\u767b\u9332\u3057\u307e\u3059\u3002 cron\u3067\u6307\u5b9a\u3057\u305f\u6642\u523b\u306e\u3042\u3068\u300c\u5c65\u6b74\u300d\u30bf\u30d6\u3092\u898b\u308b\u3068\u3001\u30bf\u30b9\u30af\u5b9f\u884c\u304c\u6210\u529f\u3057\u305f\u65e8\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002 Systems Manager\u304b\u3089\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u3092\u5909\u66f4\u3059\u308b\u65b9\u6cd5\u304c\u7d39\u4ecb\u3055\u308c\u3066\u3044\u308bWeb\u8a18\u4e8b\u306f\u65e2\u306b\u3042\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u7528\u3044\u3066\u5909\u66f4\u65e5\u6642\u3092\u6307\u5b9a\u3059\u308b\u65b9\u6cd5\u306f\u898b\u3064\u304b\u3089\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u672c\u8a18\u4e8b\u3092\u57f7\u7b46\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u306f\u3058\u3081\u306b \u3057\u3085\u3093\u307a\u3044\u3067\u3059\u3002 \u696d\u52d9\u3067EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30b5\u30a4\u30ba\u3092\u591c\u9593\u306b\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u3063\u305f\u305f\u3081\u3001\u6307\u5b9a\u65e5\u6642\u306b\u81ea\u52d5\u5909\u66f4\u3067\u304d\u306a\u3044\u304b\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u4eca\u56de\u306fAWS Systems Manager\u306e\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u5b9f\u73fe\u3057\u305f\u306e\u3067\u3001\u305d\u306e\u8981\u9818\u3092\u7d39\u4ecb\u3044\u305f\u3057\u307e\u3059\u3002 \u3088\u308a\u30d9\u30bf\u30fc\u306a\u65b9\u6cd5\u306f\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u4e00\u4f8b\u3068\u3057\u3066\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002 \u8a66\u3057\u305f\u3053\u3068 \u5909\u66f4\u5bfe\u8c61 \u4eca\u56de\u306ft2.micro\u306eEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092 […]<\/p>\n","protected":false},"author":24,"featured_media":3871,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[13],"tags":[344,404],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/3205"}],"collection":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/comments?post=3205"}],"version-history":[{"count":26,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/3205\/revisions"}],"predecessor-version":[{"id":3879,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/posts\/3205\/revisions\/3879"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media\/3871"}],"wp:attachment":[{"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/media?parent=3205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/categories?post=3205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/p-corporate-blog-cms.mmmcorp.co.jp\/wp-json\/wp\/v2\/tags?post=3205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\n
\n\u30de\u30cd\u30fc\u30b8\u30c9\u30ce\u30fc\u30c9\u3078\u306e\u767b\u9332\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u300cSystems Manager \u30b3\u30f3\u30bd\u30fc\u30eb\u306e [\u30de\u30cd\u30fc\u30b8\u30c9\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9] \u306b EC2 \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c\u8868\u793a\u3055\u308c\u306a\u3044\u306e\u306f\u306a\u305c\u3067\u3059\u304b?<\/a>\u300d\u304c\u5206\u304b\u308a\u3084\u3059\u304f\u3001\u53c2\u8003\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\u8a2d\u5b9a\u624b\u9806<\/h3>\n
\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u4f5c\u6210\u30fb\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u767b\u9332<\/h4>\n
\n\u307e\u305a\u3001\u9069\u5f53\u306a\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u540d\u3092\u4ed8\u3051\u307e\u3059\u3002
\n
\n\u3064\u3065\u3044\u3066\u3001cron\u5f0f\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30b5\u30a4\u30ba\u5909\u66f4\u3092\u5b9f\u884c\u3057\u305f\u3044\u65e5\u6642\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u305d\u306e\u4ed6\u9805\u76ee\u3082\u753b\u50cf\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u305f\u5f8c\u3001\u300c\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u4f5c\u6210\u300d\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b\u3057\u307e\u3059\u3002
\n
\n
\n\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u4f5c\u6210\u3055\u308c\u307e\u3057\u305f\u3002
\n<\/p>\nIAM\u30dd\u30ea\u30b7\u30fc\u30fb\u30ed\u30fc\u30eb\u4f5c\u6210<\/h4>\n
\n\u307e\u305a\u306f\u30ed\u30fc\u30eb\u306b\u30a2\u30bf\u30c3\u30c1\u3059\u308bIAM\u30dd\u30ea\u30b7\u30fc\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002
\n\u300c\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3001\u30e1\u30f3\u30c6\u30ca\u30f3\u30b9\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/a>\u300d\u306b\u30dd\u30ea\u30b7\u30fc\u306e\u96db\u5f62\u304c\u3042\u308b\u306e\u3067\u3053\u308c\u3092\u5229\u7528\u3057\u307e\u3059\u3002
\n\u96db\u5f62\u304b\u3089\u4e0d\u8981\u306a\u6a29\u9650\u8a2d\u5b9a\u306f\u524a\u9664\u3057\u307e\u3059\u3002
\n\u307e\u305f\u3001EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30b5\u30a4\u30ba\u306e\u5909\u66f4\u306b\u306fEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u72b6\u614b\u78ba\u8a8d\u30fb\u505c\u6b62\u30fb\u5c5e\u6027\u5909\u66f4\u30fb\u958b\u59cb\u3068\u3044\u3063\u305f\u64cd\u4f5c\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001\u3053\u308c\u3089\u3092\u8a31\u53ef\u3059\u308b\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002
\n\u7d50\u679c\u3068\u3057\u3066\u51fa\u6765\u4e0a\u304c\u3063\u305f\u30dd\u30ea\u30b7\u30fc\u306f\u6b21\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n{\n "Version": "2012-10-17",\n "Statement": [\n {\n "Effect": "Allow",\n "Action": [\n "ssm:SendCommand",\n "ssm:CancelCommand",\n "ssm:ListCommands",\n "ssm:ListCommandInvocations",\n "ssm:GetCommandInvocation",\n "ssm:GetAutomationExecution",\n "ssm:StartAutomationExecution",\n "ssm:ListTagsForResource",\n "ssm:GetParameters"\n ],\n "Resource": "*"\n },\n {\n "Effect": "Allow",\n "Action": "iam:PassRole",\n "Resource": "*",\n "Condition": {\n "StringEquals": {\n "iam:PassedToService": [\n "ssm.amazonaws.com"\n ]\n }\n }\n },\n {\n "Effect": "Allow",\n "Action": [\n "ec2:DescribeInstances",\n "ec2:DescribeInstanceStatus"\n ],\n "Resource": "*"\n },\n {\n "Effect": "Allow",\n "Action": [\n "ec2:StartInstances",\n "ec2:ModifyInstanceAttribute",\n "ec2:StopInstances"\n ],\n "Resource": "arn:aws:ec2:ap-northeast-1:\u3010\u30a2\u30ab\u30a6\u30f3\u30c8ID\u3011:instance\/\u3010\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9ID\u3011"\n }\n ]\n}<\/code><\/pre>\n
\u30bf\u30b9\u30af\u767b\u9332<\/h4>\n
\n\u300c\u30bf\u30b9\u30af\u300d\u30bf\u30d6\u306b\u300c\u30bf\u30b9\u30af\u306e\u767b\u9332\u300d\u30dc\u30bf\u30f3\u304c\u3042\u308a\u307e\u3059\u3002
\n\u30c9\u30ed\u30c3\u30d7\u30c0\u30a6\u30f3\u30e1\u30cb\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u3001\u300c\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3\u30bf\u30b9\u30af\u306e\u767b\u9332\u300d\u3092\u62bc\u4e0b\u3057\u307e\u3059\u3002
\n
\n\u30bf\u30b9\u30af\u767b\u9332\u753b\u9762\u306b\u884c\u304d\u7740\u304d\u307e\u3057\u305f\u3002
\n\u307e\u305a\u306f\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u3068\u3057\u3066\u300cAWS-ResizeInstance\u300d\u3092\u9078\u629e\u3057\u307e\u3059\u3002
\n
\n\u30bf\u30fc\u30b2\u30c3\u30c8\u3067\u3001\u30b5\u30a4\u30ba\u5909\u66f4\u3057\u305f\u3044\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u9078\u629e\u3057\u307e\u3059\u3002
\n
\n\u5165\u529b\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306f\u6b21\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u307e\u3057\u305f\u3002<\/p>\n\n
\n\u30ec\u30fc\u30c8\u5236\u5fa1\u306f\u6b21\u306e\u753b\u50cf\u306e\u3088\u3046\u306b\u5165\u529b\u3057\u307e\u3057\u305f\u3002
\n
\nIAM\u30b5\u30fc\u30d3\u30b9\u30ed\u30fc\u30eb\u306f\u3001\u5165\u529b\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u3067\u6307\u5b9a\u3057\u305f\u306e\u3068\u540c\u3058IAM\u30ed\u30fc\u30eb\u3092\u6307\u5b9a\u3057\u307e\u3057\u305f\u3002
\n
\n\u6700\u5f8c\u306b\u300c\u30aa\u30fc\u30c8\u30e1\u30fc\u30b7\u30e7\u30f3\u30bf\u30b9\u30af\u306e\u767b\u9332\u300d\u3092\u62bc\u4e0b\u3057\u307e\u3059\u3002
\n
\n\u30bf\u30b9\u30af\u767b\u9332\u3055\u308c\u307e\u3057\u305f\u3002
\n<\/p>\n\u7d50\u679c\u78ba\u8a8d<\/h3>\n
\n
\nEC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3092\u898b\u308b\u3068\u3001\u78ba\u304b\u306b\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30b5\u30a4\u30ba\u304ct2.micro\u304b\u3089t2.small\u3078\u3068\u5909\u66f4\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002
\n<\/p>\n\u304a\u308f\u308a\u306b<\/h2>\n
\nIAM\u6a29\u9650\u8a2d\u5b9a\u5468\u308a\u304c\u500b\u4eba\u7684\u306a\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8\u3067\u3057\u305f\u304c\u3001\u8a66\u884c\u932f\u8aa4\u306e\u672b\u3001\u306a\u3093\u3068\u304b\u76ee\u7684\u306f\u9054\u6210\u3067\u304d\u307e\u3057\u305f\u3002
\n\u672c\u8a18\u4e8b\u304c\u540c\u69d8\u306e\u8ab2\u984c\u306b\u53d6\u308a\u7d44\u3093\u3067\u304a\u3089\u308c\u308b\u65b9\u306e\u4e00\u52a9\u3068\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\u53c2\u8003<\/h2>\n
\n