如何按实例名称获取GCP计费?(不按类型)资源和计费sku id之间是否存在关联



我可以按实例名称查看GCP计费吗?(不按类型(我正在尝试按实例名称筛选GCP计费,这可能吗?我只通过GCP计算引擎和实例类型(n1标准(等过滤成功…

我正在尝试以编程方式将与GCP计算实例关联的machineType与相应的计费SKU相匹配,但找不到直接关联的密钥。例如,以下是来自机器的响应类型API:

{
"kind": "compute#machineType",
"name": "n1-standard-32",
"description": "32 vCPUs, 120 GB RAM",
"guestCpus": 32,
"memoryMb": 122880,
"imageSpaceGb": 0,
"maximumPersistentDisks": 128,
"maximumPersistentDisksSizeGb": "65536",
"zone": "us-east1-b",
"isSharedCpu": false
}

这里是cloudbilling API中对应的SKU:

"name": "services/XXXX/skus/XXXX",
"skuId": "XXXX",
"description": "Standard Intel N1 32 VCPU running in Americas",
"category": {
"serviceDisplayName": "Compute Engine",
"resourceFamily": "Compute",
"resourceGroup": "N1Standard",
"usageType": "OnDemand"
},
"serviceRegions": [
"us-central1",
"us-east1",
"us-west1"
],
"pricingInfo": [
{
"summary": "",
"pricingExpression": {
"usageUnit": "h",
"usageUnitDescription": "hour",
"baseUnit": "s",
"baseUnitDescription": "second",
"baseUnitConversionFactor": 3600,
"displayQuantity": 1,
"tieredRates": [
{
"startUsageAmount": 0,
"unitPrice": {
"currencyCode": "USD",
"units": "1",
"nanos": 520000000
}
}
]
},
"currencyConversionRate": 1,
"effectiveTime": "2018-02-22T12:00:16.647Z"
}
],
"serviceProviderName": "Google"

计费SKU中似乎没有值为n1-标准-32的字段。我们如何将这两者联系在一起,就像本页所做的那样:https://cloud.google.com/compute/pricing?

您可以创建标签并添加到实例中,以便获得每个实例的费用明细。需要在每个实例上添加此标签,添加后,您可以通过按标签排序来查看计费报告中每个实例的费用。

创建和管理标签可以在这里找到

您可以使用资源管理器API并执行诸如之类的请求

POST https://cloudresourcemanager.googleapis.com/v1beta1/projects
{
"labels": {
"color": "red"
},
"name": "myproject",
"projectId": "our-project-123"
}

您还可以使用gcloud命令为计算引擎实例添加和编辑标签

相关内容

  • 没有找到相关文章

最新更新