Lambda Flashcards
(36 cards)
What is the relationship between RAM , CPU, and Network power for a Lambda Function?
Increasing RAM will also improve CPU and Network capabilities
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
- 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:
What service allows you to configured a serverless CRON job to trigger a Lambda function?
CloudWatch Events EventBridge
Define a synchronous lambda invocation and how it relates to when the results are returned and where errors are handled
Synchronous means that the client waits for the response to return, and error handling must happen client side.
In order to invoke a lambda function via an ALB, what must the lambda function be registered to?
A Target Group
In order to invoke a Lambda via an ALB, what does the ALB do to the request?
It creates a JSON document that contains the headers, body, etc
Suppose you have duplicate query strings or http headers and you required the Lambda event to recieve both, what must you enable?
Enable Multi-Value headers in the ALB
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?
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)
When must Event Source Mapping be used with AWS Lambda?
When Lambda needs to “Poll” the event source, such as SQS, DynamoDB, Kinesis
If an error occurs in a batch of Kinesis/Dynambo DB events, what happens to the batch?
It is reprocessed until the function succeedes or the items in the batch expire
When using a FIFO queue, how much can lambda scale?
The number of active message groups
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 ____ ________ _____
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
What is the difference between the Event and the Context objects for Lambda?
Event - Provides information on what created the event etc
Context - Provides information on the executing lambda function
What is the alternative (recommended approach) for Lambda DLQ?
Lambda Destinations
What must be configured in order to use an event source mapping to invoke a Lamvda function (Poll)
An Execution role assigned to Lambda to read from the source
What must be configured for an AWS service like s3 to call a lambda function? (Push)
Resource-based policy on the Lambda
What must you do in order to enable Lambda Tracing with X-Ray
- Enable Active Tracing
- Use X-Ray SDK in code
- Give IAM executation role
- Configure environment variables (such as xray daemon IP address)
What is the use case for CloudFront Functions, and what are their characteristics in terms of startup time and requests/second?
Purely used to change Viewer requests and Viewer Responses. They have sub-ms startup times and can handle millions of requests/second.
What is the usecase of LambdaEdge functions, what what are their characteristics in terms of startup time and requests/second
Can modify Viewer Request, Origin Request, Origin Response, Viewer REsponse, and can scale to 1000s of requests/second.
Which serverless function type would you select for the following?
1. Cache Key Normalisation
2. Header Manipulation
3. URL Rewrites/Redirects
4. Request Auth
CloudFront Functions
Suppose you require longer execution times, 3rd party libraries, or network access to external services, what serverless function type should you select?
Lambda@Edge
What kind of network interface is required to be created in a private subnet in order to allow access from a Lambda Function?
An Elastic Network Interface
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?
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
What must you create inorder to privately access AWS services from Lambda without a NAT?
A VPC endpoint