TheArchitect

Security Baseline

AWS architecture template · SAA-C03: WAF + KMS + Secrets Manager + CloudTrail → S3 + CloudWatch + SNS

Security Baseline is a free AWS architecture template built with CloudTrail, CloudWatch, IAM, KMS, S3, Secrets Manager, SNS and WAF. Open it in TheArchitect to edit the diagram, estimate monthly cost, and export the CloudFormation or Terraform that deploys it.

WAFKMSSecrets ManagerTrail RoleCloudTrailAudit Log Buck…CloudWatchSecurity Alerts
Security Baseline architecture diagram

AWS services in this template

  • CloudTrail
  • CloudWatch
  • IAM
  • KMS
  • S3
  • Secrets Manager
  • SNS
  • WAF

Deployment notes

Needs input

  • The S3 audit bucket requires a bucket policy granting cloudtrail.amazonaws.com write access before the trail can deliver logs.

Generated CloudFormation — 8 resources

Logical IDResource type
WAFwafAWS::WAFv2::WebACL
KMSkmsAWS::KMS::Key
SecretsManagersecretsmanagerAWS::SecretsManager::Secret
TrailRoleiamAWS::IAM::Role
CloudTrailcloudtrailAWS::CloudTrail::Trail
AuditLogBuckets3AWS::S3::Bucket
CloudWatchcloudwatchAWS::CloudWatch::Alarm
SecurityAlertssnsAWS::SNS::Topic
View the full CloudFormation template
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Generated by TheArchitect — https://www.thecloudarchitect.dev",
  "Metadata": {
    "TheArchitect": {
      "Edges": [
        {
          "From": "TrailRoleiam",
          "To": "CloudTrailcloudtrail",
          "Label": "role"
        },
        {
          "From": "KMSkms",
          "To": "CloudTrailcloudtrail",
          "Label": "encrypt"
        },
        {
          "From": "CloudTrailcloudtrail",
          "To": "AuditLogBuckets3",
          "Label": "logs"
        },
        {
          "From": "CloudWatchcloudwatch",
          "To": "SecurityAlertssns",
          "Label": "alarm"
        },
        {
          "From": "SecretsManagersecretsmanager",
          "To": "KMSkms",
          "Label": "encrypt"
        }
      ]
    }
  },
  "Resources": {
    "WAFwaf": {
      "Type": "AWS::WAFv2::WebACL",
      "Properties": {
        "Name": "saa-security-web-acl",
        "Scope": "REGIONAL",
        "DefaultAction": {
          "Allow": {}
        },
        "VisibilityConfig": {
          "CloudWatchMetricsEnabled": true,
          "MetricName": "SaaSecurityWebACL",
          "SampledRequestsEnabled": true
        },
        "Description": "Regional WAF protecting API endpoints."
      }
    },
    "KMSkms": {
      "Type": "AWS::KMS::Key",
      "Properties": {
        "Description": "Customer-managed key for data and log encryption.",
        "KeySpec": "SYMMETRIC_DEFAULT",
        "KeyUsage": "ENCRYPT_DECRYPT",
        "EnableKeyRotation": true,
        "Enabled": true,
        "MultiRegion": false
      }
    },
    "SecretsManagersecretsmanager": {
      "Type": "AWS::SecretsManager::Secret",
      "Properties": {
        "Name": "saa/security/db-credentials",
        "Description": "Database credentials — auto-rotated and KMS-encrypted.",
        "KmsKeyId": "alias/saa-security-key",
        "GenerateSecretString": {
          "PasswordLength": 32,
          "ExcludeCharacters": "\"@/"
        }
      }
    },
    "TrailRoleiam": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "RoleName": "saa-security-trail-role",
        "Description": "CloudTrail service role for CloudWatch Logs delivery."
      }
    },
    "CloudTrailcloudtrail": {
      "Type": "AWS::CloudTrail::Trail",
      "DependsOn": [
        "TrailRoleiam"
      ],
      "Properties": {
        "TrailName": "saa-security-trail",
        "S3BucketName": "saa-security-cloudtrail-logs",
        "IsLogging": true,
        "IsMultiRegionTrail": true,
        "EnableLogFileValidation": true,
        "IncludeGlobalServiceEvents": true
      }
    },
    "AuditLogBuckets3": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "BucketName": "saa-security-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-security-cloudtrail-logs"
          }
        ]
      }
    },
    "CloudWatchcloudwatch": {
      "Type": "AWS::CloudWatch::Alarm",
      "Properties": {
        "AlarmName": "saa-security-unauthorized-api",
        "AlarmDescription": "Alert on unauthorized API calls detected by CloudTrail.",
        "Namespace": "CloudTrailMetrics",
        "MetricName": "UnauthorizedAttemptCount",
        "Statistic": "Sum",
        "Period": 300,
        "EvaluationPeriods": 1,
        "Threshold": 1,
        "ComparisonOperator": "GreaterThanOrEqualToThreshold",
        "TreatMissingData": "notBreaching"
      }
    },
    "SecurityAlertssns": {
      "Type": "AWS::SNS::Topic",
      "Properties": {
        "TopicName": "saa-security-alerts",
        "DisplayName": "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