[DEVELOPER] Advanced Lambda Flashcards

(23 cards)

1
Q

What are the three main types of Lambda invocation?

A
  1. Synchronous (RequestResponse), 2. Asynchronous (Event), 3. Event Source Mapping (Poll-based).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens to asynchronous events that fail after all retries?

A

They are sent to a Dead Letter Queue (SQS or SNS) or a Lambda Destination (SQS, SNS, another Lambda, or EventBridge).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the default retry behavior for an Asynchronous Lambda invocation?

A

2 retries over a period of up to 6 hours.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What two services can be used as a Dead Letter Queue (DLQ) for Lambda?

A

SQS (Queue) and SNS (Topic).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

When a Lambda is triggered by an SQS Queue, who manages retries?

A

The Lambda Event Source Mapping manages the retries; the SQS queue will handle the message’s visibility timeout and redelivery until it reaches the queue’s Redrive Policy (DLQ).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a “Cold Start” in AWS Lambda?

A

The time taken for Lambda to download the code and initialize the runtime and execution environment before running the handler function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you minimize cold starts for a critical Lambda function?

A

Configure Provisioned Concurrency. This keeps a specified number of execution environments initialized and ready to respond.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the difference between Reserved Concurrency and Provisioned Concurrency?

A

Reserved: A hard limit on the maximum concurrent executions for a function (prevents throttling).
Provisioned: Keeps environments warm and ready (solves cold starts).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a Lambda Layer?

A

A ZIP file archive containing supplementary code, libraries, or custom runtimes that can be shared across multiple Lambda functions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is required for a Lambda function to access resources inside a VPC?

A

The function must be configured with the appropriate VPC Subnets and Security Groups.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

If a VPC-configured Lambda needs to access the public internet (e.g., S3 or a public API), what is required?

A

It must route traffic through a Private Subnet → NAT Gateway → Internet Gateway.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What service is used to manage and rotate database credentials for a Lambda function?

A

AWS Secrets Manager

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the best way to secure a secret (like a database connection string) used by a Lambda function?

A

Store it in AWS Secrets Manager or SSM Parameter Store (SecureString), and grant the Lambda Execution Role permissions to decrypt/retrieve it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the use case for AWS Lambda Reserved Concurrency?

A

To protect downstream resources from overload

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the use case for AWS Lambda Provisioned Concurrency?

A

Eliminate cold starts for critical, low-latency functions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Suppose you have a lambda triggered by an SQS queue. Where do you configure sending messages to a DLQ after X failures?

A

In SQS (NOT Lambda!)

17
Q

A developer wants to debug a Lambda function using the AWS CLI. They invoke the function with ‘RequestResponse’ invocation type. How can they view the logs in the CLI response?

A

Use the --log-type Tail parameter.

18
Q

What AWS CLI command retrieves the error message from a failed Lambda invocation?

A

You must decode the x-amz-function-error header.

19
Q

What is the maximum size of the deployment package for a Lambda function (zipped)?

20
Q

What is the maximum size of the deployment package for a Lambda function (unzipped)?

21
Q

You have a Lambda function configured with 128 MB of memory. The function is CPU bound and performing slowly. How can you increase the CPU power allocated to the function?

A

Increase the allocated memory.

In Lambda, CPU power is allocated proportionally to memory. Increasing memory automatically increases CPU.

22
Q

A developer wants to ensure that their Lambda function has access to the /tmp directory with a size of 2 GB. How can this be configured?

A

Configure the Ephemeral Storage setting in the function configuration.

You can configure ephemeral storage (/tmp) between 512 MB and 10 GB.

23
Q

You have a Lambda function that consumes messages from an SQS FIFO queue. What is the maximum concurrency limit for this function?

A

It is equal to the number of active Message Groups in the queue.

For FIFO queues, Lambda scales up to the number of active message groups to ensure order is preserved per group.