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