GCP 자습서 시도 'VPC 만들기 및 삭제'
제목
표제의 튜토리얼을 시험해 보자.
【참조】
htps : // c ぉ d. 오, ぇ. 이 m/vpc/도cs/우신 g-vpc? 아우테세 r = 1 & hl =
전제
gcloud
명령이 설치되었습니다. Virtual Private Cloud(VPC)
자동 모드 VPC 네트워크 생성
$ gcloud compute networks create auto-network1 --subnet-mode auto
Created [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/global/networks/auto-network1].
NAME SUBNET_MODE BGP_ROUTING_MODE IPV4_RANGE GATEWAY_IPV4
auto-network1 AUTO REGIONAL
Instances on this network will not be reachable until firewall rules
are created. As an example, you can allow all internal traffic between
instances as well as SSH, RDP, and ICMP by running:
$ gcloud compute firewall-rules create --network auto-network1 --allow tcp,udp,icmp --source-ranges
$ gcloud compute firewall-rules create --network auto-network1 --allow tcp:22,tcp:3389,icmp
작성 결과
각 지역마다 서브넷이 하나씩 만들어집니다.
아시아 지역에 대해 자세히 알아보기
맞춤 서브넷을 사용하여 VPC 네트워크 생성
$ gcloud compute networks create custom-network1 --subnet-mode custom
Created [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/global/networks/custom-network1].
NAME SUBNET_MODE BGP_ROUTING_MODE IPV4_RANGE GATEWAY_IPV4
custom-network1 CUSTOM REGIONAL
Instances on this network will not be reachable until firewall rules
are created. As an example, you can allow all internal traffic between
instances as well as SSH, RDP, and ICMP by running:
$ gcloud compute firewall-rules create --network custom-network1 --allow tcp,udp,icmp --source-ranges
$ gcloud compute firewall-rules create --network custom-network1 --allow tcp:22,tcp:3389,icmp
작성 결과
사용자 정의의 경우 서브넷은 마음대로 만들 수 없습니다.
커스텀 서브넷의 리전 3개에 대한 서브넷 생성
$ gcloud compute networks subnets create subnets-us-central-192 --network custom-network1 --region us-central1 --range 192.168.1.0/24
$ gcloud compute networks subnets create subnets-europe-west-192 --network custom-network1 --region europe-west1 --range 192.168.5.0/24
$ gcloud compute networks subnets create subnets-asia-east-192 --network custom-network1 --region asia-east1 --range 192.168.7.0/24
Created [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/regions/us-central1/subnetworks/subnets-us-central-192].
NAME REGION NETWORK RANGE
subnets-us-central-192 us-central1 custom-network1 192.168.1.0/24
Created [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/regions/europe-west1/subnetworks/subnets-europe-west-192].
NAME REGION NETWORK RANGE
subnets-europe-west-192 europe-west1 custom-network1 192.168.5.0/24
Created [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/regions/asia-east1/subnetworks/subnets-asia-east-192].
NAME REGION NETWORK RANGE
subnets-asia-east-192 asia-east1 custom-network1 192.168.7.0/24
작성 결과 확인
$ gcloud compute networks subnets list | grep custom-network1
subnets-asia-east-192 asia-east1 custom-network1 192.168.7.0/24
subnets-europe-west-192 europe-west1 custom-network1 192.168.5.0/24
subnets-us-central-192 us-central1 custom-network1 192.168.1.0/24
$ gcloud compute networks subnets describe subnets-asia-east-192 --region asia-east1
creationTimestamp: '2018-08-09T08:36:58.521-07:00'
fingerprint: XXX-XXXXXXXX
gatewayAddress: 192.168.7.1
id: '1111111111111111111'
ipCidrRange: 192.168.7.0/24
kind: compute#subnetwork
name: subnets-asia-east-192
network: https://www.googleapis.com/compute/v1/projects/XXXXXXXX/global/networks/custom-network1
privateIpGoogleAccess: false
region: https://www.googleapis.com/compute/v1/projects/XXXXXXXX/regions/asia-east1
selfLink: https://www.googleapis.com/compute/v1/projects/XXXXXXXX/regions/asia-east1/subnetworks/subnets-asia-east-192
작성한 리전마다 서브넷이 하나씩 만들어진다.
미국 중앙 지역에 대해 자세히 알아보기
맞춤 서브넷 삭제
자동으로 생성된 서브넷은 개별적으로 삭제할 수 없습니다. 삭제하려면 VPC 네트워크 전체 삭제가 필요.
$ gcloud compute networks subnets delete subnets-asia-east-192 --region asia-east1
The following subnetworks will be deleted:
- [subnets-asia-east-192] in [asia-east1]
Do you want to continue (Y/n)? y
Deleted [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/regions/asia-east1/subnetworks/subnets-asia-east-192].
삭제 결과
VPC 네트워크 삭제
$ gcloud compute networks delete auto-network1
The following networks will be deleted:
- [auto-network1]
Do you want to continue (Y/n)? y
Deleted [https://www.googleapis.com/compute/v1/projects/XXXXXXXX/global/networks/auto-network1].
Reference
이 문제에 관하여(GCP 자습서 시도 'VPC 만들기 및 삭제'), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/sky0621/items/15634150c0099ef8e609텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)