A practical, reproducible AWS security baseline that deploys core controls with Terraform and verifies them with a lightweight Python audit CLI.
✅ Goal: prove the full security signal pipeline works end-to-end — including real alert delivery — and document it with evidence.
Single-account demo (examples use eu-central-1).
This repository builds an AWS security alert pipeline and verifies that it works end-to-end.
Terraform deploys GuardDuty, EventBridge, and SNS, plus logging/alerting components (CloudTrail, CloudWatch Logs, retention, alarms).
The Python audit CLI verifies the setup and generates a report.
This is about more than creating resources — it’s about proving that findings are routed correctly and alerts actually arrive.
- Enables GuardDuty in the selected region.
- Creates an EventBridge rule that matches GuardDuty findings.
- Forwards matching events to an SNS topic (
baseline-alerts). - Delivers notifications to an email subscription (after subscription confirmation).
- Enables CloudTrail and sends logs to CloudWatch Logs (including retention settings and basic alarms).
- Optional: enables AWS Config and applies S3 public read/write managed rules.
After terraform apply, run:
python -m aws_audit scanto validate the key controls and wiringpython -m aws_audit report --format markdownto generate a readable report
Outputs:
python-cli/out/scan.jsonpython-cli/out/report.md
The Evidence section includes console/CLI screenshots and an example SNS email to show alert delivery.
This repo is intentionally scoped to a single AWS account and one region to keep deployment and verification reproducible. Organization-wide multi-account setups (AWS Organizations / delegated admin) and full landing zone patterns are out of scope for this repo.
flowchart LR
GD[🛡️ GuardDuty Findings] --> EB[📡 EventBridge Rule]
EB --> SNS[📣 SNS Topic: baseline-alerts]
SNS --> EMAIL[✉️ Email Subscription]
CLI[🧪 Python Audit CLI] -. validates .-> GD
CLI -. validates .-> EB
CLI -. validates .-> SNS
- 🛡️ GuardDuty
- 📡 EventBridge
- 📣 SNS
- 🧾 CloudTrail
- 🧪 AWS Config
Preview: end-to-end alert delivery (SNS → Email)
Show screenshots
Tip: These are clickable thumbnails. Click to open the full-size image.
01 — EventBridge rule: GuardDuty findings → SNS
02 — Verified via CLI: aws events describe-rule
03 — Verified target via CLI: SNS is attached to the rule
04 — Audit CLI: scan + markdown report generation
git clone https://github.com/Cann65/aws-security-baseline.git
cd aws-security-baselineterraform -chdir=terraform init
terraform -chdir=terraform apply -var="alert_email=YOUR_EMAIL"After
apply: confirm the SNS subscription email (required for alert delivery).
Replace
<PROFILE>with your AWS CLI profile (examples useeu-central-1).
cd python-cli
python -m venv .venv
# Activate venv (choose your OS):
# Windows PowerShell:
.\.venv\Scripts\Activate.ps1
# Linux/macOS:
source .venv/bin/activate
pip install -r requirements.txt
python -m aws_audit scan --profile <PROFILE> --region eu-central-1
python -m aws_audit report --format markdownterraform -chdir=terraform destroy -var="alert_email=YOUR_EMAIL"GuardDuty, CloudTrail, CloudWatch Logs, and SNS all incur AWS charges while enabled. Keep runs short-lived and destroy the stack when finished.
aws events describe-rule \
--name baseline-guardduty-findings \
--region eu-central-1 \
--profile <PROFILE>aws events list-targets-by-rule \
--rule baseline-guardduty-findings \
--region eu-central-1 \
--profile <PROFILE>aws sns publish \
--topic-arn arn:aws:sns:eu-central-1:<ACCOUNT_ID>:baseline-alerts \
--subject "baseline-alerts test" \
--message "SNS delivery test from CLI (eu-central-1)" \
--region eu-central-1 \
--profile <PROFILE>This repo is designed to be public. It must never contain:
- access keys / secret keys / session tokens
- SSO cache
- Terraform state files
- generated audit outputs
Required: keep these paths out of Git:
**/terraform.tfstate***/.terraform/**/.aws/and**/sso/cache/python-cli/out/**/*.tfvarsand.env*
Covered by .gitignore, so these are already excluded from commits (double-check before pushing).
- Add Slack/Teams notifications (SNS → Lambda → webhook)
- Add multi-account support (Organizations / delegated admin) as a separate module
- Add a CI job to run the audit CLI in read-only mode
- AWS-native detection & alerting (GuardDuty + EventBridge + SNS)
- Infrastructure as Code (Terraform) with reproducible deployments
- Verification-driven security (audit CLI)
- Evidence-driven delivery (console + CLI + delivered email)
MIT — see LICENSE


