Preventing Cross-Environment Lambda Invocations via Resource Policies
A company uses AWS Lambda functions and an Amazon S3 trigger to process images into an S3 bucket. A development team set up multiple environments in a single AWS account. After a recent production deployment, the development team observed that the development S3 buckets invoked the production environment Lambda functions. These invocations caused unwanted execution of development S3 files by using production Lambda functions. The development team must prevent these invocations. The team must follow security best practices. Which solution will meet these requirements?
Community Votes
66% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The exam tests your ability to apply least-privilege access controls using Lambda resource policies, often trapping candidates who over-engineer solutions with multi-account setups when a simpler policy fix suffices.
This question addresses how to prevent unintended cross-environment Lambda invocations caused by shared S3 triggers within a single AWS account. It establishes that applying resource-based policies is the direct and secure method to scope access.
Many candidates choose Option B because they prioritize 'best practices' for isolation (multi-account) over the specific technical requirement to stop the immediate trigger conflict, leading to unnecessary architectural changes.
Community Discussion (40 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
Option C is the correct solution because it directly addresses the root cause: the production Lambda function lacks restrictions on which S3 buckets can invoke it. By attaching a resource-based policy to the production Lambda function that explicitly allows invocation only from the production S3 bucket's ARN, you enforce strict access control without changing the account structure. This aligns with AWS security best practices for scoping permissions.Why the Other Options Are Wrong
Option A modifies the execution role, which controls what the Lambda function does after invocation, not who can trigger it. Options B and D suggest moving environments into separate accounts. While multi-account strategies are a valid long-term best practice for isolation, the question asks for a solution to prevent these specific invocations following best practices in the current context. Adding a resource policy is the standard, immediate remediation for this specific permission gap. Furthermore, Option D adds unnecessary complexity regarding execution roles for reading data, which doesn't solve the invocation trigger issue.Community Comment Notes
Community consensus is split, with many users favoring Option B due to the phrase "security best practices," interpreting it as a mandate for account separation. However, as noted by user AgboolaKun, "the resource policy in the production environment can be used to control which S3 bucket invokes the function," making C the technically precise answer for the stated problem. User SD_CS also highlights that while separation is good, the resource policy "fulfill[s] requirement" directly. The key is recognizing that the question describes a permission misconfiguration solvable by IAM/Resource policies rather than an infrastructure design flaw requiring account migration.Official Reference
Exam Strategy
When a question specifies a technical failure (like unwanted invocations) and asks for a solution adhering to best practices, look for the most direct permission control mechanism first (e.g., Resource Policies). Do not jump to complex architectural changes like multi-account setups unless the question explicitly demands complete tenant isolation or mentions billing/account-level boundaries.
Frequently Asked Questions
Why isn't separating accounts required?
Account separation is a broad best practice, but a resource policy provides immediate, granular control over who can invoke the function, solving the specific leak described.
Does modifying the execution role help?
No, the execution role defines permissions for actions inside the function (e.g., writing to S3), not permissions for external services triggering the function.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →