Gcp

Gcp

Gcp

cloud cdn + share storage

需要给cdn授权,并且设置sign key

1
gsutil iam ch serviceAccount:service-xxx@cloud-cdn-fill.iam.gserviceaccount.com:objectViewer gs://BUCKET_NAME

gcloud安装

1
2
3
4
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-435.0.1-linux-x86_64.tar.gz
tar xf google-cloud-cli-435.0.1-linux-x86_64.tar.gz
cd google-cloud-sdk/
./install.sh

记得重新进入下shell

账号认证设置,加入你是service account

1
gcloud auth activate-service-account --key-file="/xxx/sa.json"

剩下缺少啥在iam授权就好了

如果是普通用户,使用login命令,剩下按照提示就好了

1
gcloud auth login

导出内外网ip

1
gcloud compute instances list --format="csv(name,zone,networkInterfaces[0].networkIP,networkInterfaces[0].accessConfigs[0].natIP)"

关闭机器

1
2
3
4
5
[root@xxx ~]# gcloud compute instances stop team-3  team-4 
No zone specified. Using zone [us-central1-a] for instances: [team-3, team-4].
Stopping instance(s) team-3, team-4...done.                                                                                    
Updated [https://compute.googleapis.com/compute/v1/projects/xxx-project/zones/us-central1-a/instances/team-3].
Updated [https://compute.googleapis.com/compute/v1/projects/xxx-project/zones/us-central1-a/instances/team-4].

参考文档