I'm want to extract my current billing from aws by using amazon boto3 library for python, but couldn't find any API command that does so.
When trying to use previous version (boto2) with the fps connection and get_account_balance() method, i'm waiting for a response with no reply.
Can anyone tell me the correct way of doing so ?
The AWS SDK for Python (Boto3) enables you to use Python code to interact with AWS services like Amazon S3. For example, you can use the SDK to create an Amazon S3 bucket, list your available buckets, and then delete the bucket you just created.
Amazon Web Services automatically charges the credit card that you provided when you sign up for an AWS account. You can view or update your credit card information at any time, including designating a different credit card for AWS to charge. You can do this on the Payment Methods page in the Billing console.
You can get the current bill of your AWS account by using the CostExplorer API.
Below is an example:
import boto3
client = boto3.client('ce', region_name='us-east-1')
response = client.get_cost_and_usage(
TimePeriod={
'Start': '2018-10-01',
'End': '2018-10-31'
},
Granularity='MONTHLY',
Metrics=[
'AmortizedCost',
]
)
print(response)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With