How do you implement compliance as code for a framework like CIS AWS Foundations?
IntermediateScenarioCloud IAM and Compliance
Answer
Situation read → Manual checklists drift. Codify the checks so they run continuously and in pipelines.
What I'd do →
- Runtime: enable the CIS standard in Security Hub, or AWS Config conformance packs.
- Pre-deploy: Checkov or Trivy config scans on Terraform with CIS-mapped checks.
- Ad-hoc:
prowler aws --compliance cis_3.0_awsfor full reports. - Store exceptions in code with expiry dates and approvers.
- Report compliance score per account over time.
Why → The same control checked before deploy and at runtime catches both new and drifted issues.
Interview tip → Mention Prowler; it is a well known open-source tool.
More on Cloud IAM and Compliance
You find an IAM policy with `"Action": "*", "Resource": "*"` attached to an application role. How do you right-size it?BeginnerYour company has 40 AWS accounts with no central controls. How do you set up preventive guardrails?IntermediateGuardDuty reports `UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration.OutsideAWS`. What happened and what do you do?AdvancedYour company must pass SOC 2 Type II in six months. What does DevOps own, and how do you automate evidence?IntermediateA partner needs access to one S3 bucket in your account. How do you set up cross-account access safely?IntermediateSomeone logged in with the AWS root user last night. How do you react, and how should you have known?Beginner