{"id":709,"date":"2017-08-18T10:03:56","date_gmt":"2017-08-18T10:03:56","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=709"},"modified":"2017-08-18T10:03:56","modified_gmt":"2017-08-18T10:03:56","slug":"use-multipl-gcloud-configurations","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=709","title":{"rendered":"How To Use Multiple gcloud Configuration From a Single Workstation"},"content":{"rendered":"<p>Sometimes you might work with different google cloud accounts and want to have all the gcloud configuration on a single workstation.<\/p>\n<p>In this post I will explain how to configure multiple gcloud configuration on a single workstation.<\/p>\n<p>All the gcloud configs are present in  <code>~\/.config\/gcloud\/configurations<\/code> folder<\/p>\n<p>The configs present in the configurations folder would look like the following.<\/p>\n<pre><code>config_default       config_devopscube<\/code><\/pre>\n<p>As you can see, all the configurations start with the <code>config_<\/code> keyword.<\/p>\n<p>Follow the steps given below for the configuration<\/p>\n<ol>\n<li>cd in to the config directory.<\/li>\n<\/ol>\n<pre><code>~\/.config\/gcloud\/configurations<\/code><\/pre>\n<ol start=\"2\">\n<li>Create a new configuration file with&nbsp;<code>config_<\/code>&nbsp;prefix<\/li>\n<\/ol>\n<pre><code>vi config_demo-account<\/code><\/pre>\n<ol start=\"3\">\n<li>Enter the required parameters in the config file and save it. An example is shown below. You should change the values according to your google cloud account, project, zone and region.<\/li>\n<\/ol>\n<pre><code>[core]\naccount = accounts@devopscube.com\nproject = devopscube\n\n[compute]\nzone = asia-east1-b\t\nregion = asia-east1<\/code><\/pre>\n<ol start=\"4\">\n<li>For using any new configuration, you need to activate it. Use the following command to activate the configuration you created. You just need to specify the suffix of the configuration name as shown below.<\/li>\n<\/ol>\n<pre><code>gcloud config configurations activate demo-account<\/code><\/pre>\n<ol start=\"5\">\n<li>Once activated, login to the google cloud account using the following command.<\/li>\n<\/ol>\n<pre><code>gcloud auth login<\/code><\/pre>\n<ol start=\"6\">\n<li>Once logged in, you will be able to make all the gcloud api calls for the new configuration.<\/li>\n<\/ol>\n<p>Like this you can maintain multiple gcloud configuration and use it when ever you need it.<\/p>\n<p>Hope this article helps!<\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/use-multipl-gcloud-configurations\/\" target=\"_blank\" rel=\"noopener noreferrer\">How To Use Multiple gcloud Configuration From a Single Workstation \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/use-multipl-gcloud-configurations\/<\/p>\n","protected":false},"author":1,"featured_media":710,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=709"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/710"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}