AWS Cost Efficiency

Reduce Your AWS CloudTrail Costs : 6 Proven Strategies For Cost Optimization

Reducing CloudTrail Expenses for Smarter AWS Management
Document

Did you know?

AWS CloudTrail can capture up to 10,000 events per minute for each trail. This means that it can provide a detailed record of your AWS account activity, even during periods of high usage.


AWS CloudTrail is an essential service for any organization looking to maintain a comprehensive record of AWS API calls, offering valuable insights into account activity and security. With a customer base of approximately 1,948 and an estimated market share of 1.80%, it's clear that CloudTrail plays a critical role in many businesses. Organizations across various sectors, including cloud services (71%), data analytics (55%), and cybersecurity (52%), rely on CloudTrail for robust log management.

CloudTrail not only tracks API calls but also strengthens security, ensures compliance, and audits AWS environment changes. As log volumes grow, so do costs. This guide offers strategies to optimize CloudTrail pricing, helping your business stay in control and save resources effectively.

AWS CloudTrail Pricing

The tables below provide a detailed breakdown of AWS CloudTrail pricing, including free and paid tiers. The free tier offers basic features and the paid tier outlines costs for data ingestion, retention, queries, and event delivery, with pricing based on data volume and additional features like CloudTrail Insights.[2]

1. AWS Free Tier Pricing

Feature Details
Event History View, search, and download the most recent 90-day history of your account’s control plane activity.
Lake 30-day free trial for new customers. Includes ingesting and scanning up to 5 GB of data.
Trail Deliver one copy of ongoing management events to your S3 bucket.

2. AWS Paid Tier CloudTrail Pricing

Feature  Deployement Scenario Details  Pricing
Lake Data Ingestion CloudTrail management and data events $0.75/GB
Other AWS and non-AWS auditable data $0.50/GB
First 5 TB/month $2.5 per GB
Next 20 TB/month $1 per GB
Over 25 TB/month $0.50 per GB
Data Retention One-year extendable retention pricing: First year included in ingestion cost Extended retention:$0.023/GB/month, max 10 years
Seven-year retention pricing: Seven years included in ingestion cost Max 7 years
Data Queries Queries performed by CloudTrail Lake or Amazon Athena $0.005/GB of data scanned
Trail Management events to S3 Deliver management events to S3 after the first free copy $2.00 per 100,000 events
Data events to S3 Deliver data events to S3 $0.10 per 100,000 events
Insights _ Analyze specific events in your trails or CloudTrail Lake event data store $0.35 per 100,000 events analyzed per Insight type

Strategies to reduce CloudTrail Costs

Given below are several strategies that will help you optimize AWS CloudTrail costs and enhance cost management within your AWS environment.[3]

1.  Use Advance Event Selectors

Using advanced event selectors in AWS CloudTrail enables you to log only specific events that are crucial for your monitoring and compliance needs. For example, instead of logging all S3 data events, you can configure advanced event selectors to log only specific actions like `DeleteObject` on certain S3 buckets. This granularity allows you to exclude less important events, thereby reducing the volume of logs and significantly cutting down on CloudTrail costs. Additionally, you can specify conditions based on event names, resource ARNs, or whether the events are read-only or write operations, giving you precise control over what gets logged and billed. This method ensures that you're paying only for the data that matters most to your organization, optimizing costs without sacrificing essential visibility and security.[4]

Here’s a concise example command that sets up a trail to log only DeleteObject API events for a specific S3 bucket:

aws cloudtrail put-event-selectors \
  --trail-name TrailName \
  --advanced-event-selectors '[
    {
      "Name": "Log DeleteObject events for a specific S3 bucket",
      "FieldSelectors": [
        { "Field": "readOnly", "Equals": ["false"] },
        { "Field": "eventCategory", "Equals": ["Data"] },
        { "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
        { "Field": "eventName", "Equals": ["DeleteObject"] },
        { "Field": "resources.ARN", "StartsWith": ["arn:aws:s3:::BucketName/"] }
      ]
    }
  ]'

Replace 'TrailName' with the name of your CloudTrail and 'BucketName' with the name of your S3 bucket. This command configures advanced event selectors to log only the specified DeleteObject events, helping to reduce CloudTrail costs by focusing on relevant events.

2. Avoid Duplicate Trails

To avoid incurring extra charges from duplicate logs, use a multi-region trail instead of multiple single-region trails in AWS CloudTrail. A multi-region trail logs events from all AWS regions into a single S3 bucket, ensuring that you pay only once for capturing logs across all regions. In contrast, multiple single-region trails, each logging events from specific regions, can lead to duplicate logs and higher costs if they capture the same events in different regions.

