Lambda Flashcards

This deck aims to help retain concepts related to the Lambda service.

1
Q

Which AWS service provides event-driven, serverless computing capabilities, enabling developers to execute code in response to events without managing or provisioning servers, while automatically handling the required computing resources?

A

AWS Lambda

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

What is the primary element of a Lambda function that must be specified upon creation, where the function’s code is loaded and executed?

A

Runtime Environment (e.g. Python 3.8), which includes allocated memory, the amount of memory determines the vCPU allocation (e.g. 1769MB of memory equals 1 vCPU)

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

What feature allows for the creation of custom runtime environments in AWS Lambda?

A

Layers can be used to create custom runtime (e.g. Rust)

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

How is AWS Lambda billed?

A

Billed for the duration that the function runs

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

Can a Lambda function maintain a persistent state?

A

No, Lambda functions are stateless

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

What is the maximum allowed size for an AWS Lambda deployment package?
Hint: code deployed to the function.

A

Up to 50MB zipped, 250MB unzipped, or 10GB for an uncompressed container image including all layers

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

What are the minimum and maximum memory allocations for a Lambda function?

A

Memory can be defined from 128MB to 10,240MB in 1MB increments, the amount of memory directly affects the vCPU allocation (e.g. 1769MB equals 1 vCPU)

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

Does AWS Lambda provide temporary storage for data?

A

Yes, Lambda provides 512MB of default storage at /tmp, which can be increased up to 10,240MB

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

Is there a limit on the execution time for AWS Lambda functions?

A

Yes, Lambda functions can run for a maximum of 900 seconds (15 minutes) before timing out, making it unsuitable for tasks exceeding 15 minutes in execution time

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

Can AWS Lambda execute functions within Docker containers?

A

Technically, yes, Lambda can run Docker images specifically built for its environment, however, during exams, Docker is generally considered an anti-pattern for Lambda

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

How does AWS Lambda address security concerns, and how can a function access other AWS services?

A
  • Execution Role with an IAM policy is used to grants necessary permissions to access other AWS services during execution
  • Trust Policy is used to allows Lambda to assume Execution Role
  • Resource-based policy is used controls which services or AWS accounts can or invoke the function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are some ideal use cases for AWS Lambda?

A
  • Core component of serverless architectures (along with S3 and API Gateway)
  • File processing (with S3 and S3 Events)
  • Database triggers (with DynamoDB and DynamoDB Streams)
  • Serverless CRON jobs (with EventBridge/CloudWatch Events)
  • Real-time stream data processing (with Kinesis)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are the two networking modes available for AWS Lambda?

A
  • Public Networking (the default)
  • VPC Networking
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which AWS Lambda networking mode provides access to public AWS services (e.g., SQS, DynamoDB) and the public internet?

A

Public Networking mode

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

Which AWS Lambda networking mode offers the best performance?

A

Public Networking mode, as it does not require customer-specific VPC networking

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

Which AWS Lambda networking mode does not provide access to services within a VPC, unless those services have public IP addresses and security controls permit external access?

A

Public Networking mode

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

Which AWS Lambda networking mode is typically the default choice?

A

Public Networking mode.

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

What configuration is needed for an AWS Lambda function in VPC Networking mode to access the public internet?

A

Configure it similarly to other private services, using a VPC Gateway Endpoint for services like DynamoDB or a NAT Gateway in a public subnet for outbound internet access

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

Which AWS Lambda networking mode operates in a private subnet within a VPC?

A

VPC Networking mode

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

Which AWS Lambda networking mode adheres to the same rules as other services within a VPC?

A

VPC Networking mode

21
Q

Which AWS Lambda networking mode can freely access other VPC-based resources?

A

VPC Networking mode

22
Q

Which AWS Lambda networking mode has no access outside the VPC unless configured otherwise?

A

VPC Networking mode

23
Q

What tracing and monitoring options are available for AWS Lambda functions?

A
  • CloudWatch for tracking invocation success/failure, retries, and latency
  • CloudWatch Logs for Lambda execution logs
  • AWS X-Ray for distributed tracing
23
Q

Which AWS Lambda networking mode may experience an initial invocation delay of up to 90 seconds?

A

VPC Networking mode, due to the setup of Security Groups and Subnets, and the allocation of an Elastic Network Interface (ENI) in the customer’s VPC

24
Q

Does AWS Lambda require additional permissions to use CloudWatch Logs?

A

Yes, these permissions are provided via the Execution Role

