A Lambda function is behind API Gateway and receives requests with an Authorization header. You must validate JWTs and route to different DynamoDB tables based on the tenant claim. Which approach is most secure and maintainable?

Answer

Validate JWT signature and claims in Lambda; select the DynamoDB table using tenantId from claims and restrict data access using IAM condition keys

Explanation

Even with an authorizer, enforcing claim validation and using least-privilege IAM with conditions helps prevent header manipulation and tenant escalation. Table/tenant routing should be backed by authorization controls, not just dynamic keys.

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