Run the following command to register the Google account, region, and zone.
gcloud init
2
At the prompt, enter the number corresponding to `Sign in with a new Google Account` to log in to your Google account. If you are already logged in, enter the number corresponding to the account you want to use.
Choose the account you want to use for this configuration. To use a federated user account, exit this command and sign in to the gcloud CLI with your login configuration file, then run this command again. Select an account: [1] Sign in with a new Google Account [2] Skip this step Please enter your numeric choice:
3
Google Cloud allocates and uses resources on a per-project basis. Enter the number corresponding to `Create a new project` to create a new project. If you want to use an existing project, enter the number corresponding to that project.
Pick cloud project to use: [1] Enter a project ID [2] Create a new projectPlease enter numeric choice or text value (must exactly match list item):
4
At the prompt asking if you want to configure a default Compute Region and Zone, enter `y` and then enter the number corresponding to the region/zone you want to set as default.
Do you want to configure a default Compute Region and Zone? (Y/n)? yWhich Google Compute Engine zone would you like to use as project default?If you do not specify a zone via a command line flag while working with Compute Engine resources, the default is assumed. [1] us-east1-b [2] us-east1-c [3] us-east1-d [4] us-east4-c [5] us-east4-b [6] us-east4-a [7] us-central1-c [8] us-central1-a [9] us-central1-f [10] us-central1-b [11] us-west1-b [12] us-west1-c [13] us-west1-a...Did not print [75] options.Too many options [125]. Enter "list" at prompt to print choices fully.Please enter numeric choice or text value (must exactly match list item):
If you see the following message, the setup is complete.
...The Google Cloud CLI is configured and ready to use!* Commands that require authentication will use ale@example.com by default* Commands will reference project `ale` by default* Compute Engine commands will use region `asia-northeast3` by default* Compute Engine commands will use zone `asia-northeast3-a` by default...
Run the following command to log in to your Google account.
gcloud auth login
A browser will automatically open, displaying the Google account login page.
Once you complete the login process in the browser, you will see a confirmation message in the terminal.
2
Next, set the project by running the following command.