AWS Serverless and Lambda Architecture 5 — Questions and Answers
Question 1: An event-driven application uses EventBridge to route events from multiple AWS services to different Lambda functions. A new compliance requirement mandates that all events must be archived for 7 years. What is the simplest solution?
- Add a Lambda function triggered by every rule that writes events to S3 Glacier
- Enable EventBridge event archiving on the event bus with a 7-year retention period (Correct answer)
- Configure CloudTrail to capture all EventBridge API calls and store them in S3
- Use Kinesis Data Firehose as an additional EventBridge target to archive events
Correct answer: Enable EventBridge event archiving on the event bus with a 7-year retention period
EventBridge natively supports event archiving directly on the event bus with a configurable retention period, making it the simplest compliance solution.
Question 2: What is the maximum size of the /tmp ephemeral storage available to a Lambda function by default, and what is the configurable maximum?
- 512 MB default, 10 GB maximum (Correct answer)
- 1 GB default, 10 GB maximum
- 512 MB default, 512 MB maximum (not configurable)
- 256 MB default, 1 GB maximum
Correct answer: 512 MB default, 10 GB maximum
Lambda provides 512 MB of /tmp storage by default, configurable up to 10,240 MB (10 GB) for functions that need to process large files.
Question 3: A company runs a Lambda function that calls a third-party API with a fixed rate limit of 10 requests per second. The function is invoked thousands of times per minute. How should concurrency be controlled to avoid hitting the rate limit?
- Set Lambda reserved concurrency to 10 to limit concurrent executions
- Use an SQS queue as an event source with Lambda reserved concurrency set to match the desired request rate (Correct answer)
- Enable Lambda provisioned concurrency to pre-warm exactly 10 instances
- Use a Step Functions Map state with maxConcurrency set to 10
Correct answer: Use an SQS queue as an event source with Lambda reserved concurrency set to match the desired request rate
Placing requests in SQS and setting Lambda reserved concurrency to a low value (e.g., 1) controls the processing rate and protects the third-party API from being overwhelmed.
Question 4: Which Lambda feature enables you to deploy a new version gradually, sending 10% of traffic to the new version while monitoring for errors before shifting the remaining 90%?
- Lambda aliases with weighted routing
- Lambda layers with version pinning
- Lambda provisioned concurrency with traffic shifting
- CodeDeploy with Lambda canary deployment configuration (Correct answer)
Correct answer: CodeDeploy with Lambda canary deployment configuration
AWS CodeDeploy integrates with Lambda to support canary, linear, and all-at-once traffic shifting strategies with automatic rollback on CloudWatch alarm breach.
Question 5: A serverless API built on API Gateway and Lambda is experiencing cold start latency issues for Java functions. Which combination of settings best mitigates this without significant cost increase?
- Increase Lambda timeout and memory to maximum values
- Enable provisioned concurrency on the Lambda alias used by API Gateway with SnapStart enabled (Correct answer)
- Use Lambda@Edge instead of regional Lambda to reduce geographic latency
- Convert all Lambda functions to container images for faster startup
Correct answer: Enable provisioned concurrency on the Lambda alias used by API Gateway with SnapStart enabled
Lambda SnapStart (for Java) takes a snapshot of the initialized execution environment, dramatically reducing cold start times, and provisioned concurrency ensures warm instances are always available.
Question 6: An architect needs to fan out a single event to 5 downstream Lambda functions simultaneously. Which approach is most scalable and loosely coupled?
- Chain Lambda functions where each function calls the next one directly
- Publish the event to an SNS topic with 5 Lambda subscriptions (Correct answer)
- Use a Step Functions Parallel state to invoke 5 Lambda functions
- Configure 5 separate EventBridge rules matching the same event pattern
Correct answer: Publish the event to an SNS topic with 5 Lambda subscriptions
SNS natively supports fan-out to multiple Lambda subscribers, delivering the message to all 5 functions simultaneously without tight coupling between them.
Question 7: A Lambda function must process S3 object creation events but the architect needs to filter events so only objects with the prefix 'invoices/' and suffix '.pdf' trigger the function. Where is this filter configured?
- Inside the Lambda function handler using an if statement to ignore non-matching events
- In the S3 bucket policy as a condition on the s3:ObjectCreated action
- In the S3 event notification configuration using prefix and suffix filters (Correct answer)
- In an EventBridge rule using event pattern matching on the S3 event
Correct answer: In the S3 event notification configuration using prefix and suffix filters
S3 event notifications support prefix and suffix filters natively, so only matching objects trigger the notification—preventing unnecessary Lambda invocations.
An event-driven application uses EventBridge to route events from multiple AWS services to different Lambda functions.
A new compliance requirement mandates that all events must be archived for 7 years.
What is the simplest solution?