...
각 OS별 프로그램 설치
gcloud init : gcloud 초기화시 project, region, zone 을 아래와 같이 선택함
region : asia-northeast3
zone : asia-northeast3-a
project : vntg-gwsample-dev-324106
gcloud 작동 확인 :
Code Block gcloud compute instances list
...
Code Block |
---|
$ gcloud init --project=vntg-gwsample-dev-324106 --skip-diagnostics $ gcloud config set project vntg-gwsample-dev-324106 $ gcloud config set compute/region asia-northeast3 $ gcloud config set compute/zone asia-northeast3-a |
...
Code Block |
---|
$ gcloud init $ gcloud config list [compute] region = asia-northeast3 zone = asia-northeast3-a [core] account = tjmoon@vntgcorptjmoon@samplecorp.com disable_usage_reporting = True project = vntg-gwsample-dev-324106 Your active configuration is: [default] |
...
Code Block |
---|
$ gcloud config set project vntgsample-gw-dev-324106 $ gcloud config set compute/region asia-northeast3 |
...
Code Block |
---|
$ gcloud projects describe vntg-gwsample-dev-324106 --format='value(projectNumber)' 446928390800 $ gcloud compute instances list --filter=name:gw-was-dev-1 --format='value(INTERNAL_IP)' 172.19.1.2 |
...
Python 세팅하기. 일반적인 Python 세팅을 하면 됨. Python용 Cloud 클라이언트 라이브러리는 아직 설치하지 않아도 됨. Python 개발환경 구성
Code Block |
---|
sudo apt update sudo apt install -y python3 python3-dev python3-venv python3-pip mkdir -p ~/.env/python3 python3 -m venv ~/.env/python3 source ~/.env/python3/bin/activate |
...
애플리케이션에서는 Google Cloud 클라이언트 라이브러리 를 이용하면 애플리케이션 기본 사용자 인증 정보(ADC)를 이용하여 필요한 사용자 인증 정보를 자동으로 찾아 애플리케이션을 인증할 수 있음.
...
Code Block |
---|
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git gcloud auth application-default login cd auth/cloud-client pip install -r requirements.txt $ python snippets.py implicit [<Bucket: staging.vntgsample-gw-dev-324106.appspot.com>, <Bucket: vntgsample-gw-attachment-dev>, <Bucket: vntg-gwsample-dev-324106.appspot.com>, <Bucket: vntgsample-gw-operation-dev>, <Bucket: vntgsample-gw-tm-operation-dev>] |
python IAM 예제
...
Code Block |
---|
git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git export GOOGLE_APPLICATION_CREDENTIALS="/root/service_account/vntgsample-gw-dev-324106-22a44b2dcdd9.json" cd iam/api-client/ pip install -r requirements.txt python3 access.py get vntg-gwsample-dev-324106 |