Soru

Zorluk: OrtaStream Processing and Event Routing with Amazon Kinesis and EventBridge

A developer is building a security auditing system. An application publishes security events to Amazon EventBridge. A specific rule on the EventBridge event bus matches high-priority authorization failure events and routes them to an Amazon Kinesis Data Stream. An AWS Lambda function is configured to process events from the Kinesis Data Stream to detect potential security threats in real-time. During testing, the developer observes two issues:

1. The Kinesis Data Stream is experiencing throughput throttling on a single shard, even though the overall data volume is well below the stream's aggregate limit.
2. The Lambda function, which is deployed in a private VPC subnet to access a database, is failing to call the EventBridge API to publish alerts.

Which two actions should the developer take to resolve these issues?

  1. Update the producer application to use a high-entropy partition key, such as the unique userId, when publishing events to the Amazon Kinesis Data Stream.Cevap
  2. Create an interface VPC endpoint (AWS PrivateLink) for Amazon EventBridge in the VPC, or route the private subnet traffic through a NAT Gateway in a public subnet.Cevap
  3. C
    Increase the shard capacity of the Amazon Kinesis Data Stream and configure the producer to use a static string, such as the application name, as the partition key.
  4. D
    Modify the Lambda function's IAM execution role trust policy to allow the VPC service principal (vpc.amazonaws.com) to assume the role.
  5. E
    Increase the Lambda function's timeout configuration to allow the EventBridge API client request to complete before the execution context is reused.

Cevap

To resolve the issues, the developer should configure the producer application to use a high-entropy partition key like the unique userId for Kinesis Data Streams, and establish VPC network connectivity for the Lambda function using an interface VPC endpoint or a NAT Gateway.
The correct approach involves using a high-entropy partition key (such as userId) to distribute traffic evenly across shards, and resolving the private VPC subnet's lack of internet/AWS public service connectivity by creating a VPC endpoint or routing through a NAT Gateway.

Adım Adım Çözüm

1
Analyze the Kinesis Data Stream throttling.
Determine that the static partition key is causing a hot shard.
Using low-entropy keys like static strings hashes all records to the same shard.
2
Analyze the Lambda VPC network failure.
Identify the lack of internet or service routing from the private subnet.
Lambda functions in private subnets cannot reach public AWS endpoints without a NAT Gateway or VPC endpoint.
3
Implement the fixes.
Change the partition key design to userId and configure PrivateLink or a NAT Gateway.
This distributes the stream load across shards and opens a network path to the EventBridge API.

Anahtar Kavram

Stream Processing and Event Routing with Amazon Kinesis and EventBridge
Bu soruyu puanla