Create VPC network on google cloud

DandiLesmana
1 min readJun 15, 2024

--

open cloud shell and set project.

gcloud config set project [PROJECT_ID

set default region and zone.

gcloud config set compute/zone "us-east4-b"

gcloud config set compute/region "us-east4"

Membuat custom network

When manually assigning subnetwork ranges, you first create a custom subnet network, then create the subnetworks that you want within a region. You do not have to specify subnetworks for all regions right away, or even at all, but you cannot create instances in regions that have no subnetwork defined.

Saat menetapkan subnetwork ranges secara manual, Kita terlebih dahulu membuat custom subnet network, lalu membuat subnetwork yang Kita inginkan dalam region. Kita tidak harus menentukan subnetworks untuk semua regions secara langsung, atau bahkan sama sekali, namun Anda tidak dapat membuat instance di wilayah yang belum memiliki subnetwork yang ditentukan.

membuat custom network dengan Cloud Shell\

membuat custom network:

gcloud compute networks create backend-custom-network --subnet-mode custom

membuat subnet:

gcloud compute networks subnets create subnet-us-east4 \
--network backend-custom-network \
--region us-east4 \
--range 10.0.0.0/16

melihat list network yang ada di project kita:

gcloud compute networks subnets list \
--network mynetwork_name

SSH ke Virtual machine

# gcloud compute ssh --project=PROJECT_ID --zone=ZONE VM_NAME
gcloud compute ssh --project=qwiklabs-gcp-03-4e91cf9aaa0f --zone=us-east4-b us-test-01

--

--