如何在AWS Cost Explorer中按月发送已保存报表,并实现每月自动邮件推送?
Hey there! Great questions—let me break down two reliable ways to set up monthly automated deliveries for your saved Cost Explorer reports, since Cost Explorer itself doesn’t have a built-in "schedule report" feature.
Method 1: Use AWS Budgets (Quick & No-Code)
This is the simplest approach if you just need to send a link to your saved report via email each month.
- Open the AWS Budgets console and click "Create budget"
- Select "Cost budget" then click "Next"
- Configure basic budget details:
- Budget name: Pick something descriptive (e.g., "Monthly Cost Report - Team X")
- Budget period: Choose "Monthly"
- Start date: Select the month you want automated deliveries to begin
- Budget amount: Enter a trivial value like $1 (we’re using Budgets for notifications, not actual budget alerts)
- Move to the "Alerts" section and click "Add an alert threshold":
- Threshold type: Choose "Actual cost"
- Operator: Select "Is greater than or equal to"
- Threshold amount: Enter $0.01 (this ensures the alert triggers every month)
- Notification type: Select "Email" and input your target email address(es)
- Critical step: Scroll to "Additional email content", check the box for "Include a link to a saved Cost Explorer report", then select your saved report from the dropdown menu
- Finish the remaining setup and click "Create budget"
Each month, after the billing period ends, AWS Budgets will send an email with a direct link to your saved Cost Explorer report. If you have multiple reports, just repeat this process for each one.
Method 2: Use EventBridge + Lambda + SES (Customizable)
Use this if you need more control—like sending the report as an attachment, formatting the email content, or integrating with other tools.
- First, verify your sender email address in Amazon SES (to avoid deliverability issues)
- Create a Lambda function:
- Choose Python as the runtime
- Write code to:
- Fetch your saved report definition using the
GetSavedReportDefinitionCost Explorer API - Retrieve the report data with
GetCostAndUsage(orGetCostForecastif needed) - Format the data into a CSV/Excel file
- Send the email with the attachment using SES’s
SendRawEmailAPI
- Fetch your saved report definition using the
- Attach an IAM policy to your Lambda function that allows:
ce:GetSavedReportDefinitionandce:GetCostAndUsageses:SendRawEmail- Optional:
s3:PutObjectands3:GetObjectif you need to temporarily store the report file in S3
- Create an EventBridge rule:
- Rule type: "Schedule"
- Schedule expression: Use
cron(0 0 1 * ? *)to trigger on the 1st of every month at UTC midnight (adjust the cron expression for your preferred time zone) - Target: Select your Lambda function
- Test the Lambda function manually to confirm it generates and sends the report correctly
Pro Tips
- For the Budgets method, make sure your saved report uses a relative date range (like "Last month") so the link always loads the most recent monthly data
- With Lambda, you can modify the code to batch-process multiple saved reports and send them all in one email
- Keep an eye on AWS service limits: Budgets has a limit on the number of budgets per account, and Lambda has execution time limits (adjust if your report is very large)
内容的提问来源于stack exchange,提问作者Tien Dung Tran

