Practice Test

True or False: Event source mapping is a service provided by AWS to integrate Lambda functions with other AWS services.

  • True
  • False

Answer: True

Explanation: Event source mapping is provided by AWS Lambda. It allows AWS services such as Amazon S3, Kinesis Data Streams, or DynamoDB to trigger a Lambda function.

Which among the following services can trigger an AWS Lambda function directly?

  • A) Amazon S3
  • B) AWS IoT Core
  • C) All of the above
  • D) None of the above

Answer: C) All of the above

Explanation: AWS Lambda functions can be directly triggered by various AWS services including both Amazon S3 and AWS IoT Core, along with others such as Kinesis and DynamoDB.

What does AWS Lambda do when it detects an error while executing a function with event source mapping?

  • A) It never retries
  • B) It always retries the function twice
  • C) The behavior can be configured
  • D) It sends an error message

Answer: C) The behavior can be configured

Explanation: The behavior of AWS Lambda when it encounters an error can be configured. By default, it retries the function twice, but this can be changed according to the specific requirements.

True or False: You can pause an event source mapping.

  • True
  • False

Answer: True

Explanation: Yes, you can pause event source mappings in AWS Lambda. This can be useful during debugging, preventing new invocations while still preserving the existing event source mapping.

What is an effective strategy for handling errors in Lambda with an event source mapping?

  • A) Dead-letter queues
  • B) Setting up CloudWatch alarms
  • C) Setting Lambda to retry
  • D) All of the above

Answer: D) All of the above

Explanation: All these options can be effectively utilized to handle errors in AWS Lambda with event source mapping. These strategies can provide a resilient error handling mechanism.

True or False: Event source mapping supports all AWS services as event sources.

  • True
  • False

Answer: False

Explanation: While a lot of AWS services can be configured as event sources, not all AWS services are supported.

True or False: Every event source mapping is associated with one and only one Lambda function.

  • True
  • False

Answer: True

Explanation: Each event source mapping in AWS Lambda is associated with one Lambda function. However, a single function can have multiple event source mappings.

Which of the following can you specify when creating an Event Source Mapping?

  • A. The maximum age of a record that Lambda sends to your function.
  • B. The batch window for your function.
  • C. The maximum number of times to retry when the function returns an error.
  • D. All of the above.

Answer: D. All of the above.

Explanation: When creating an Event Source Mapping, you can specify the maximum record age, the batch window, and the maximum number of retries.

True or False: The order in which AWS Lambda processes a batch of records is predictable and remains consistent.

  • True
  • False

Answer: False

Explanation: AWS Lambda does not guarantee order when processing a batch of records. It’s best to treat it as a concurrent operation to avoid any order dependency.

True or False: AWS Lambda supports concurrent stream processing for Kinesis and DynamoDB streams.

  • True
  • False

Answer: True

Explanation: AWS Lambda allows you to process Kinesis and DynamoDB streams concurrently by dividing the stream into batches or shards. This lets you achieve higher data throughput in your stream processing.

Interview Questions

What is event source mapping in AWS?

Event source mapping is an AWS service feature that lets you set up Lambda functions to react to data changes in a Kinesis data stream, a DynamoDB stream, or an SQS queue.

How does AWS Lambda handle failures when processing the batch of records with event source mapping?

If AWS Lambda function fails to process any record in a batch before the batch “iterates out,” the function returns an error and AWS retries the batch until processing succeeds or the data expires.

Which services can be used as an event source in AWS Lambda?

Amazon Kinesis, Amazon SQS and Amazon DynamoDB are the services that can be used as an event source in AWS Lambda.

Which IAM permissions are required to create an event source mapping?

The ‘lambda:CreateEventSourceMapping’, ‘lambda:UpdateEventSourceMapping’ and the ‘lambda:GetEventSourceMapping’ permissions are required to create an event source mapping.

What happens if you delete an event source mapping?

If you delete an event source mapping, it stops fetching records from the source. Existing records are not affected, but your function no longer receives the event source records.

What is the maximum batch size for event source mapping with Amazon Kinesis?

The maximum batch size for event source mapping with Amazon Kinesis is 10,000 records.

Can event records order be maintained while using event source mapping in AWS Lambda?

Yes. While using Amazon Kinesis or Amazon DynamoDB as an event source, setting the function’s concurrency can ensure it processes events in order.

When is an error thrown by an event source mapping in AWS Lambda?

An error is thrown by an event source mapping in AWS Lambda if the mapping is unable to read an event source or if the function is throttled.

How can you manage the concurrency of an AWS Lambda function with event source mapping?

You can manage the concurrency of an AWS Lambda function with event source mapping by setting a reserved concurrency limit or by configuring provisioned concurrency.

How long does AWS retain records in case of a polling failure?

AWS Lambda retries the batch until processing succeeds or the data expires, which, in the case of DynamoDB Streams, Kinesis data streams, and Simple Queue Service, is 24 hours.

When does an event source mapping become “idle”?

An event source mapping becomes “idle” when it is open but doesn’t read records for more than 5 minutes, or doesn’t meet the maximum batch size for more than 5 minutes.

What is the self-managed event source in AWS Lambda?

A self-managed event source in AWS Lambda refers to an HTTP endpoint, xmlrpc endpoint, an email address, or a queue where you run or manage the service that routes events to your Lambda function.

Leave a Reply

Your email address will not be published. Required fields are marked *