Lambda Flashcards

(36 cards)

1
Q

What is the relationship between RAM , CPU, and Network power for a Lambda Function?

A

Increasing RAM will also improve CPU and Network capabilities

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

Outline the very basic integrations with Lambda for each of the following services:
- API Gateway
- Kinesis
- Dynamo DB
- S3
- CloudFront
- Cloud Watch Event Bridge
- Cloud Watch Logs
- SNS
- SQS
- Cognito

A
  • API Gateway: Create REST API to call Lambda
  • Kinesis: Data transformations via Lambda
  • Dynamo DB: Trigger lambda based on db event
  • S3: Trigger lambda based on event
  • Cloud Watch Event Bridge:
  • Cloud Watch Logs
  • SNS: React to notifications
  • SQS: Process message from queue
  • Cognito:
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What service allows you to configured a serverless CRON job to trigger a Lambda function?

A

CloudWatch Events EventBridge

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

Define a synchronous lambda invocation and how it relates to when the results are returned and where errors are handled

A

Synchronous means that the client waits for the response to return, and error handling must happen client side.

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

In order to invoke a lambda function via an ALB, what must the lambda function be registered to?

A

A Target Group

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

In order to invoke a Lambda via an ALB, what does the ALB do to the request?

A

It creates a JSON document that contains the headers, body, etc

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

Suppose you have duplicate query strings or http headers and you required the Lambda event to recieve both, what must you enable?

A

Enable Multi-Value headers in the ALB

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

When using Asynchronous Invocations with Lambda, events are placed in an event queue and automatically retried 3 times. What is an important consideration regarding these retries and if all 3 retries fail, what can be configured?

A

Since there are retries, processing should be idempotent. If all attempts to retry fail, a DLQ can be configured in SNS or SQS (Ensure correct IAM permissions)

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

When must Event Source Mapping be used with AWS Lambda?

A

When Lambda needs to “Poll” the event source, such as SQS, DynamoDB, Kinesis

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

If an error occurs in a batch of Kinesis/Dynambo DB events, what happens to the batch?

A

It is reprocessed until the function succeedes or the items in the batch expire

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

When using a FIFO queue, how much can lambda scale?

A

The number of active message groups

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

Fill in the Blanks:

Kinesis Data Streams & Dynamo DB Streams:
- _ Lambda invocation per stream shard
- When using parallelization, up to _ batches processed per shard simultaneously

SQS Standard
- Lambda adds _ more instances per minute

SQS FIFO
- Messages with the same group ID will be processed __ _____
- Lambda function scales to the number of ____ ________ _____

A

Kinesis Data Streams & Dynamo DB Streams:
- One Lambda invocation per stream shard
- When using parallelization, up to 10 batches processed per shard simultaneously

SQS Standard
- Lambda adds 60 more instances per minute

SQS FIFO
- Messages with the same group ID will be processed in order
- Lambda function scales to the number of active message groups

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

What is the difference between the Event and the Context objects for Lambda?

A

Event - Provides information on what created the event etc
Context - Provides information on the executing lambda function

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

What is the alternative (recommended approach) for Lambda DLQ?

A

Lambda Destinations

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

What must be configured in order to use an event source mapping to invoke a Lamvda function (Poll)

A

An Execution role assigned to Lambda to read from the source

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

What must be configured for an AWS service like s3 to call a lambda function? (Push)

A

Resource-based policy on the Lambda

17
Q

What must you do in order to enable Lambda Tracing with X-Ray

A
  1. Enable Active Tracing
  2. Use X-Ray SDK in code
  3. Give IAM executation role
  4. Configure environment variables (such as xray daemon IP address)
18
Q

What is the use case for CloudFront Functions, and what are their characteristics in terms of startup time and requests/second?

A

Purely used to change Viewer requests and Viewer Responses. They have sub-ms startup times and can handle millions of requests/second.

19
Q

What is the usecase of LambdaEdge functions, what what are their characteristics in terms of startup time and requests/second

A

Can modify Viewer Request, Origin Request, Origin Response, Viewer REsponse, and can scale to 1000s of requests/second.

20
Q

Which serverless function type would you select for the following?
1. Cache Key Normalisation
2. Header Manipulation
3. URL Rewrites/Redirects
4. Request Auth

A

CloudFront Functions

21
Q

Suppose you require longer execution times, 3rd party libraries, or network access to external services, what serverless function type should you select?

22
Q

What kind of network interface is required to be created in a private subnet in order to allow access from a Lambda Function?

A

An Elastic Network Interface

23
Q

Suppose you deploy a lambda function into a public subnet and attempt to access the public internet however you dont get internet access, what is wrong?

A

Deploying a lambda function into a public subnet doesnt give it internet access or a public IP. You must create a NAT in the public subnet

23
Q

What must you create inorder to privately access AWS services from Lambda without a NAT?

A

A VPC endpoint

24
What is the default and maximum timeout for a Lambda function?
Default: 3 seconds Maximum: 900 seconds (15 minutes)
25
Suppose you need to connect to a database from within a lambda function, where should you define the db client?
In the top level of the Lambda function, such that the context can be shared between subsequent lambda invokations.
26
What are the two usecases of Lambda Layers?
1. Using custom runtimes 2. Externalising dependencies to re-use them
27
What storage service can be used alongside lambda and what must be created in order to connect?
Use EFS alongside an EFS access point
28
Suppose a reserved concurrency has been set to 50 for a lambda function but then another invocation occurs, how will sync and async requests behave differently
Synchronous - Returns throttle error 429 Asynchronous - Retry automatically then to DLQ
29
What is the application package size limit for lambda? If the package exceeds this size, what is the alternative?
50mb, otherwise upload to s3 first
30
What are the two ways you can define a Lambda functon via Cloud Formation?
1. Inline - Used for very simple small functions 2. S3 - Define a path to the package. Must update Object Version in CloudFormation if package is updated
31
Given that Lambda versions are immutable, what can you use to point to specific versions in a mutable way?
Aliases like dev, test, and prod. Note: Aliases cant reference Aliases
32
What are the 4 required headers for Lambda in CodeDeploy templates?
Name - The name of the lambda function to deploy Alias - Which Alias to point to Current Version - The version of the lambda function the traffic currently points to Target Version: The version the traffic should be shifted to
33
What are the following limits relating the Lambda Execution? 1. Memory Allocation 2. Maximum execution time 3. Environment variables 4. Disk capaicty 5. Concurrency executions
1. Memory Allocation: 128mb - 10gb 2. Maximum execution time: 900 seconds (15 mins) 3. Environment variables: 4kb 4. Disk capacity: 512mb to 10gb 5. Concurrency executions: 1000
34
True or False: Perform heavy-duty work outside of function handler
True
35
True or False: Recursive Lambda functions are a good idea
False