반응형

Tasks 

A new non-default VPC has been created
The new VPC contains a new non-default subnet within it
A firewall rule exists that allows TCP port 3389 traffic ( for RDP )
A Windows compute instance called vm-bastionhost exists that has a public ip-address to which the TCP port 3389 firewall rule applies.
A Windows compute instance called vm-securehost exists that does not have a public ip-address
The vm-securehost is running Microsoft IIS web server software.

 

1. Network 및 subnet 생성 

Network 와 subnet 이름은 둘다 securenetwork 로 한다.

 

- Network 생성

gcloud compute --project=qwiklabs-gcp-02-79731d4c62ae networks create securenetwork --subnet-mode=custom

 

- Subnet 생성

gcloud compute --project=qwiklabs-gcp-02-79731d4c62ae networks subnets create securenetwork --network=securenetwork --region=us-central1 --range=192.168.1.0/24

 

2. Firewall 생성

gcloud compute firewall-rules create myfirewalls --network securenetwork --allow=tcp:3389 --target-tags=rdp


target-tags 를 지정해야 나중에 instance의 network tag 를 지정할때 사용할 수 있다.

 

3. vm-securehost Instance 생성

gcloud beta compute --project=qwiklabs-gcp-02-46d92a9845e4 instances create vm-securehost --zone=us-central1-a --machine-type=n1-standard-2 --subnet=securenetwork --no-address --maintenance-policy=MIGRATE --service-account=365821737857-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --image=windows-server-2016-dc-v20200211 --image-project=windows-cloud --boot-disk-size=50GB --boot-disk-type=pd-standard --boot-disk-device-name=vm-securehost --reservation-affinity=any

 

Instance 생성은 GCP 화면 에서 하는것이 더 편할 수도 있다. 위 스크립트도 화면에서 설정한 다음 command line 스크립트를 복사해 놓은 것이다.

 

4. vm-bastionhost Instance 생성

gcloud beta compute --project=qwiklabs-gcp-02-46d92a9845e4 instances create vm-bastionhost --zone=us-central1-a --machine-type=n1-standard-2 --subnet=securenetwork --network-tier=PREMIUM --maintenance-policy=MIGRATE --service-account=365821737857-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --tags=rdp --image=windows-server-2016-dc-v20200211 --image-project=windows-cloud --boot-disk-size=50GB --boot-disk-type=pd-standard --boot-disk-device-name=vm-bastionhost --reservation-affinity=any

 

각각 Instance 생성시 주의 할 점은 vm-bastionhost 는 Network tag 에 위에서 firewall 생성시 썼던 target-tag 를 적어줘야 한다.

instance type 은 기본으로 선택되어있는 최소 사양이 아닌 다음 것으로 해주는게 좋다. 최소 사양은 나중에 구동시에 리소스가 부족해서 안되는 경우도 있다. 

 

5. 윈도우의 접속  ID 및 Password 는 화면에 나온대로 실행을 해준다.

그리고 나중에 securehost 접속시에도 위와 동일하게 vm-bastionhost 를 vm-securehost 로 번경해서 username 과 password 를 확인한 뒤 접속하면 된다.

 

728x90
반응형

+ Recent posts