- Newest
- Most votes
- Most comments
Your approach using EventBridge, CloudTrail, and Lambda to track resource creation and deletion across 7 regions and update an inventory Excel sheet is a good one. However, with 1 million events daily, costs can add up. Here's a breakdown:
- EventBridge: $1.50 per million events (first 100,000 events free)
- CloudTrail: $2.00 per 100,000 events (first 100,000 events free)
- Lambda: depends on execution time, memory usage, and invocations (estimated $10-$20 per million events)
To optimize costs:
- Filter events: Only capture necessary events to reduce volume.
- Use CloudTrail event filtering: Filter events at the source to reduce CloudTrail costs.
- Optimize Lambda function: Minimize execution time, memory usage, and invocations.
- Consider Amazon S3 storage: Store inventory data in S3 instead of Excel.
Regarding AWS documentation, the referenced article is relevant, but it focuses on automating EventBridge rule creation for CloudTrail API events. Your use case involves tracking resource creation and deletion across multiple regions.
EventBridge operates by:
- Capturing events from CloudTrail (or other sources)
- Matching events to rules
- Triggering Lambda functions (or other targets)
CloudTrail is required to capture events. Default CloudTrail settings might not capture all events. Ensure you have a CloudTrail trail configured to capture the desired events.
Troubleshooting steps:
- Verify CloudTrail trail configuration and event capture settings.
- Check EventBridge rule configuration and event pattern.
- Test Lambda function invocation and execution.
- Review AWS CloudWatch logs for errors or issues.
Using AWS EventBridge, CloudTrail, and Lambda to track resource creation and deletion across multiple regions and updating an inventory Excel sheet can be an efficient method, but there are several considerations and potential optimizations to keep in mind.
Efficiency and Cost Implications
-
Efficiency:
- EventBridge is a serverless event bus that can efficiently route events from CloudTrail to Lambda functions. It is well-suited for event-driven architectures and can handle events across multiple AWS services and regions[3][4].
- CloudTrail is essential for capturing API calls and activity across AWS accounts. It provides a record of actions taken by users, roles, and AWS services[1][6].
- Lambda allows you to process these events without managing servers, making it a cost-effective choice for executing code in response to events[4].
-
Cost Implications:
- EventBridge Pricing: You pay for events published to your event bus, and there are no additional charges for rules or event delivery. The pricing is based on the number of events processed, with each 64 KB chunk of a payload billed as one event[7][8].
- CloudTrail Costs: While CloudTrail's event history is free for the past 90 days, creating a trail to store logs in S3 incurs costs based on the volume of logs[6].
- Lambda Costs: Lambda charges are based on the number of requests and the duration of execution. Optimizing your Lambda functions to reduce execution time can help manage costs.
For 1 million events daily, the costs can add up, especially if the events are large or require extensive processing. You can optimize costs by:
- Filtering Events: Use EventBridge to filter and route only the necessary events to Lambda, reducing the number of Lambda invocations.
- Batch Processing: Where possible, batch events to minimize the number of Lambda invocations.
- Optimize Lambda Execution: Ensure Lambda functions are optimized for performance to reduce execution time and costs.
CloudTrail and EventBridge Configuration
- CloudTrail Requirement: For EventBridge rules to trigger, a CloudTrail trail must be explicitly created. The default CloudTrail event history does not suffice for triggering EventBridge rules because it does not continuously deliver logs to an S3 bucket or event bus[1][5].
- EventBridge Rule Issues: If your EventBridge rule is not triggering, ensure that the CloudTrail trail is properly configured and that the event pattern in EventBridge matches the events you want to capture[2][4].
Conclusion
Using EventBridge, CloudTrail, and Lambda is a viable approach for tracking resource changes across regions. However, careful configuration and optimization are necessary to ensure efficiency and cost-effectiveness. If you are experiencing issues with EventBridge rules not triggering, verify that a CloudTrail trail is set up and that the event patterns are correctly defined[5][9].
Citations: [1] https://docs.aws.amazon.com/eventbridge/latest/userguide/logging-using-cloudtrail.html [2] https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-troubleshooting.html [3] https://cloudavocado.com/blog/understanding-aws-eventbridge-a-comprehensive-guide/ [4] https://www.profisea.com/multi-region-and-multi-account-monitoring-of-the-cloudtrail-logs-via-amazon-eventbridge/ [5] https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-log-api-call.html [6] https://docs.aws.amazon.com/lambda/latest/dg/logging-using-cloudtrail.html [7] https://aws.amazon.com/eventbridge/pricing/ [8] https://www.qa.com/resources/blog/aws-eventbridge-features-pricing-and-more/ [9] https://repost.aws/knowledge-center/automate-eventbridge-rule-cloudtrail-api
Relevant content
- asked a year ago
- asked 3 years ago
- asked 3 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago