I am using get_cost_and_usage from cost explorer API. I want to get billing details for individual things. I followed their documentation and created a new billing group named (user:company) Inside managed option of IOT Core. Added 4 new devices inside this newly created biling group with tagName user:company and value IPMS . Then in Cost Allocation Tags console, I Activated this tag (user:company).
But I am unable to get billing related to these things. Here is my python code
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'
},
]),
and here is response
{"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": []}]}
event I am not able to get my defined tag in get_tags API
here is sample code
response = client.get_tags(
TimePeriod={
'Start': '2019-07-01',
'End': '2019-07-16'
},
)
and here is response
{"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"]}