hardMultiple ChoiceObjective-mapped
CAS-004 Practice Question: A company uses Terraform to deploy infrastructure…
A company uses Terraform to deploy infrastructure on AWS. They have a compliance requirement that all containers running on Amazon ECS must have a read-only root filesystem and must not run as root. The security team needs an automated way to enforce this policy and provide an audit trail for any violations. Which solution best meets these requirements?
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use Open Policy Agent (OPA) with Gatekeeper as an admission controller on Amazon EKS, and deploy EKS instead of ECS.
Open Policy Agent (OPA) with Gatekeeper is a Kubernetes admission controller that can enforce policies on pods at creation time, such as requiring read-only root filesystems and not running as root. However, the question specifies Amazon ECS, not EKS. Option D suggests migrating from ECS to EKS to leverage OPA/Gatekeeper, which meets the compliance requirement with automated enforcement and audit trail. Option A (manual review) is not automated. Option B (Terraform policy) validates at deployment time but does not enforce runtime behavior or provide audit trail for violations. Option C (custom Python script) is reactive and does not prevent violations. Therefore, D is the best solution despite the platform change.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Review all container definitions manually during the change management process.
Why it's wrong here
Manual review is error-prone and does not scale; automation is required for consistent enforcement.
- ✗
Add a Terraform policy that validates container definitions at deployment time.
Why it's wrong here
Terraform can validate configurations, but it cannot enforce runtime behavior once the container is running.
- ✗
Write a custom Python script that periodically scans running ECS tasks and reports violations.
Why it's wrong here
Scripts are reactive and do not prevent violations; they only detect after the fact.
- ✓
Use Open Policy Agent (OPA) with Gatekeeper as an admission controller on Amazon EKS, and deploy EKS instead of ECS.
Why this is correct
OPA/Gatekeeper enforces policies at runtime on Kubernetes, blocking non-compliant pods and providing audit logs. EKS replaced ECS to leverage this capability.
Go deeper
Related to this question
About these practice questions
This CAS-005 question is part of Courseiva's 968-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This CAS-005 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CAS-005 exam.