25
Q

Which AWS Lambda component represents the combination of function configuration and code?

A

Version, once a version is published, it becomes immutable and has its own ARN, while $Latest points to the most recent version

26
Q

Which AWS Lambda feature allows you to point to a specific function version?

A

An Alias can be used to point to a specific function version (e.g. Prod, Stage)

27
Q

What invocation modes are supported by AWS Lambda?

A
  • Synchronous Invocation
  • Asynchronous Invocation
  • Polling Invocation (event sourcing)
28
Q

Which AWS Lambda invocation mode is used to invoke the function directly via API/CLI or indirectly through API Gateway?

A

Synchronous Invocation mode

29
Q

Which AWS Lambda invocation mode is used when providing the function with data during the call?

A

Synchronous Invocation mode

30
Q

Which AWS Lambda invocation mode is used when services invoke the Lambda function on your behalf, such as S3 event triggers invoking the function when an object is uploaded to the bucket?

A

Asynchronous Invocation mode

30
Q

Which AWS Lambda invocation mode is used when the client is waiting for the response?

A

Synchronous Invocation mode

31
Q

Which AWS Lambda invocation mode is used when successful or unsuccessful responses are returned?

A

Synchronous Invocation mode

32
Q

Which AWS Lambda invocation mode is used when errors or retries are handled by the client?

A

Synchronous Invocation mode

33
Q

Which AWS Lambda invocation mode is used when the service does not wait for the response?

A

Asynchronous Invocation mode

34
Q

Which AWS Lambda invocation mode is used when the Lambda service is responsible for retries (configurable between 0 and 2 times)?

A

Asynchronous Invocation mode

35
Q

Which AWS Lambda invocation mode is used when the function needs to be idempotent?

A

Asynchronous Invocation mode, (e.g. ensure a $10 balance is increased to $20 by setting the balance to $20, and not adding another $10)

36
Q

Which AWS Lambda invocation mode allows SQS queues or SNS topics to be used as a dead letter queue (DLQ) to store failed invocation attempts for further analysis?

A

Asynchronous Invocation and Polling Invocation modes

37
Q

Which AWS Lambda invocation mode allows an event processed by Lambda functions to be delivered to other destinations (e.g., SNS, SQS, Lambda, EventBridge), with separate destinations for successful or failed processing?

A

Asynchronous Invocation mode

38
Q

Which AWS Lambda invocation mode is used for streams or queues that don’t support event generation to invoke Lambda (e.g., Kinesis, DynamoDB Streams, SQS)?

A

Polling Invocation mode, this mode polls streams and retrieves source batches, breaking them into event batches to send to Lambda, a single invocation can process many events in a batch, and the event source mapping reads from the source using permissions defined in the Lambda Execution Role

39
Q

What steps occur when an AWS Lambda function is executed?

A
  • The execution context is initialized (underlying physical hardware)
  • The runtime environment is downloaded and installed
  • The deployment package, along with any dependencies, is downloaded and installed

Each of these steps adds to the overall execution time

40
Q

What is the process called when a Lambda function is invoked and the execution context needs to be initialized from scratch?

A

Cold Start (this invocation can take several hundred milliseconds or more)

41
Q

What is the process called when a Lambda function is invoked, and the execution context has already been initialized with the deployment package downloaded and installed?

A

Warm Start (this invocation typically takes just a few milliseconds)

42
Q

Which AWS Lambda feature can be used to keep multiple execution contexts pre-warmed and ready to improve invocation speed?

A

Provisioned Concurrency, useful for reducing cold start latencies for functions but incurs no additional charges

42
Q

How many Lambda functions can run concurrently within a single execution context?

A

Only one function can run per execution context, therefore, if 20 functions are triggered simultaneously, 20 separate Cold Starts would be initiated

43
Q

Can a service that invokes AWS Lambda always guarantee that the function will be executed in a Warm Start?

A

No, every function invocation should expect to be executed as a Cold Start

44
Q

How can you optimize AWS Lambda invocation if downloading specific assets within the function is causing delays?

A

Use the /tmp storage to pre-download necessary assets (the /tmp storage can be configured to range between 512 MB and 10,240 MB)

45
Q

Which AWS Lambda feature can be used to reserve the maximum number of concurrent instances allocated to your function so no other function can use that concurrency?

A

Reserved concurrency, useful for ensuring that your most critical functions always have enough concurrency to handle incoming requests but incurs no additional charges