简体   繁体   中英

How to auto login to GCP using gcloud cli?

We have GCP account credentials(username/password). We have installed gcloud CLI on the Amazon Linux EC2 machine. We would like to create a script that would auto-login to the GCP account and do the below things sequentially using gcloud CLI.

  • Login to the GCP account.
  • Create Project and specify a meaningful project-id.
  • Create a service account with a meaningful ID.
  • Assign the owner role to the service account.
  • Create and download a new JSON key.

Please help us to achieve this

You should use a Service Account not a User (username|password) for automation. The Service Account should be suitably permissioned so that it can create Projects and Service Accounts.

I was unable to find a source for this (but it used to be that?) Google monitors User Accounts for apparent use of automation (eg for bots) and these accounts may be disabled.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM