Facebook
From raf, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 79
  1. Welcome to Cloud Shell! Type "help" to get started.
  2. Your Cloud Platform project in this session is set to qwiklabs-gcp-00-28dd9ddb92e8.
  3. Use “gcloud config set project [PROJECT_ID]” to change to a different project.
  4. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud auth list
  5.            Credentialed Accounts
  6. ACTIVE  ACCOUNT
  7. To set the active account, run:
  8.     $ gcloud config set account `ACCOUNT`
  9. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud config list project
  10. [core]
  11. project = qwiklabs-gcp-00-28dd9ddb92e8
  12. Your active configuration is: [cloudshell-18767]
  13. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud config set compute/zone us-central1-a
  14. Updated property [compute/zone].
  15. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud config set compute/region us-central1
  16. Updated property [compute/region].
  17. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ cat << EOF > startup.sh
  18. > #! /bin/bash
  19. > apt-get update
  20. > apt-get install -y nginx
  21. > service nginx start
  22. > sed -i -- 's/nginx/Google Cloud Platform - '"\$HOSTNAME"'/' /var/www/html/index.nginx-debian.html
  23. > EOF
  24. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute instance-templates create nginx-temp
  25. late \
  26. >          --metadata-from-file startup-script=startup.sh
  27. Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-00-28dd9ddb92e8/global/instanceTemplates/nginx-temp
  28. late].
  29. NAME            MACHINE_TYPE   PREEMPTIBLE  CREATION_TIMESTAMP
  30. nginx-template  n1-standard-1               2021-02-23T07:02:07.227-08:00
  31. student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute target-pools create nginx-pool
  32. Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-00-28dd9ddb92e8/regions/us-central1/targetPools/ngi
  33.