- Welcome to Cloud Shell! Type "help" to get started.
- Your Cloud Platform project in this session is set to qwiklabs-gcp-00-28dd9ddb92e8.
- Use “gcloud config set project [PROJECT_ID]” to change to a different project.
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud auth list
- Credentialed Accounts
- ACTIVE ACCOUNT
- To set the active account, run:
- $ gcloud config set account `ACCOUNT`
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud config list project
- [core]
- project = qwiklabs-gcp-00-28dd9ddb92e8
- Your active configuration is: [cloudshell-18767]
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud config set compute/zone us-central1-a
- Updated property [compute/zone].
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud config set compute/region us-central1
- Updated property [compute/region].
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ cat << EOF > startup.sh
- > #! /bin/bash
- > apt-get update
- > apt-get install -y nginx
- > service nginx start
- > sed -i -- 's/nginx/Google Cloud Platform - '"\$HOSTNAME"'/' /var/www/html/index.nginx-debian.html
- > EOF
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute instance-templates create nginx-temp
- late \
- > --metadata-from-file startup-script=startup.sh
- Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-00-28dd9ddb92e8/global/instanceTemplates/nginx-temp
- late].
- NAME MACHINE_TYPE PREEMPTIBLE CREATION_TIMESTAMP
- nginx-template n1-standard-1 2021-02-23T07:02:07.227-08:00
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute target-pools create nginx-pool
- Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-00-28dd9ddb92e8/regions/us-central1/targetPools/ngi
- nx-pool].
- NAME REGION SESSION_AFFINITY BACKUP HEALTH_CHECKS
- nginx-pool us-central1 NONE
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute instance-groups managed create nginx-group \
- > --base-instance-name nginx \
- > --size 2 \
- > --template nginx-template \
- > --target-pool nginx-pool
- Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-00-28dd9ddb92e8/zones/us-central1-a/instanceGroupManagers/nginx-group].
- NAME LOCATION SCOPE BASE_INSTANCE_NAME SIZE TARGET_SIZE INSTANCE_TEMPLATE AUTOSCALED
- nginx-group us-central1-a zone nginx 0 2 nginx-template no
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute instances list
- NAME ZONE MACHINE_TYPE PREEMPTIBLE INTERNAL_IP EXTERNAL_IP STATUS
- nginx-h2sl us-central1-a n1-standard-1 10.128.0.2 104.197.62.209 RUNNING
- nginx-ppx6 us-central1-a n1-standard-1 10.128.0.3 34.122.69.161 RUNNING
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$ gcloud compute firewall-rules create www-firewall --allow tcp:80
- Creating firewall...⠹Created [https://www.googleapis.com/compute/v1/projects/qwiklabs-gcp-00-28dd9ddb92e8/global/firewalls/www-firewall].
- Creating firewall...done.
- NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED
- www-firewall default INGRESS 1000 tcp:80 False
- student_00_4e6900e41e47@cloudshell:~ (qwiklabs-gcp-00-28dd9ddb92e8)$