You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在AWS Cost Explorer中按月发送已保存报表,并实现每月自动邮件推送?

How to Automatically Send Saved AWS Cost Explorer Reports Monthly via Email

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:
      1. Fetch your saved report definition using the GetSavedReportDefinition Cost Explorer API
      2. Retrieve the report data with GetCostAndUsage (or GetCostForecast if needed)
      3. Format the data into a CSV/Excel file
      4. Send the email with the attachment using SES’s SendRawEmail API
    • Attach an IAM policy to your Lambda function that allows:
      • ce:GetSavedReportDefinition and ce:GetCostAndUsage
      • ses:SendRawEmail
      • Optional: s3:PutObject and s3:GetObject if 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:17:20