Created
April 2, 2024 07:27
-
-
Save ruggieroguida/6f799802cd7eddf3ff08bbb186876af9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp = iam_client.get_cost_and_usage({ | |
time_period: { | |
start: start_date, | |
end: end_date, | |
}, | |
granularity: "MONTHLY", | |
filter: { | |
and: [ | |
{ | |
tags: { | |
key: "MCTOrganization", | |
values: [mctorg], | |
match_options: ["EQUALS"], | |
}, | |
}, | |
{ | |
dimensions: { | |
key: "SERVICE", | |
values: ["Amazon Elastic Compute Cloud - Compute"], | |
match_options: ["EQUALS"], | |
}, | |
}, | |
{ | |
not: { | |
tags: { | |
key: "MCTUser", | |
values: ["mctsupport"], | |
match_options: ["EQUALS"], | |
}, | |
}, | |
}, | |
], | |
}, | |
metrics: ["BLENDED_COST"], | |
group_by: [ | |
{ | |
type: "TAG", | |
key: "MCTProject", | |
}, | |
{ | |
type: "DIMENSION", # accepts DIMENSION, TAG, COST_CATEGORY | |
key: "PURCHASE_TYPE", | |
}, | |
], | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment