-
Notifications
You must be signed in to change notification settings - Fork 50
GCP Price Info Driver Development Guide
ByoungSeob Kim edited this page Jan 9, 2024
·
12 revisions
* GCP Price Info 드라이버 개발관련 이슈를 위한 가이드
- GetPriceInfo() 제공 형상을 위한 적합한 API 부재
- 1개 이상의 API 조합으로 생성/변환으로 가능하지만,
- (이슈-1) 베타 버전 API 활용으로 추후 잠재적 이슈 발생 가능
- (이슈-2) CSP API의 과한 호출 필요 => Call Limit 발생 => worst elapsed time (최소 18분)
- 세부 내용: 다음 MSG 참고
- (1) SKU 기반 가격 정보 제공 방법
- (2) Cost Estimation, Cost Calculator를 활용한 가격 정보 제공 방법
- (3) 인스턴스 타입(머신 타입) 중심 가격 정보 제공 방법
-
※ (1), (2), (3) 개별 방법으로는 Spider GetPriceInfo() 형상 제공 어려움
- (1) 방법: 타 CSP와 달리 SKU 제품 정보에 인스턴스 관련 정보가 부족
- (2) 방법: 사용할 자원/서비스 단위 입력을 통한 예상 가격을 제공 => 필요한 모든 자원/서비스에 대한 입력 필요, Call Limit 이슈 등
- (3) 방법: Cached 정보 또는 Web Page 형태로 제공 => old 가격 정보 또는 html 파싱이 필요 => 유지보수 이슈 등 리스크 존재
- 관련 현황
- SKU ID에 관련된 Instance type을 얻고자 하는데, 얻기 힘들 다는 이슈 (근래에도 리플이 달리고 있음)
-
[참고: SKU & Cloud SKU]
- API/CLI 등을 통해서 전체 제품/서비스별 가격 정책을 상세하게 제공
- 다만, VM 인스턴스 타입(머신 타입) 정보가 Spider에서 제공하는 수준의 정보가 포함되어 있지 않음
- SKU 기반 가격 정보에 포함된 인스턴스 타입 정보는
resourceGroup및description등에 약하게 포함 - 사실, GCP의 경우 인스턴스 타입을 사용자가 생성할 수 있기 때문에 SKU 입장에서는 사전 정의된 인스턴스 타입의 중요도가 크지 않는 듯함
- 대신, 인스턴스 타입 그룹(N1Standard 등)의 CPU, Mem 기준 가격을 제시하고 있음
- 개별 인스턴스 타입(n1-standard-16 )에 대한 가격은 계산으로 얻을 수 있음
[사전 준비]
- API Key 생성: Web Console => API 및 서비스 => 사용자 인증 정보 => + 사용자 인증 정보 만들기 => API Key
- Cloud Billing API Enable 방법 예시
- 다음 링크 실행(project 이름 변경 필요) 후 Enable 설정
- https://console.cloud.google.com/apis/library/cloudbilling.googleapis.com?project=powerkimhub
[활용 예시 및 제공 정보]
- service 목록(serviceId 포함) (관련 API: https://cloud.google.com/billing/docs/reference/rest/v1/services )
$ curl https://cloudbilling.googleapis.com/v1/services?key={your API KEY} # 한번에 전부 제공
{
"services": [
{
"name": "services/0017-8C5E-5B91",
"serviceId": "0017-8C5E-5B91",
"displayName": "OpenLogic CentOS 7.8 (v20200922) - Security Hardened",
"businessEntityName": "businessEntities/GCP"
},
...
- Compute Engine 가격 목록(skus-based) (관련 API: https://cloud.google.com/billing/docs/reference/rest/v1/services.skus/list )
- Compute engine의 경우 serviceId: 6F81-5844-456A
$ curl https://cloudbilling.googleapis.com/v1/services/6F81-5844-456A/skus?key={your API KEY} # 전체 제공 받으려면, Next Page 3번 정도 Call 해야 함(https://...&pageToken=xxx)
{
"skus": [
{
"name": "services/6F81-5844-456A/skus/0006-C9C8-BB6F",
"skuId": "0006-C9C8-BB6F",
"description": "Commitment v1: Memory-optimized Cpu in Phoenix for 1 Year",
"category": {
"serviceDisplayName": "Compute Engine",
"resourceFamily": "Compute",
"resourceGroup": "CPU",
"usageType": "Commit1Yr"
},
"serviceRegions": [
"us-west8"
],
"pricingInfo": [
{
"summary": "",
"pricingExpression": {
"usageUnit": "h",
"displayQuantity": 1,
"tieredRates": [
{
"startUsageAmount": 0,
"unitPrice": {
"currencyCode": "USD",
"units": "0",
"nanos": 20550000
}
}
],
"usageUnitDescription": "hour",
"baseUnit": "s",
"baseUnitDescription": "second",
"baseUnitConversionFactor": 3600
},
"currencyConversionRate": 1,
"effectiveTime": "2024-01-08T08:49:30.488759Z"
}
],
"serviceProviderName": "Google",
"geoTaxonomy": {
"type": "REGIONAL",
"regions": [
"us-west8"
]
}
},
...
- 생략: Call Limit 이슈 등으로 사용하지 않을 것이므로
- GCP Web: html 파싱 및 유지등 리스크가 있음
- 활용하지는 않을 것이지만, 인스턴스 타입 종류 및 가격 정보 제공 기준/검증 등에 활용
- Cached json file 및 GCP Web 등을 통해서 VM 인스턴스 중심의 가격 정책을 제공
- Cached json file: 현재 실기간 가격 제공이 어려움,
[활용 예시 및 제공 정보]
-
VM 인스턴스 타입(머신 타입) 제공 웹 페이지
https://cloud.google.com/compute/docs/machine-resource?hl=ko#standard_machine_types -
VM 인스턴스 가격 책정 제공 웹페이지
https://cloud.google.com/compute/vm-instance-pricing?hl=ko -
Cached json file
-
첫줄 comment를 잘 봐야 함: update 되기 전 사이의 가격은 틀릴 수 있음
- 그럼에도 불구하고, 계속 업데이트하면서 유지 되는 것은 내부에서 또는 특수 그룹에서 계속 활용되는 것으로 추정되며,
- 내부에서도 인스턴스 세부 타입별 가격 정보가 필요한 것을 알수 있음
- 필요성에 대해서는 구글링에서도 보이고 다음 등록된 이슈를 보면, 지속적으로 찾고 있는 상황
-
자원 그룹별로 1년 약정 및 3년 약정 가격 제공
-
제품/서비스에 대한 Region별 OnDemand 가격과 Preemptible 가격 정보 포함
-
활용 방법 및 정보 예시
-
curl https://cloudpricingcalculator.appspot.com/static/data/pricelist.json
{
"comment": "This JSON data is obsolete. Please use https://cloud.google.com/billing/v1/how-tos/catalog-api instead.",
"updated": "3-January-2024",
"version": "v1.75",
"gcp_price_list": {
"CP-ALLOYDB-BACKUP": {
"asia-east1": 0.0001589,
"asia-east2": 0.0001918,
"asia-northeast1": 0.0001753,
"asia-northeast2": 0.0001753,
"asia-northeast3": 0.0001753,
"asia-south1": 0.0001425,
...
- N1 머신 유형 약정 목록 확인 예시
grep N1 pricelist.json |grep YEAR
"CP-COMPUTEENGINE-N1-CUD-1-YEAR-CPU": {
"CP-COMPUTEENGINE-N1-CUD-1-YEAR-RAM": {
"CP-COMPUTEENGINE-N1-CUD-3-YEAR-CPU": {
"CP-COMPUTEENGINE-N1-CUD-3-YEAR-RAM": {
- N1 머신 유형 1년 약정 가격 (3년 약정 가격은 생략)
- CPU 가격 정보 예시
cat pricelist.json |jq '.gcp_price_list."CP-COMPUTEENGINE-N1-CUD-1-YEAR-CPU"'
{
"africa-south1": 0.02604882,
"asia-east1": 0.023059,
"asia-east2": 0.0278655,
"asia-northeast1": 0.025589,
"asia-northeast2": 0.025589,
"asia-northeast3": 0.025589, <=========
"asia-south1": 0.0239186,
...
-
- Memory 가격 정보 예시
cat pricelist.json |jq '.gcp_price_list."CP-COMPUTEENGINE-N1-CUD-1-YEAR-RAM"'
{
"africa-south1": 0.003491052,
"asia-east1": 0.003091,
"asia-east2": 0.0037346,
"asia-northeast1": 0.003414,
"asia-northeast2": 0.003414,
"asia-northeast3": 0.003414, <=========
"asia-south1": 0.003205,
- GCP Web에서 확인
- n1-standard-16 OnDemand 가격 정보 예시
cat pricelist.json |jq '.gcp_price_list."CP-COMPUTEENGINE-VMIMAGE-N1-STANDARD-16"'
{
"asia": 0.88,
"asia-east": 0.88,
"asia-east1": 0.88,
"asia-east2": 1.0634,
"asia-northeast": 0.976,
"asia-northeast1": 0.976,
"asia-northeast2": 0.976,
"asia-northeast3": 0.976, <===========
"asia-south1": 0.9127,
...
- n1-standard-16 Preemptible 가격 예시
cat pricelist.json |jq '.gcp_price_list."CP-COMPUTEENGINE-VMIMAGE-N1-STANDARD-16-PREEMPTIBLE"'
{
"asia": 0.176,
"asia-east": 0.176,
"asia-east1": 0.176,
"asia-east2": 0.2242,
"asia-northeast": 0.212,
"asia-northeast1": 0.212,
"asia-northeast2": 0.212,
"asia-northeast3": 0.212, <==========
"asia-south1": 0.19243,
- GCP Web에서 확인
- GetPriceInfo()는 사용 가능한 제품들에 대한 정보 및 각 제품에 대해 선택할 수 있는 가격 정책/정보를 제공하는 API입니다.
-
Install & Start Guide
-
Features & Usage
-
- AdminWeb Tool Guide
- CLI Tool Guide
- REST API Guide
- NLI Guide
-
Design
-
Developer Guide
-
Cloud Driver Developer Guide
- Cloud Driver Developer Guide-WIP
- VM SSH Key Development Guide-WIP
- VM User Development Guide
- What is the CSP SDK API Version of drivers
- Region Zone Info and Driver API
- (StartVM TerminateVM) API Call Counts and Waiting
- StartVM and TerminateVM Main Flow of drivers
- VM Root Disk Configuration Guide
- Security Group Rules and Driver API
- Network Load Balancer and Driver API
- VM Snapshot, MyImage and Disk Overview
- Kubernetes and Driver API(PMKS, K8S)
- Tag and Cloud Driver API
- AnyCall API Extension Guide
-
Test Reports
- v0.2.8-for-espresso-release
- v0.3.0-espresso-release
- Azure:Terminating VM
- cb-user@VM: ssh login, sudo run
- v0.3.14 test for SG Source
- v0.4.0-cafemocha-release
- Test via REST API Gateway
- Test Reports of v0.4.11 (IID2 initial Version)
- Test Reports of v0.4.12 (Register & Unregister existing Resources)
- Test Reports for v0.6.0 Release
- How to ...
- How to Use AWS S3 with Credentials
- How to Use Alibaba ECS i1.* Instance Types
- How to provision GPU VMs
- How to Resolve the 'Failed to Connect to Database' Error
- How to test CB Spider with Mock Driver
- How to install CB Spider on WSL2 under 공유기/사설망
- How to install CB Spider on macOS
- How to run CB Spider Container on macOS
- How to install OpenStack on a VM for CB Spider Testing
- How to get Azure available Regions
- How to profile memory usage in Golang
- Deprecated:How to install protoc and plugins
- [For Cloud-Migrator]




