An AWS Lambda function uses environment variables to select different AWS resources by stage (dev/test/prod). A developer accidentally deploys a dev build to prod, and the function starts writing to dev resources. Which method most strongly reduces blast radius by enforcing stage alignment at the infrastructure permission layer?

Answer

Use IAM role with explicit ARNs that include only the correct prod resources; deny access to dev ARNs

Explanation

Hard-scoping the IAM policy to the intended prod resource ARNs ensures that even a misconfigured deployment cannot write to dev resources. It enforces correctness at authorization time rather than in application code.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error

Related questions

You need to ensure idempotency for an order-processing Lambda triggered by SQS messages. Messages might be delivered more than once, and processing must not double-charge. Which design is most appropriate?

View question →

A Lambda function reads multiple items from DynamoDB using BatchGetItem. The function should return a consistent view for a specific request, but the application does not require full transaction semantics across multiple tables. How can you best achieve request-level consistency?

View question →

A backend service uses API Gateway (HTTP API) to invoke a Lambda function. The Lambda writes to DynamoDB and occasionally needs to read additional details from S3. To meet least-privilege and avoid hardcoding credentials, which combination of AWS features is most appropriate?

View question →

You’re designing an AWS SDK-based .NET application that uploads objects to S3. The application must support resumable uploads and should minimize unnecessary retries and connection setup. What approach best fits the requirement?

View question →

In a serverless app, developers want to standardize how Lambda functions call external services with caching to reduce latency. They also want the cache to be shared across multiple concurrent function instances. The team proposes using an in-memory cache inside the Lambda handler, and also suggests storing tokens in environment variables for convenience. They need a robust approach that works across cold starts, supports token refresh, and avoids leaking secrets into logs or deployments.

View question →

A Node.js Lambda updates an item in DynamoDB using UpdateExpression and expects the update to fail if the record has changed since the client last read it. The client provides a version attribute. What DynamoDB strategy best ensures correct concurrency control?

View question →

QuestionBack to list