Lambda Flashcards

1
Q

Lambda Execution Context, and where does it reside?

A

The execution context is a temporary runtime environment that initializes any external dependencies of your Lambda function code, such as database connections or HTTP endpoints. This affords subsequent invocations better performance because there is no need to “cold-start” or initialize those external dependencies. Each execution context provides 512 MB – 10,240 MB of additional disk space in the /tmp directory.

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

What does Lambda use to poll services like DDB?

A

Event Source Mapping – a Lambda “resource” that uses permissions in the function’s execution role to read and manage items in the event source

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

Three components of Lambda pricing

A

Memory, Amount of compute time spent in execution, Number of executions

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

Sequence of invocation: Execution Context, Function Code (Handler, Logic)

A

Lambda launches the execution context. Within that context, it loads the code (logic) and then executes the handler, passing in the event object and the context object

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

How does one know where the log data from a Lambda function resides?

A

The “context” object provided by the Lambda runtime contains two pieces of information you can use to construct the log location: “logGroupName” and “logStreamName”

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

Where does the Lambda Execution Environment reside? What is its relationship to / tmp?

A

We don’t know where, but in a read-only file system. The execution environment takes advantage of ephemeral storage at / tmp (512 MB for free, up to 10,240) but that is a write-capacity file location, and is not where the execution environment resides.

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

Can I invoke a Lambda function via a dedicated HTTP(S) endpoint?

A

Yes. By using Lambda Function URLs, you can directly invoke your Lambda function using a simple HTTPS request without needing to set up additional services like API Gateway.

Ex: https://<url-id>.lambda-url.<region>.on.aws</region></url-id>

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

Does a Lambda version ever change? Does $Latest change?

A

No. It is immutable. It even has an ARN assigned.

$Latest changes, and as a consequence, it has an UNQUALIFIED ARN assigned to it

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

What is a Lambda Alias? Why is it useful?

A

A pointer to a Lambda version. Useful so that you never have to change an application to run a different Lambda version. Just point the application to an Alias. Then you can update the Alias to point to a different version as needed.

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

What is Lambda Alias routing?

A

You can create a percentage distribution of requests to different versions behind the Alias. So, 90% to Lambda v1, 10% to Lambda v2

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

What do I have to do to monitor Lambda with X-Ray?

A

Enable “Active Tracing” on the Lambda function

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

Describe a use case for Lambda Layers

A

Multiple slightly different Lambda functions, all using the same bulky libraries (e.g., numpy)

No point in zipping up 10 huge files to run this. Zip the small function files, and add the libraries to the /opt folder, where they can be used as if they were in the actual zip

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

If you need a particular library module in your Lambda code, where might it come from?

A

It could be in the default runtime environment (i.e., Python 3.8). If not, you could (a) include the libraries in your code and upload it to Lambda (“in the deployment zip”), or (b) put in in Lambda libraries

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