我正在使用 成本资源管理器API中的get_cost_and_usage 。我想获取个别事物的帐单详细信息。我按照他们的文档创建了一个新的计费组,名为 ( user:company ) Inside managed option of IOT Core。在这个新创建的计费组中添加了 4 个新设备,其 tagName user:company 和 value IPMS。然后在成本分配标签控制台中,我激活了这个标签(用户:公司)。
但我无法获得与这些事情相关的账单。这是我的python代码
response = client.get_cost_and_usage(
TimePeriod={
'Start': '2019-07-01',
'End': '2019-07-16'
},
Granularity='MONTHLY',
Filter={
'Tags':{
'Key': 'user:company',
'Values': [
'IPMS'
]
}
},
Metrics=[
'UnblendedCost',
],
GroupBy=[
{
'Type': 'TAG',
'Key': 'user:company'
},
]),
这是回应
{"ResponseMetadata": {"RetryAttempts": 0, "HTTPStatusCode": 200, "HTTPHeaders": {"x-amzn-requestid": "034a2efb-1ba2-4272-b595-d07d0e5c9931", "content-type": "application/x-amz-json-1.1", "content-length": "216", "date": "Thu, 18 Jul 2019 16:49:33 GMT"}, "RequestId": "034a2efb-1ba2-4272-b595-d07d0e5c9931"}, "GroupDefinitions": [{"Key": "user:company", "Type": "TAG"}], "ResultsByTime": [{"TimePeriod": {"End": "2019-07-16", "Start": "2019-07-01"}, "Total": {"UnblendedCost": {"Amount": "0", "Unit": "USD"}}, "Estimated": true, "Groups": []}]}
事件我无法在get_tags API中获取我定义的标签
这是示例代码
response = client.get_tags(
TimePeriod={
'Start': '2019-07-01',
'End': '2019-07-16'
},
)
这是回应
{"TotalSize": 1, "ReturnSize": 1, "ResponseMetadata": {"RequestId": "bdbdfb9e-fd84-44c7-9ab2-2f9d4cf1ecdc", "HTTPStatusCode": 200, "HTTPHeaders": {"date": "Thu, 18 Jul 2019 16:50:55 GMT", "x-amzn-requestid": "bdbdfb9e-fd84-44c7-9ab2-2f9d4cf1ecdc", "content-type": "application/x-amz-json-1.1", "content-length": "55"}, "RetryAttempts": 0}, "Tags": ["aws:createdBy"]}