By consolidating your logging into one multi-region trail, you effectively reduce costs and simplify your CloudTrail configuration.

Example Calculation:

Let's assume you have AWS resources in three regions: us-east-1, us-west-2, and eu-central-1. You create separate single-region trails for each region—Trail-US-EAST-1, Trail-US-WEST-2, and Trail-EU-CENTRAL-1. If each trail logs 10 million events per month and the cost per event is $0.0000035, the monthly costs would be:

  • Single-Region Trails:

Trail-US-EAST-1: 10,000,000 events × $0.0000035/event = $35

Trail-US-WEST-2: 10,000,000 events × $0.0000035/event = $35

Trail-EU-CENTRAL-1: 10,000,000 events × $0.0000035/event = $35

  • Total Cost with Single-Region Trails = $35 + $35 + $35 = $105
  • Multi-Region Trail: A single multi-region trail named Trail-Multi-Region captures logs from all three regions into one S3 bucket. 10,000,000 events × $0.0000035/event = $35
  • Cost Savings: By using a multi-region trail instead of three separate single-region trails, you would save: $105 (single-region trails) - $35 (multi-region trail) = $70/month

This results in significant cost savings, especially as the number of logged events increases. In this example, you save 66.67% of the logging costs by consolidating into a multi-region trail.

3. Set up Organizational Trails

By setting up a single AWS CloudTrail trail at the organization level within AWS Organizations, you can capture management events across all member accounts without creating separate trails for each account. This centralized approach avoids charges for duplicate logs and simplifies cost management. Ensure the organization trail is configured to log only essential events and regularly review its settings to prevent unnecessary duplication and control costs effectively.

4. Choose the Right Pricing Option for Event Data Stores

To optimize CloudTrail costs, select the appropriate pricing option for your event data store based on the type of events and your expected monthly data ingestion. For event data stores ingesting less than 25 TB per month and requiring a flexible retention period of up to 10 years, opt for the One-year extendable retention pricing. This option is suitable for collecting AWS Config configuration items, Audit Manager evidence, and external events. If your ingestion exceeds 25 TB per month and a 7-year retention period is needed, choose the Seven-year retention pricing option.

The table below provides better insights into selecting the appropriate pricing option for AWS CloudTrail event data stores based on monthly data ingestion and retention needs:

Pricing Option
Monthly Data Ingestion Retention Period Recommended For
One Year Extendible Retention Less than 25 TB Up to 10 years AWS Config items, Audit Manager evidence, external events
Seven Year Retention
More than 25 TB 7 years High-volume data stores with long retention needs

Consider the example scenario below  to illustrate the impact of choosing the right pricing option for CloudTrail event data stores:

Scenario: Optimizing CloudTrail Event Data Store for Compliance

"FinTech Secure Corp," a financial services company, uses AWS CloudTrail to maintain an audit log of all its AWS account activities for compliance and security purposes. Due to the nature of its operations, it generates a large volume of events, with data ingestion varying each month. The company requires long-term retention of logs to meet compliance standards, making it essential to choose the right pricing option for its CloudTrail event data store.

1. Current Setup (Scenario A)

  • Data Ingestion: 15 TB per month
  • Retention Period: Up to 10 years
  • Pricing Option: Using One-Year Extendable Retention
  • Cost per GB: $0.003 (example rate)

Monthly Cost Calculation:

  • Data Ingestion: 15 TB = 15,000 GB
  • Cost: 15,000 GB × $0.003/GB = $45/month
  • Annual Cost: $45/month × 12 months = $540/year
  • Five-Year Cost: $540/year × 5 years = $2,700

2. Current Setup (Scenario B)

  • Data Ingestion: 35 TB per month
  • Retention Period: 7 years
  • Pricing Option: Using Seven-Year Retention
  • Cost per GB: $0.0025 (example rate)

Monthly Cost Calculation:

  • Data Ingestion: 35 TB = 35,000 GB
  • Cost: 35,000 GB × $0.0025/GB = $87.50/month
  • Annual Cost: $87.50/month × 12 months = $1,050/year
  • Five-Year Cost: $1,050/year × 5 years = $5,250

3. Potential Savings by Choosing the Right Pricing Option

  • Scenario A: If FinTech Secure Corp continues with the One-Year Extendable Retention for 5 years: Total Cost: $2,700 over five years.
  • Scenario B: For the higher ingestion scenario using Seven-Year Retention: Total Cost: $5,250 over five years.

