New serverless pattern - lambda-invoicing-bedrock-cdk#3195
Conversation
…nalysis Amazon EventBridge scheduled AWS Lambda retrieves invoices via new Invoicing APIs (ListInvoiceSummaries, GetInvoicePDF), archives PDFs to Amazon S3, and uses Amazon Bedrock to generate cost analysis with optimization recommendations. Deployed and tested: 1 invoice retrieved, PDF archived (60KB), Amazon Bedrock analysis generated with spend summary and recommendations.
|
"What does this solve that Cost Explorer doesn't?" The Real Enterprise Pain Point Enterprise customers have:
The June 25, 2026 blog quotes: "If you manage invoices for dozens or hundreds of AWS payer accounts, you face repetitive console logins, individual file downloads, and manual data entry into your financial systems." hence the PR. Thanks. |
marcojahn
left a comment
There was a problem hiding this comment.
Hello @NithinChandranR-AWS, thank you for your contribution. A few request for changes, pls review.
| memorySize: 512, | ||
| environment: { | ||
| BUCKET_NAME: invoiceBucket.bucketName, | ||
| MODEL_ID: 'us.anthropic.claude-sonnet-4-20250514-v1:0', |
There was a problem hiding this comment.
Please upgrade to latest Sonnet models here and on the permissions (role)
There was a problem hiding this comment.
Done, upgraded to Claude Sonnet 4.6 and made the model configurable via CDK context. Thank you for your time and help.
|
|
||
| Important: this application uses various AWS services and there are costs associated with these services after the Free Tier usage - please see the [AWS Pricing page](https://aws.amazon.com/pricing/) for details. You are responsible for any AWS costs incurred. No warranty is implied in this example. | ||
|
|
||
| ## Requirements |
There was a problem hiding this comment.
This stack is tied to us-east-1 only. Please consider to make the region (and therefore model usage) configurable. As this is only a pattern, we see customers/users not having access to all regions
There was a problem hiding this comment.
Good point. Model ID is now configurable via --context modelId=eu.anthropic.claude-sonnet-4-6 and IAM uses wildcard regions. Thank you for your time and help.
Summary
New pattern: Automated AWS Invoice Retrieval and Analysis with Amazon Bedrock
Amazon EventBridge triggers an AWS Lambda function monthly that retrieves invoices via the new AWS Invoicing APIs (ListInvoiceSummaries, GetInvoicePDF), archives PDFs to Amazon S3, and generates cost analysis summaries using Amazon Bedrock.
Pattern details
Composition
Removing any service breaks the pattern: no EventBridge = no automation, no Lambda = no orchestration, no S3 = no archive, no Bedrock = no intelligent analysis.
Testing
Deployed and tested in us-east-1. Results: