CloudTrail Audit
AWS architecture template · SAA-C03: CloudTrail multi-region logging → S3 + KMS + CloudWatch + SNS alerts
CloudTrail Audit is a free AWS architecture template built with CloudTrail, CloudWatch, IAM, KMS, S3 and SNS. Open it in TheArchitect to edit the diagram, estimate monthly cost, and export the CloudFormation or Terraform that deploys it.
AWS services in this template
- CloudTrail
- CloudWatch
- IAM
- KMS
- S3
- SNS
Deployment notes
Needs input
- The S3 audit bucket needs a bucket policy granting cloudtrail.amazonaws.com write access before the trail can start.
Generated CloudFormation — 6 resources
| Logical ID | Resource type |
|---|---|
| KMSkms | AWS::KMS::Key |
| TrailRoleiam | AWS::IAM::Role |
| CloudTrailcloudtrail | AWS::CloudTrail::Trail |
| AuditLogBuckets3 | AWS::S3::Bucket |
| CloudWatchcloudwatch | AWS::CloudWatch::Alarm |
| AlertTopicsns | AWS::SNS::Topic |
View the full CloudFormation template
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Generated by TheArchitect — https://www.thecloudarchitect.dev",
"Metadata": {
"TheArchitect": {
"Edges": [
{
"From": "KMSkms",
"To": "CloudTrailcloudtrail",
"Label": "encrypt"
},
{
"From": "TrailRoleiam",
"To": "CloudTrailcloudtrail",
"Label": "role"
},
{
"From": "CloudTrailcloudtrail",
"To": "AuditLogBuckets3",
"Label": "logs"
},
{
"From": "CloudWatchcloudwatch",
"To": "AlertTopicsns",
"Label": "alarm"
}
]
}
},
"Resources": {
"KMSkms": {
"Type": "AWS::KMS::Key",
"Properties": {
"Description": "KMS key for CloudTrail log file encryption.",
"KeySpec": "SYMMETRIC_DEFAULT",
"KeyUsage": "ENCRYPT_DECRYPT",
"EnableKeyRotation": true,
"Enabled": true
}
},
"TrailRoleiam": {
"Type": "AWS::IAM::Role",
"Properties": {
"RoleName": "saa-audit-trail-role",
"Description": "IAM role for CloudTrail CloudWatch Logs delivery."
}
},
"CloudTrailcloudtrail": {
"Type": "AWS::CloudTrail::Trail",
"DependsOn": [
"TrailRoleiam"
],
"Properties": {
"TrailName": "saa-audit-trail",
"S3BucketName": "saa-audit-cloudtrail-logs",
"IsLogging": true,
"IsMultiRegionTrail": true,
"EnableLogFileValidation": true,
"IncludeGlobalServiceEvents": true
}
},
"AuditLogBuckets3": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "saa-audit-cloudtrail-logs",
"VersioningConfiguration": {
"Status": "Enabled"
},
"OwnershipControls": {
"Rules": [
{
"ObjectOwnership": "BucketOwnerEnforced"
}
]
},
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}
]
},
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": true,
"BlockPublicPolicy": true,
"IgnorePublicAcls": true,
"RestrictPublicBuckets": true
},
"Tags": [
{
"Key": "Name",
"Value": "saa-audit-cloudtrail-logs"
}
]
}
},
"CloudWatchcloudwatch": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"AlarmName": "saa-audit-root-login",
"AlarmDescription": "Alert on root account usage detected via CloudTrail metric filter.",
"Namespace": "CloudTrailMetrics",
"MetricName": "RootAccountUsageCount",
"Statistic": "Sum",
"Period": 300,
"EvaluationPeriods": 1,
"Threshold": 1,
"ComparisonOperator": "GreaterThanOrEqualToThreshold",
"TreatMissingData": "notBreaching"
}
},
"AlertTopicsns": {
"Type": "AWS::SNS::Topic",
"Properties": {
"TopicName": "saa-audit-security-alerts",
"DisplayName": "Audit security alerts"
}
}
}
}Generated by TheArchitect from the diagram above. Review values such as names, CIDR ranges and instance sizes before deploying to your account.
Related templates
- Security BaselineSAA-C03: WAF + KMS + Secrets Manager + CloudTrail → S3 + CloudWatch + SNS
- Centralised Log AnalyticsCloudWatch subscription filters stream application logs through Kinesis into a Lambda transformer that writes partitioned Parquet to S3 for Athena investigation.
- Secrets Rotation & Compliance AuditZero hardcoded credentials: EC2 fetches DB credentials from Secrets Manager with automatic 30-day rotation. CloudTrail captures every API call to an immutable S3 audit bucket.