Lambda Flashcards

(30 cards)

1
Q

What is AWS Lambda?

A

AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. You only pay for the compute time you consume.

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

How does AWS Lambda work?

A

Lambda runs your code in response to events such as HTTP requests, file uploads to S3, or messages from SNS/SQS. You upload the code, set a trigger, and AWS handles execution.

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

What are the key features of AWS Lambda?

A

Serverless architecture, automatic scaling, pay-per-use pricing, integrated monitoring, and event-driven triggers.

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

What are Lambda triggers?

A

Triggers are services or events that cause a Lambda function to execute. Examples include S3, DynamoDB, SNS, API Gateway, and CloudWatch.

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

What languages does AWS Lambda support?

A

As of now, Lambda supports Python, JavaScript (Node.js), Java, C#, Go, Ruby, and PowerShell.

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

What are the use cases of AWS Lambda?

A

Use cases include serverless APIs, real-time file processing, IoT backends, chatbots, cron jobs, and ETL pipelines.

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

How do you monitor AWS Lambda?

A

Monitoring is done using Amazon CloudWatch logs and metrics, AWS X-Ray for tracing, and Lambda Insights for detailed performance data.

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

What is the max execution timeout for AWS Lambda?

A

The maximum timeout for a Lambda function is 15 minutes (900 seconds).

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

What is the default memory allocated to a Lambda function?

A

Default is 128MB, but it can be increased up to 10,240MB in 1MB increments.

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

How is concurrency handled in Lambda?

A

Lambda scales automatically with incoming requests, and concurrency limits define how many functions can run simultaneously.

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

What are cold starts in Lambda?

A

A cold start happens when AWS spins up a new container to handle a request. This can cause latency. It usually occurs when the function hasn’t been used recently.

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

How can you reduce Lambda cold starts?

A

Use provisioned concurrency, optimize function code, reduce package size, and keep functions warm using scheduled events.

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

What are environment variables in Lambda?

A

Environment variables store configuration settings and secrets, which can be accessed during function execution.

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

What are Lambda Layers?

A

Layers are a way to package libraries, dependencies, and custom runtimes separately from the main Lambda function code.

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

What is the Lambda execution role?

A

It’s an IAM role that grants Lambda permission to access other AWS services.

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

How can Lambda access a VPC?

A

You configure Lambda to connect to a VPC by setting up security groups and subnet IDs in its network settings.

17
Q

What is Provisioned Concurrency?

A

It keeps a Lambda function initialized and ready to respond instantly to requests, reducing cold starts.

18
Q

What is the difference between Lambda@Edge and regular Lambda?

A

Lambda@Edge runs functions closer to users by executing them at AWS Edge locations, ideal for CDN and low-latency scenarios.

19
Q

What are Lambda destinations?

A

Destinations define what happens after function execution, allowing routing of success or failure events to services like SNS, SQS, or Lambda.

20
Q

How do you deploy Lambda functions?

A

Functions can be deployed via the AWS Management Console, CLI, SDKs, Serverless Framework, SAM (Serverless Application Model), or Terraform.

21
Q

How is error handling done in Lambda?

A

Use retries, DLQs (dead letter queues), error logging via CloudWatch, and try/catch in code. Destinations can also help manage errors.

22
Q

What is the maximum package size for a Lambda deployment?

A

The zipped deployment package size can be up to 50MB (direct upload) or 250MB (via S3). Unzipped, it can go up to 250MB.

23
Q

What is the difference between synchronous and asynchronous invocation in Lambda?

A

Synchronous waits for the function to complete (e.g., API Gateway), while asynchronous queues the event and returns immediately (e.g., S3, SNS).

24
Q

What is AWS SAM?

A

AWS Serverless Application Model (SAM) is a framework for building serverless applications with simplified syntax for Lambda, API Gateway, etc.

25
How do you test Lambda functions locally?
Use AWS SAM CLI, Docker containers, or tools like LocalStack for offline testing.
26
Can Lambda functions call other Lambda functions?
Yes, one function can invoke another directly using the AWS SDK or indirectly via triggers.
27
How are timeouts and memory related to Lambda performance?
Increasing memory improves CPU and network throughput, reducing runtime. But it increases cost, so you must balance performance and budget.
28
Can Lambda run long-running tasks?
Lambda has a 15-minute max execution time. Long tasks should be split into smaller parts or run on EC2/Fargate.
29
How do you secure a Lambda function?
Use IAM roles, encrypt environment variables, run in VPC, restrict permissions, and validate inputs.
30
What is a Dead Letter Queue (DLQ)?
DLQ is used to capture failed asynchronous events, typically using SQS or SNS for later debugging.