{"id":158,"date":"2022-07-03T20:11:44","date_gmt":"2022-07-03T11:11:44","guid":{"rendered":"https:\/\/th0x0472.net\/?p=158"},"modified":"2022-07-12T07:29:15","modified_gmt":"2022-07-11T22:29:15","slug":"ec2%e3%82%a4%e3%83%b3%e3%82%b9%e3%82%bf%e3%83%b3%e3%82%b9%e3%81%b8%e3%81%ae%e3%82%b7%e3%83%aa%e3%82%a2%e3%83%ab%e3%82%b3%e3%83%b3%e3%82%bd%e3%83%bc%e3%83%ab%e6%8e%a5%e7%b6%9a%e3%81%ab%e3%83%88","status":"publish","type":"post","link":"https:\/\/th0x0472.net\/index.php\/2022\/07\/03\/158\/","title":{"rendered":"EC2\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3078\u306e\u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u63a5\u7d9a\u306b\u30c8\u30e9\u30a4\u3057\u305f"},"content":{"rendered":"<p>awscli\u306b\u30c8\u30e9\u30a4\u3057\u307e\u3059\u3088\u3002\u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u3064\u306a\u3044\u3067\u307f\u308b\u306e\u3067\u3059\u3002<!--more-->\u666e\u6bb5\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u308b\u30e6\u30fc\u30b6\u306b\u306fIAM\u306e\u6a29\u9650\u306f\u4ed8\u3051\u3066\u3044\u306a\u304f\u3066\u3001\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3082\u306a\u3044\u306e\u3067\u3001root\u30e6\u30fc\u30b6\u3067\u4f5c\u696d\u3067\u3059\u3002\u7dca\u5f35\u3057\u307e\u3059\u3002CLI\u7528\u306e\u30e6\u30fc\u30b6\u3092\u4f5c\u3063\u3066\u30a2\u30af\u30bb\u30b9\u30ad\u30fc\u3092\u767a\u884c\u3057\u307e\u3059\u3002<\/p>\n<p>\u7d9a\u3044\u3066awscli\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u3059\u3002WSL2\u306eUbun22.04\u304b\u3089\u3082awscli\u4f7f\u3048\u307e\u3059\u3002\u65e9\u901f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ sudo apt search awscli\r\nawscli\/jammy,now 1.22.34-1 all [installed]\r\nUniversal Command Line Environment for AWS\r\n$ sudo apt -y install awscli<\/code><\/pre>\n<\/div>\n<p>\u3053\u3061\u3089\u306e\u300c<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/cli\/latest\/userguide\/cli-configure-quickstart.html\" rel=\"noopener\" target=\"_blank\">\u8a2d\u5b9a\u306e\u57fa\u672c<\/a>\u300d\u3092\u53c2\u8003\u306b<code>aws configure<\/code>\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3064\u3065\u3044\u3066\u3001\u300c<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AWSEC2\/latest\/UserGuide\/monitoring-system-instance-status-check.html\" target=\"_blank\" rel=\"noopener\">\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u30c1\u30a7\u30c3\u30af<\/a>\u300d\u3092\u53c2\u8003\u306b\u3001awscli\u3092\u304a\u8a66\u3057\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-json\" data-lang=\"JSON\"><code>$ aws ec2 describe-instance-status | jq '.InstanceStatuses[].InstanceState'\r\n{\r\n\"Code\": 16,\r\n\"Name\": \"running\"\r\n}<\/code><\/pre>\n<\/div>\n<p>\u3061\u3083\u3093\u3068\u30b9\u30c6\u30fc\u30bf\u30b9\u898b\u3048\u307e\u3059\u3002\u305d\u308c\u3067\u306f\u672c\u984c\u306essh\u7d4c\u7531\u306e\u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u63a5\u7d9a\u3067\u3059\u3002\u3044\u3056\u3001SSH\u516c\u958b\u9375\u3092\u7a81\u3063\u8fbc\u307f\u307e\u3059\u3002\u30fb\u30fb\u30fb\u304c\u3001\u30a8\u30e9\u30fc\u3067\u306f\u3058\u304b\u308c\u307e\u3057\u305f\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>$ aws ec2-instance-connect send-serial-console-ssh-public-key \\\r\n&gt; --instance-id i-instance-id \\\r\n&gt; --serial-port 0 \\\r\n&gt; --ssh-public-key file:\/\/~\/.ssh\/id_th0x0472.pub \\\r\n&gt; --region ap-northeast-1\r\n\r\nAn error occurred (EC2InstanceTypeInvalidException) when calling the SendSerialConsoleSSHPublicKey operation:<\/code><\/pre>\n<\/div>\n<p><code>EC2InstanceTypeInvalidException<\/code>\u3063\u3066\u8a00\u308f\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u304c\u30c0\u30e1\u306a\u306e\u304b\u306a\uff1f<\/p>\n<p>WebUI\u306e\u30b3\u30f3\u30bd\u30fc\u30eb\u304b\u3089[EC2]\u2192[\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9]\u2192[i-instance-id]\u2192[\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u63a5\u7d9a]\u3068\u305f\u3069\u3063\u3066\u307f\u308b\u3068\u3001\u300c\u3053\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u306f\u3001EC2 \u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u3067\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u300d\u3068\u8a00\u308f\u308c\u3066\u3057\u307e\u3044\u307e\u3057\u305f\u3002<strong>\u304b\u306a\u3057\u3044\u30fb\u30fb\u30fb<\/strong>\u3002<\/p>\n<blockquote><p>EC2 \u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3053\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306b\u63a5\u7d9a\u3059\u308b\u306b\u306f\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u304c AWS Nitro System \u4e0a\u306b\u69cb\u7bc9\u3055\u308c\u305f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u30bf\u30a4\u30d7\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p><\/blockquote>\n<p>\u3060\u305d\u3046\u3067\u3059\u3002Nitro System\u3067\u3059\u304b\u30fb\u30fb\u30fbt2\u30b7\u30ea\u30fc\u30ba\u306f\u9055\u3046\u3093\u3067\u3059\u304b\u306d\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u300c<a href=\"https:\/\/docs.aws.amazon.com\/ja_jp\/AWSEC2\/latest\/UserGuide\/instance-types.html#ec2-nitro-instances\" target=\"_blank\" rel=\"noopener\">Nitro System \u4e0a\u306b\u69cb\u7bc9\u3055\u308c\u305f\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9<\/a>\u300d\u306e\u30da\u30fc\u30b8\u306b\u3088\u308b\u3068\u3001t2\u306f\u30c0\u30e1\u3060\u3051\u3069t3\u306f\u3044\u3051\u308b\u305d\u3046\u3067\u3059\u3002<\/p>\n<p>\u7121\u511f\u671f\u9593\u3082\u7d42\u308f\u308b\u3057\u3001t2.micro\u304b\u3089\u4e57\u308a\u63db\u3048\u307e\u3059\u304b\u30fb\u30fb\u30fb\u9806\u5f53\u306b\u3044\u3051\u3070t3.micro\u304b\u306a\u3002<\/p>\n<p>t3.micro\u306e\u30aa\u30f3\u30c7\u30de\u30f3\u30c9\u4fa1\u683c\u3092\u8abf\u3079\u308b\u3068\u3001\u6771\u4eac\u30ea\u30fc\u30b8\u30e7\u30f3\u306f0.0136 USD\u3067\u3001\u30aa\u30ec\u30b4\u30f3\u306f0.0104 USD\u3060\u305d\u3046\u3067\u3059\u3002\u305d\u306e\u5dee0.0032USD\u3002750\u6642\u9593\u304b\u3051\u3066\u307f\u308b\u30682.4\u30c9\u30eb\u3061\u304c\u3046\u3002\u5186\u5b89\u306e\u4eca\u306fGoogle\u5148\u751f\u306b\u3088\u308b\u3068\u300c<a href=\"https:\/\/www.google.com\/search?q=2.4%E3%83%89%E3%83%AB\" target=\"_blank\" rel=\"noopener\">2.4 \u30a2\u30e1\u30ea\u30ab\u5408\u8846\u56fd\u30c9\u30eb \u306f324.54 \u5186<\/a>\u300d\u3060\u305d\u3046\u3067\u3059\u3002\u30af\u30ec\u30ab\u306e\u30ec\u30fc\u30c8\u3067\u8ab2\u91d1\u3055\u308c\u308b\u3053\u3068\u3082\u8003\u616e\u3059\u308b\u3068\u5e74\u95934000\u5186\u306f\u9055\u3063\u3066\u304d\u305d\u3046\u3002\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u30aa\u30ec\u30b4\u30f3\u306b\u304a\u5f15\u8d8a\u3057\u304b\u306a\u3041\u3002<\/p>\n<p>\u4eca\u5ea6\u3053\u305d\u307e\u305f\u6765\u9031\u3001\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>awscli\u306b\u30c8\u30e9\u30a4\u3057\u307e\u3059\u3088\u3002\u30b7\u30ea\u30a2\u30eb\u30b3\u30f3\u30bd\u30fc\u30eb\u3064\u306a\u3044\u3067\u307f\u308b\u306e\u3067\u3059\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,4,10],"tags":[],"class_list":["post-158","post","type-post","status-publish","format-standard","hentry","category-aws","category-linux","category-10"],"_links":{"self":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts\/158","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/comments?post=158"}],"version-history":[{"count":1,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts\/158\/revisions"}],"predecessor-version":[{"id":159,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/posts\/158\/revisions\/159"}],"wp:attachment":[{"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/media?parent=158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/categories?post=158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/th0x0472.net\/index.php\/wp-json\/wp\/v2\/tags?post=158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}