A developer is building a video streaming application that publishes user engagement events to an Amazon Kinesis Data Stream. An AWS Lambda function processes these events in batches. For specific events, such as 'UpgradeAccount', the Lambda function must publish a message to an Amazon EventBridge custom event bus to trigger downstream provisioning workflows.
During high-load testing, the developer observes two issues:
1. The Lambda function frequently runs out of time while processing batches of events.
2. The Lambda function fails to publish events to the EventBridge custom event bus, receiving an AccessDeniedException.
Which combination of actions should the developer take to resolve these issues? (Select TWO.)
- Decrease the BatchSize parameter of the Lambda event source mapping and ensure the Lambda function's timeout is set appropriately.Cevap
- BModify the producer to use a static string as the partition key for all Kinesis records to ensure sequential processing and prevent Lambda concurrency issues.
- Attach an IAM policy to the Lambda function's execution role that grants the events:PutEvents permission for the EventBridge event bus resource.Cevap
- DModify the trust policy of the EventBridge custom event bus to allow the lambda.amazonaws.com service principal to assume the EventBridge role.
- EConfigure the Lambda function to run inside a private VPC subnet without a NAT Gateway or an EventBridge VPC endpoint to isolate the traffic and bypass EventBridge resource policies.
Cevap
Decrease the BatchSize parameter of the Lambda event source mapping and ensure the Lambda function's timeout is set appropriately; and attach an IAM policy to the Lambda function's execution role that grants the events:PutEvents permission for the EventBridge event bus resource.
To resolve the batch timeout, decreasing the BatchSize limits the payload volume per invocation, ensuring the Lambda function can complete execution within its timeout limits. To resolve the AccessDeniedException, the Lambda function's execution role must be granted the events:PutEvents permission, enabling it to write messages to the EventBridge custom event bus.
Adım Adım Çözüm
Anahtar Kavram
Stream processing tuning with Lambda batch settings and secure event routing to EventBridge via IAM permissions.
Tahmini Süre:2m 0s