By carefully selecting the appropriate CloudTrail event data store pricing based on data ingestion and retention needs, FinTech Secure Corp effectively minimizes costs.

5. Use Time Range Filters in Queries

By formatting queries in AWS CloudTrail Lake to include a starting and ending eventTime, you can significantly reduce costs. This strategy limits the amount of data scanned during the query execution. Instead of querying the entire dataset, which can be extensive and costly, specifying a time range focuses the query on only the relevant data within that period. This targeted approach minimizes the volume of data processed, thus lowering the overall cost associated with running queries. By constraining the query to specific event times, you efficiently manage and reduce your CloudTrail Lake costs.

Suppose you need to analyze CloudTrail logs from the last 30 days to identify specific user activity. If you run a query without specifying a time range, it will scan the entire dataset, including historical data beyond the last 30 days. This can significantly increase your costs due to the larger volume of data processed.

For instance, if the entire dataset amounts to 1 TB and the AWS CloudTrail Lake query pricing is $2 per GB of data scanned, the cost for this query would be:

Without Time Range Filter:

  • Data Scanned: 1 TB (1024 GB)
  • Cost Calculation: 1024 GB * $2/GB = $2,048

By formatting your query to include a starting and ending eventTime, such as from 2024-07-01T00:00:00Z to 2024-07-31T23:59:59Z, you focus the search on only the logs within this 30-day period. Let's say this targeted query reduces the data scanned to 100 GB:

With Time Range Filter:

  • Data Scanned: 100 GB
  • Cost Calculation: 100 GB * $2/GB = $200

Cost Savings

  • Cost Without Filter: $2,048
  • Cost With Filter: $200
  • Savings: $2,048 - $200 = $1,848

By implementing this time range filter, you can achieve a cost savings of $1,848 for this single query.

6. Centralize CloudTrail Log Storage

Storing CloudTrail events in a centralized S3 bucket is a key cost optimization strategy. It simplifies log management by consolidating logs into one bucket, reducing administrative overhead and avoiding the complexity of multiple buckets across regions. This approach also cuts S3 storage costs by eliminating duplicate storage and taking advantage of pricing benefits for larger data volumes.

Additionally, it allows for consistent data retention and lifecycle management, such as transitioning logs to cheaper storage classes like S3 Glacier or automatic deletion. Centralizing logs improves performance and efficiency by eliminating cross-bucket operations, and it complements other cost-saving techniques to ensure efficient and cost-effective management of CloudTrail logs.

The table below provides insights to help you choose the appropriate storage tier based on the access patterns and retention needs of your CloudTrail logs.

Storage Tier Use Case Features
Cost Savings Estimate
S3 Standard Frequently accessed data High durability and availability; low latency -
Intelligent-Tiering Data with unknown or changing access patterns Automatically moves data between access tiers based on usage Up to 30% savings compared to S3 Standard for data with intermittent access
S3 One Zone-IA
Infrequently accessed data, no multi-AZ resilience Lower cost than Standard, but data is stored in a single availability zone Up to 20% savings compared to S3 Standard-IA
S3 Glacier
Archival storage with retrieval times of minutes to hours Low-cost storage for long-term archival data
Up to 60% savings compared to S3 Standard for long-term archives
S3 Glacier Deep Archive Long-term archival with retrieval times up to 12 hours Lowest cost storage for long-term data archival Up to 75% savings compared to S3 Standard for deep archive storage

Conclusion

To optimize AWS CloudTrail costs, focus on precision and consolidation. Implement advanced event selectors to log only crucial events, which reduces data volume and expenses. Utilize multi-region or organizational trails to avoid duplicate logs and streamline management. Choose the right pricing option based on your data ingestion and retention needs, and use time range filters in queries to limit data processing. Finally, centralize your logs in a single S3 bucket to simplify storage, lower costs, and improve efficiency. These strategies collectively ensure cost-effective and efficient CloudTrail management, enhancing both budget control and operational performance.

References

1. CloudTrail Market Share

2. AWS CloudTrail pricing

3. Managing CloudTrail trail costs

4. How to optimize AWS CloudTrail costs by using advanced event selectors

5. Troubleshoot CloudTrail cost and usage increases | AWS re:Post

Subscribed !
Your information has been submitted
Oops! Something went wrong while submitting the form.

Similar Blog Posts

Maintain Control and Curb Wasted Spend!

Strategical use of SCPs saves more cloud cost than one can imagine. Astuto does that for you!