Claud Shell commands-Virtual Networks Module 1.2.5 Flashcards
create the privatenet
gcloud compute networks create privatenet –subnet-mode=custom
create the privatesubnet-us subnet
gcloud compute networks subnets create privatesubnet-us –network=privatenet –region=Lab region –range=172.16.0.0/24
list the available VPC networks
gcloud compute networks list
To list the available VPC subnets (sorted by VPC network)
gcloud compute networks subnets list –sort-by=NETWORK
create the privatenet-allow-icmp-ssh-rdp firewall rule
gcloud compute firewall-rules create privatenet-allow-icmp-ssh-rdp –direction=INGRESS –priority=1000 –network=privatenet –action=ALLOW –rules=icmp,tcp:22,tcp:3389 –source-ranges=0.0.0.0/0
list all the firewall rules
gcloud compute firewall-rules list –sort-by=NETWORK
create the privatenet-us-vm instance
gcloud compute instances create privatenet-us-vm –zone=Lab Zone –machine-type=e2-micro –subnet=privatesubnet-us –image-family=debian-11 –image-project=debian-cloud –boot-disk-size=10GB –boot-disk-type=pd-standard –boot-disk-device-name=privatenet-us-vm
all the VM instances (sorted by zone)
gcloud compute instances list –sort-by=ZONE
ssh to vm-internal through IAP tunel
gcloud compute ssh vm-internal –zone us-central1-c –tunnel-through-iap.
iap needs to be enabled by firewall
If instance doesn’t have external IP we can’t simple ssh to it from cloud shel
set the project Id
gcloud config set project [projectID]
Copy an image from a public Cloud Storage bucket to your own bucket.
gsutil cp gs://cloud-training/gcpnet/private/access.svg gs://$MY_BUCKET
cloud bucket get the default access list that’s been assigned to setup.html
gsutil acl get gs://$BUCKET_NAME_1/setup.html
cloud bucket set the access list to private
gsutil acl set private gs://$BUCKET_NAME_1/setup.html
cloud bucket update the access list to make the file publicly readable
gsutil acl ch -u AllUsers:R gs://$BUCKET_NAME_1/setup.html
cloud bucket create boto file for configuring your own encryption keys
gsutil config -n