AWS CloudWatch Infrequent Access: Save Up to 50% on Logging Costs

Listen to this Post

Featured Image
AWS CloudWatch logging costs can accumulate unexpectedly, especially for large-scale applications. To address this, AWS introduced CloudWatch Infrequent Access (IA), a log class that reduces costs by up to 50% while limiting some features like live log tailing, metric filtering, and alerting.

You Should Know:

1. Enabling CloudWatch Infrequent Access with AWS Lambda

To configure CloudWatch IA for Lambda logs, use the following AWS CLI command:

aws logs put-retention-policy --log-group-name "/aws/lambda/your-function-name" --retention-in-days 365 --log-group-class "INFREQUENT_ACCESS"

2. Automating Log Class Transition

Use an AWS Lambda function with Python (Boto3) to automate moving logs to Infrequent Access after a certain period:

import boto3

def lambda_handler(event, context):
logs_client = boto3.client('logs')
log_groups = logs_client.describe_log_groups()['logGroups']

for group in log_groups:
if 'retentionInDays' in group and group['retentionInDays'] >= 30:
logs_client.put_retention_policy(
logGroupName=group['logGroupName'],
retentionInDays=group['retentionInDays'],
logGroupClass='INFREQUENT_ACCESS'
)
return {"status": "Completed"}

3. Serverless Framework Configuration

If using the Serverless Framework, modify `serverless.yml` to set Infrequent Access:

provider:
logs:
restApi:
accessLogging: true
logGroupClass: "INFREQUENT_ACCESS"

4. Cost Comparison & Monitoring

Check CloudWatch costs before and after enabling IA:

aws ce get-cost-and-usage \
--time-period Start=2023-11-01,End=2023-12-01 \
--granularity MONTHLY \
--metrics "UnblendedCost" \
--filter '{"Dimensions": {"Key": "SERVICE", "Values": ["AmazonCloudWatch"]}}'

5. When NOT to Use Infrequent Access

Avoid IA if:

  • You need real-time log analysis
  • Your logs require metric filters or alarms
  • Logs are accessed frequently for debugging

What Undercode Say:

AWS CloudWatch Infrequent Access is a cost-effective solution for logs that don’t require frequent access. However, teams must evaluate trade-offsβ€”reduced costs vs. limited functionality. Automating log transitions and monitoring expenses ensures optimal savings without compromising critical logging needs.

Expected Output:

  • Reduced CloudWatch costs by 30-50%
  • Logs retained for compliance but accessed less frequently
  • Automated log management with Lambda & Serverless

Prediction:

As AWS continues optimizing logging costs, expect more granular log tiers (e.g., archival logs with even lower costs) and AI-driven log lifecycle policies for auto-optimization.

Reference:

AWS CloudWatch- Infrequent Access with Lambda and Serverless

References:

Reported By: Darryl Ruggles – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass βœ…

Join Our Cyber World:

πŸ’¬ Whatsapp | πŸ’¬ Telegram