Try below solution ::
AWS SDK for Java 2.x (version 2) does not have specific APIs to download monthly invoices directly. The SDK primarily focuses on providing programmatic access to AWS services and their features rather than handling billing and invoicing-related tasks.
[1] Use AWS Management Console:
-> Log in to the AWS Management Console.
-> Open the Billing and Cost Management console.
-> In the navigation pane, select "Bills."
-> Locate and download the invoice for the desired month.
[2] Use AWS Billing and Cost Management API:
-> You can use the AWS Cost Explorer API (part of AWS Billing and Cost Management API) to retrieve cost and usage data programmatically. The "GetCostAndUsage" API allows you to retrieve cost and usage metrics for a given billing period.
-> However, please note that the API does not directly provide the detailed invoice document like the one you see in the AWS Management Console. It provides cost and usage data in a structured format.
If you need to automate the process of retrieving invoices and processing them programmatically, you may want to consider using the AWS Cost Explorer API to get cost and usage data, and then format the data according to your needs.
Keep in mind that AWS service offerings and SDK capabilities might have evolved beyond my last update in 2021, so it's always a good idea to refer to the official AWS SDK documentation and API reference to check for any updates or new features related to billing and invoicing.