{"id":1495,"date":"2023-11-11T15:46:00","date_gmt":"2023-11-11T06:46:00","guid":{"rendered":"https:\/\/hi3103.net\/notes\/?p=1495"},"modified":"2023-11-11T15:46:00","modified_gmt":"2023-11-11T06:46:00","slug":"windows-11-%e3%81%ab-gcloud-cli-%e3%82%92%e5%b0%8e%e5%85%a5%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/hi3103.net\/notes\/dev\/1495","title":{"rendered":"Windows 11 \u306b gcloud CLI \u3092\u5c0e\u5165\u3059\u308b"},"content":{"rendered":"<h3>\u6982\u8981<\/h3>\n<ul>\n<li>Google Cloud Platform \u306e\u304a\u52c9\u5f37\u3092\u3057\u306f\u3058\u3081\u305f\u3002<\/li>\n<li>Chrome \u4e0a\u3067 Cloud Shell \u3092\u4f7f\u3063\u3066\u3082\u3044\u3044\u306e\u3060\u304c\u3001\u624b\u5143\u3067\u53e9\u3051\u305f\u307b\u3046\u304c\u4fbf\u5229\u304b\u3082\u3068\u601d\u3063\u305f\u306e\u3067 gcloud CLI \u3092 Windows 11 \u306b\u5c0e\u5165\u3057\u3066\u307f\u308b\u3002<\/li>\n<\/ul>\n<h3>\u53c2\u7167\u3057\u305f\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/h3>\n<ul>\n<li><a href=\"https:\/\/cloud.google.com\/sdk\/docs\/install?hl=ja#windows\">gcloud CLI \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b| Google Cloud CLI \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/li>\n<li><a href=\"https:\/\/cloud.google.com\/sdk\/docs\/authorizing?hl=ja\">gcloud CLI \u3092\u627f\u8a8d\u3059\u308b| Google Cloud CLI \u306e\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/li>\n<\/ul>\n<p><!--more--><\/p>\n<h3>\u4f5c\u696d\u30ed\u30b0<\/h3>\n<h4>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h4>\n<p>PowerShell \u3092\u7acb\u3061\u4e0a\u3052\u3001\u4ee5\u4e0b\u3092\u5b9f\u884c\u3002<\/p>\n<pre><code class=\"language-bash\">(New-Object Net.WebClient).DownloadFile(\"https:\/\/dl.google.com\/dl\/cloudsdk\/channels\/rapid\/GoogleCloudSDKInstaller.exe\", \"$env:Temp\\GoogleCloudSDKInstaller.exe\")\n\n&amp; $env:Temp\\GoogleCloudSDKInstaller.exe<\/code><\/pre>\n<p>\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u30a6\u30a3\u30b6\u30fc\u30c9\u304c\u7acb\u3061\u4e0a\u304c\u308b\u306e\u3067 [Next] \u3067\u9032\u3081\u3066\u3044\u304f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-01.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<p>\u898f\u7d04\u306b\u540c\u610f\u3059\u308b\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-02.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u30e6\u30fc\u30b6\u30fc\u3092\u73fe\u5728\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u306e\u307f\u306b\u6307\u5b9a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-03.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5148 <code>C:\\Users\\\u30e6\u30fc\u30b6\u30fc\u540d\\AppData\\Local\\Google\\Cloud SDK<\/code> \u3092\u6307\u5b9a\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-04.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3082\u306e\u3092\u9078\u629e\u3002\u4eca\u56de\u306f Beta Commands \u4ee5\u5916\uff08\u4ee5\u4e0b3\u9805\u76ee\uff09\u306b\u30c1\u30a7\u30c3\u30af\u304c\u5165\u3063\u305f\u72b6\u614b\u3067 [Install] \u3092\u5b9f\u884c\u3057\u3068\u304f\u3002<\/p>\n<ul>\n<li>Google Cloud CLI Core Libraries and Tools<\/li>\n<li>Bundled Python<\/li>\n<li>Cloud Tools for PowerShell<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-05.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u9032\u884c\u4e2d\u2026<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-06.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<p>\u5b8c\u4e86\u3002\u4ee5\u4e0b\u3059\u3079\u3066\u306b\u30c1\u30a7\u30c3\u30af\u304c\u5165\u3063\u305f\u72b6\u614b\u3067 [Finish] \u3057\u3066\u307f\u308b\u3002<\/p>\n<ul>\n<li>Create Start Menu shortcut<\/li>\n<li>Create Desktop shortcut<\/li>\n<li>Start Google Cloud SDK Shell<\/li>\n<li>Run &#8216;gcloud init&#8217; to configure the Google Cloud CLI<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-07.png\" alt=\"\" width=\"499\" height=\"388\"  \/><\/p>\n<h4>\u521d\u671f\u8a2d\u5b9a<\/h4>\n<p>\u81ea\u52d5\u3067 <code>gcloud init<\/code> \u304c\u5b9f\u884c\u3055\u308c\u308b\u3002\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u304c\u7acb\u3061\u4e0a\u304c\u3063\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-08.png\" alt=\"\" width=\"1115\" height=\"628\"  \/><\/p>\n<p>\u6307\u793a\u306b\u5f93\u3063\u3066 Y \u5165\u529b\u3002<\/p>\n<pre><code class=\"language-bash\">Welcome to the Google Cloud CLI! Run \"gcloud -h\" to get the list of available commands.\n---\nWelcome! This command will take you through the configuration of gcloud.\n\nYour current configuration has been set to: [default]\n\nYou can skip diagnostics next time by using the following flag:\n  gcloud init --skip-diagnostics\n\nNetwork diagnostic detects and fixes local network connection issues.\nChecking network connection...done.\nReachability Check passed.\nNetwork diagnostic passed (1\/1 checks passed).\n\nYou must log in to continue. Would you like to log in (Y\/n)?<\/code><\/pre>\n<p>\u30d6\u30e9\u30a6\u30b6\u304c\u8d77\u52d5\u3059\u308b\u306e\u3067\u3001\u627f\u8a8d\u3059\u308b Google \u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u9078\u629e\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-09.png\" alt=\"\" width=\"509\" height=\"600\"  \/><\/p>\n<p>Google Cloud SDK \u306e\u30a2\u30af\u30bb\u30b9\u3092\u627f\u8a8d\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-10.png\" alt=\"\" width=\"395\" height=\"792\"  \/><\/p>\n<p>\u5b8c\u4e86\u753b\u9762\u306b\u9077\u79fb\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-11-830x1280.png\" alt=\"\" width=\"830\" height=\"1280\"  \/><\/p>\n<p>\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u306b\u623b\u308a\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u9078\u629e\u3002<\/p>\n<pre><code class=\"language-bash\">You are logged in as: [\u25ef\u25ef\u25ef\u25ef@gmail.com].\n\nPick cloud project to use:\n [1] \u65e2\u5b58\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u305d\u306e1\n [2] \u65e2\u5b58\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u305d\u306e2\n [3] Enter a project ID\n [4] Create a new project\nPlease enter numeric choice or text value (must exactly match list item):  2\n\nYour current project has been set to: [\u65e2\u5b58\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8 \u305d\u306e2].<\/code><\/pre>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30ea\u30fc\u30b8\u30e7\u30f3\uff0f\u30be\u30fc\u30f3\u3092\u6771\u4eac <code>asia-northeast1-b<\/code> \u306b\u3057\u3066\u304a\u304f<\/p>\n<pre><code class=\"language-bash\">Do you want to configure a default Compute Region and Zone? (Y\/n)?  Y\n\nWhich Google Compute Engine zone would you like to use as project default?\nIf you do not specify a zone via a command line flag while working with Compute Engine resources, the default is\nassumed.\n [1] us-east1-b\n [2] us-east1-c\n [3] us-east1-d\n [4] us-east4-c\n [5] us-east4-b\n [6] us-east4-a\n [7] us-central1-c\n [8] us-central1-a\n [9] us-central1-f\n [10] us-central1-b\n [11] us-west1-b\n [12] us-west1-c\n [13] us-west1-a\n [14] europe-west4-a\n [15] europe-west4-b\n [16] europe-west4-c\n [17] europe-west1-b\n [18] europe-west1-d\n [19] europe-west1-c\n [20] europe-west3-c\n [21] europe-west3-a\n [22] europe-west3-b\n [23] europe-west2-c\n [24] europe-west2-b\n [25] europe-west2-a\n [26] asia-east1-b\n [27] asia-east1-a\n [28] asia-east1-c\n [29] asia-southeast1-b\n [30] asia-southeast1-a\n [31] asia-southeast1-c\n [32] asia-northeast1-b\n [33] asia-northeast1-c\n [34] asia-northeast1-a\n [35] asia-south1-c\n [36] asia-south1-b\n [37] asia-south1-a\n [38] australia-southeast1-b\n [39] australia-southeast1-c\n [40] australia-southeast1-a\n [41] southamerica-east1-b\n [42] southamerica-east1-c\n [43] southamerica-east1-a\n [44] asia-east2-a\n [45] asia-east2-b\n [46] asia-east2-c\n [47] asia-northeast2-a\n [48] asia-northeast2-b\n [49] asia-northeast2-c\n [50] asia-northeast3-a\nDid not print [69] options.\nToo many options [119]. Enter \"list\" at prompt to print choices fully.\nPlease enter numeric choice or text value (must exactly match list item):  29<\/code><\/pre>\n<p>\u6e96\u5099\u5b8c\u4e86\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f\u3053\u3093\u306a\u8a2d\u5b9a\u306b\u306a\u3063\u305f\u3067\uff5e\u3068\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u78ba\u8a8d\u3057\u3066\u304a\u304f\u3002<\/p>\n<ul>\n<li>config \u30d5\u30a1\u30a4\u30eb\u306f\u4ee5\u4e0b\u306b\u751f\u6210\u3055\u308c\u3066\u3044\u308b\u3089\u3057\u3044\n<ul>\n<li><code>C:\\Users\\\u30e6\u30fc\u30b6\u30fc\u540d\\.boto<\/code><\/li>\n<\/ul>\n<\/li>\n<li>config \u306e\u8a2d\u5b9a\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u3092\u53c2\u7167\n<ul>\n<li><code>gcloud help config<\/code><\/li>\n<\/ul>\n<\/li>\n<li>gcloud \u30b3\u30de\u30f3\u30c9\u306e\u30d8\u30eb\u30d7\u306f\u4ee5\u4e0b\u3092\u53c2\u7167\n<ul>\n<li><code>gcloud --help<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\u3092\u9589\u3058\u308b\u3002<\/p>\n<h4>PowerShell \u3067 gcloud \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3046<\/h4>\n<h5>\u30d0\u30fc\u30b8\u30e7\u30f3\u78ba\u8a8d<\/h5>\n<p>\u307e\u305a\u306f\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u3001glocud \u30b3\u30de\u30f3\u30c9\u304c\u52d5\u304f\u304b\u78ba\u8a8d\u3002<\/p>\n<pre><code>gcloud --version<\/code><\/pre>\n<p>\u3061\u3083\u3093\u3068\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u554f\u984c\u306a\u3057\u3002<\/p>\n<pre><code class=\"language-bash\">Google Cloud SDK 454.0.0\nbq 2.0.98\ncore 2023.11.03\ngcloud-crc32c 1.0.0\ngsutil 5.27<\/code><\/pre>\n<h5>\u4f5c\u6210\u6e08\u307f VM \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3078 SSH \u3067\u63a5\u7d9a<\/h5>\n<p>\u7ba1\u7406\u753b\u9762\u304b\u3089\u30b3\u30de\u30f3\u30c9\u3092\u30b3\u30d4\u30da\u3057\u3001PowerShell \u4e0a\u3067\u5b9f\u884c\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-bash\">gcloud compute ssh --zone \"\u30be\u30fc\u30f3\u540d\" \"\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u540d\" --project \"\u30d7\u30ed\u30b8\u30a7\u30af\u30c8ID\"<\/code><\/pre>\n<p>PuTTY \u306e\u30a6\u30a3\u30f3\u30c9\u30a6\u304c\u7acb\u3061\u4e0a\u304c\u308a\u3001VM \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u4e0a\u306e\u64cd\u4f5c\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2023\/11\/2311-gcloud_setup-12.png\" alt=\"\" width=\"658\" height=\"416\"  \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Google Cloud Platform \u306e\u304a\u52c9\u5f37\u3092\u3057\u306f\u3058\u3081\u305f\u3002 Chrome \u4e0a\u3067 Cloud Shell \u3092\u4f7f\u3063\u3066\u3082\u3044\u3044\u306e\u3060\u304c\u3001\u624b\u5143\u3067\u53e9\u3051\u305f\u307b\u3046\u304c\u4fbf\u5229\u304b\u3082\u3068\u601d\u3063\u305f\u306e\u3067 gcloud CLI \u3092 Windows [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93],"tags":[104,103],"class_list":["post-1495","post","type-post","status-publish","format-standard","hentry","category-dev","tag-google-cloud-platform","tag-windows-11"],"_links":{"self":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/comments?post=1495"}],"version-history":[{"count":0,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1495\/revisions"}],"wp:attachment":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/media?parent=1495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/categories?post=1495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/tags?post=1495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}