Security & FinOps · Freelance
Cloud Governance as Code with Cloud Custodian
A library of policies that auto-tag resources, enforce bucket encryption, remove open security-group rules and report IAM users without MFA, with an SQS-based mailer.
// Overview
Policies run in CloudTrail mode so Lambdas fire on API events: auto-tagging instances with their creator, enabling default encryption on new buckets, removing open ingress rules and notifying the user who added them, and finding users with MFA inactive. A mailer delivers notifications through SQS. Multi-account and multi-region variants and report-style policies are included.
// The problem
Compliance needed continuous, automated enforcement of tagging, encryption, network exposure and MFA rules.
// Flow
- Policy YAMLresource, mode, filters and actions per rule
- CloudTrail modeLambda and event rule provisioned for key API events
- Filtertag absent, encryption off, open ingress, MFA inactive
- Action gateauto-tag, set encryption or remove the rule
- Notifymailer emails the offending user via SQS
- Multi-accountaccount lists and all-region variants
- Reportingreport policies and a control mapping
// Design decisions & guardrails
- Remediation at event time rather than periodic scans.
- Notification is attributed to the actor who made the change.
- Account identifiers are templated, not hardcoded.
// Outcome
Policy violations fixed within seconds of the API call that caused them.