2.2.5. AWS CloudTrail for API Activity Auditing
š” First Principle: AWS CloudTrail provides a comprehensive, immutable record of API calls and resource changes within an AWS account, enabling security analysis, compliance auditing, and operational troubleshooting.
Scenario: You need to audit all API calls made in your AWS account to track who made what changes, when, and from where, for both security investigations and compliance requirements.
AWS CloudTrail is a service that helps you enable governance, compliance, and operational and risk auditing of your AWS account. It logs most actions performed in your AWS account by users, roles, or AWS services.
Key Features of AWS CloudTrail:
- API Call Logging: Records information about API calls made in your account, including:
- Who: The identity that made the request (IAM user, role, AWS service).
- What: The specific API operation performed (e.g.,
RunInstances
,PutObject
,DeleteVolume
). - When: The time the action occurred.
- Where: The AWS Region of the request, source IP address.
- Event History: Provides a view of the last 90 days of API activity in the CloudTrail console.
- Trails: Configure a trail to deliver CloudTrail events to an Amazon S3 bucket for long-term storage and to Amazon CloudWatch Logs for real-time monitoring and alerting.
- Use Cases:
- Security Analysis: Detecting unauthorized activity or policy violations.
- Compliance Auditing: Providing an audit trail for regulatory compliance.
- Operational Troubleshooting: Investigating changes that might have led to operational issues.
ā ļø Common Pitfall: Not configuring a CloudTrail trail to an S3 bucket for long-term, immutable storage, limiting audit history to 90 days.
Key Trade-Offs: Real-time CloudTrail analysis (higher cost, immediate alerts) versus long-term archival in S3 (lower cost, but delayed analysis).
Reflection Question: How does AWS CloudTrail, by providing a comprehensive and immutable record of API calls and resource changes, enable you as a SysOps Administrator to perform security analysis, compliance auditing, and operational troubleshooting?