1 Answer
- Newest
- Most votes
- Most comments
2
Hello.
I think you can use the "Filter" in the parameters to get the price without including credits.
The code below is a sample, but when I run it in my environment, I was able to check the charges that do not include credits.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ce/client/get_cost_and_usage.html#
import boto3
MY_FILTER={
'Not': {
'Dimensions': {
'Key': "RECORD_TYPE",
'Values': ["Credit"]
}
}
}
client = boto3.client('ce', region_name='us-east-1')
response = client.get_cost_and_usage(
TimePeriod={
'Start': '2024-05-05',
'End': '2024-05-06'
},
Filter=MY_FILTER,
Granularity='DAILY',
Metrics=['AmortizedCost']
)
print(response)
Relevant content
- asked 5 months ago
- asked a year ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago