{"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":"

\u306f\u3058\u3081\u306b<\/h2>\n

\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

\u8a66\u3057\u305f\u3053\u3068<\/h2>\n

\u5909\u66f4\u5bfe\u8c61<\/h3>\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
\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

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
\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>\n

IAM\u30dd\u30ea\u30b7\u30fc\u30fb\u30ed\u30fc\u30eb\u4f5c\u6210<\/h4>\n

\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
\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

\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

\u30bf\u30b9\u30af\u767b\u9332<\/h4>\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
\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