I am preparing a script that can fetch me the cost of my AWS account. Here I have used Python3
and boto3
SDK by AWS. But for further granularity, I also want to fetch region-wise cost for each service. I am unable to get a good doc for this. Following is the currently working code.
cost_and_usage = client.get_cost_and_usage(
TimePeriod={
"Start": START_DATE,
"End": END_DATE
},
Granularity="DAILY",
Metrics=["UnblendedCost"],
GroupBy=[
{
"Type": "DIMENSION",
"Key": "LINKED_ACCOUNT",
},
{
"Type": "DIMENSION",
"Key": "SERVICE",
}
]
)
What changes should I make in the code that I will get the cost for every service by region.