AWS Certified Solutions Architect Professional SAP-C02 Practice Question
A company has a multi-account AWS strategy using AWS Organizations. A central 'Shared Services' account hosts private Amazon ECR repositories with approved base container images. Multiple 'Development' accounts must use these base images to build and deploy their containerized applications to Amazon EKS clusters. A strict security mandate requires that no container image with 'CRITICAL' or 'HIGH' severity vulnerabilities, as identified by ECR's 'scan on push' feature, can be deployed. The solution must be automated and prevent vulnerable images from being deployed to the EKS clusters.
Which approach meets these requirements MOST effectively and securely?
Configure 'scan on push' in the Development accounts' ECR repositories. Use an Amazon EventBridge rule to trigger an AWS Lambda function upon scan completion. The Lambda function will inspect the scan results and, if 'CRITICAL' or 'HIGH' vulnerabilities are found, use the ecr:BatchDeleteImage API to immediately remove the vulnerable image from the repository.
Configure 'scan on push' in the Development accounts' ECR repositories. Use an Amazon EventBridge rule to trigger an AWS Lambda function that, upon scan completion, inspects the results. If vulnerabilities are found, the function writes the image digest and a 'BLOCKED' status to an Amazon DynamoDB table. In the EKS clusters, deploy a validating admission webhook that queries the DynamoDB table and rejects any pod creation request specifying a 'BLOCKED' image.
Configure 'scan on push' in the Development accounts' ECR repositories. Mandate a new stage in all CI/CD deployment pipelines that calls an AWS Lambda function. This function will use the DescribeImageScanFindings API to check for 'CRITICAL' or 'HIGH' vulnerabilities. If found, the function will return an error, causing the pipeline to fail and stop the deployment.
Configure 'scan on push' in the Development accounts' ECR repositories. Use an Amazon EventBridge rule to trigger an AWS Lambda function that adds a specific tag (e.g., 'status:vulnerable') to the vulnerable image digest. Apply a repository policy on the ECR repositories that denies the ecr:BatchGetImage and ecr:GetDownloadUrlForLayer actions if the image has a condition tag of 'status:vulnerable'.
The correct answer describes a solution that uses a validating admission webhook in Amazon EKS to provide robust, non-bypassable enforcement. When ECR completes a vulnerability scan, an EventBridge rule triggers a Lambda function. This function processes the scan results and records the compliance status (e.g., 'BLOCKED') of the image digest in a DynamoDB table. The validating admission webhook, deployed in the EKS cluster, intercepts all pod creation requests. Before allowing a pod to be created, it queries the DynamoDB table to check the status of the requested container image. If the image is marked as 'BLOCKED', the webhook rejects the request, preventing the deployment. This approach is superior because enforcement happens at the cluster's control plane, making it impossible to bypass, unlike a CI/CD-based check.
The option suggesting the use of an ECR repository policy with an ecr:ImageTag condition is incorrect because AWS IAM policies and ECR repository policies do not support condition keys based on an image's Docker tag. Enforcement cannot be applied at the ECR pull layer using this method.
The option relying solely on the CI/CD pipeline for enforcement is less secure. While it would stop automated deployments, a user with sufficient permissions could still deploy a vulnerable image manually using kubectl or the AWS console, bypassing the pipeline check entirely.
The option to delete the vulnerable image is a reactive and destructive measure. It can create a race condition where a fast deployment process might pull the image before it is deleted. It also complicates debugging and auditing, as the problematic artifact is removed completely rather than being flagged and blocked.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
How does a validating admission webhook work in Amazon EKS?
Open an interactive chat with Bash
What is the role of Amazon DynamoDB in this solution?
Open an interactive chat with Bash
Why is this solution more secure than using a CI/CD pipeline for enforcement?
Open an interactive chat with Bash
AWS Certified Solutions Architect Professional SAP-C02
Accelerate Workload Migration and Modernization
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access