AWS Lambda Flashcards
FaaS stands for
Function as a Service
FaaS is also known as
Serverless computing
Serverless computing is an option for deploying applications on __________
cloud
With serverless compute you install a piece of ___________ on cloud platform
Function
How does AWS executes a function
he cloud platform makes the function available on-demand and manages resource allocation for you.
Design constraints/ design issues with Lambda. When to not use AWS Lambda
- Functions will timeout after 15 minutes.
- The amount of RAM available ranges from 128MB to 3008MB with a 64MB increment between each option.
- The Lambda code should not exceed 250mb in size, and the zipped version should be no larger than 50mb
- For few applications, with huge data size, AWS EC2 may be cheaper
How does AWS charge you for Lambda
AWS charges you for the number of requests your Lambda functions recieve and the time it takes to execute those requests per 100ms.
ETL with Lambda
Extract, Transform, Load (ETL) processes - retrieving data, processing it, and storing the results in a database works well as a function that can be triggered remotely or set up on a schedule.
What are the components of serverless applications?
- Event sources
- Functions
- In some cases services
What are event sources in AWS lambda
An event source is an AWS service or developer-created application that produces events that trigger an AWS Lambda function to run.
Event sources can be _______ and _________ sources
push and pull
What are push event sources
Services publish/push events to Lambda by invoking the cloud function directly.
What are pull event sources ?
For resources that do not publish directly to Lambda, Lambda pulls/polls resources
________________ enables automatic invocation of the Lambda function when events occur.
Event source mapping
What is the function of event source mapping?
Event source mapping identifies the type of events to publish and the Lambda function to invoke when events occur
Push event sources are also referred to as ?
Regular AWS Services.
Push event sources includes
SE, SNS, SES
For push event sources, the event source mapping is maintained on ________
the invoker/S3/SNS
Pull event sources are also referred to as ?
Stream-based event services.
Pull event sources includes
Kinesis, DynamoDB
Event source mapping is maintained on __________side
Lambda’s side.
Can Lambda be used as an event source
Yes. For S3, Lambda,
What happens when a designated event occurs on Lambda’s end ?
When the designated event occurs, the Lambda function runs it own container.
How are resources allocated when a Lambda function launches it’s container?
The resources allocated to the container and the number of containers launched is based on the size of the data and computational requirements of the function, all handled by AWS.
What are the types of Lambda invocation?
- Synchronous invocation
1. Asynchronous invocation
What is synchronous invocation?
When you invoke a function synchronously, Lambda runs the function and waits for a response. When the function completes, Lambda returns the response from the function’s code with additional data, such as the version of the function that was invoked.
What is asynchronous invocation?
When you invoke a function asynchronously, you don’t wait for a response from the function code. You hand off the event to Lambda and Lambda handles the rest.
S3, cloudwatch and SNS invokes functions _______ Sync/Aync)
Asynchronously
What are the parts of Lambda function.
- Handler function
- Event Object
- Context Object
- Callback function (Synchronous invocations)
What is a handler function in Lambda function
When your function is invoked, Lambda runs the handler method and it processes the events
Handler function python syntax
def handler_name(event, context): ... return some_value
What is Event object in Lambda function
An event is a JSON-formatted document that contains data for a Lambda function to process. The Lambda runtime converts the event to an object and passes it to your function code.
What is the default type of Event object ?
Event object is usually of the Python dict type. It can also be list, str, int, float, or the NoneType type.
What is context object in Lambda ?
A context object is passed to your function by Lambda at runtime. This object provides methods and properties that provide information about the invocation, function, and runtime environment.
What is callback function in AWS Lambda function ?
The callback function takes two arguments: an Error and a response. When you call it, Lambda waits for the event loop to be empty and then returns the response or error to the invoke
List Lambda functions in AWS CLI
aws lambda list-functions
What is AWS SAM
AWS Serverless Application Model
Each user can create upto _____ test events per function
10
What is a trigger
A trigger is a resource or configuration that invokes a function
What is an event
Event is a JSON formatted document that contains the data for the Lambda function to process.
How is an event passed to function?
The runtime converts the event to an objects and passes to a function.
What is execution environment ?
Execution environment is an secure and isolated environment for you Lambda function.
What are the responsibilities of execution environment?
Execution environment manages the processes and resources that are required to run a function. Also the execution environment provides any life-cycle support for the function and for any extensions associated with the function.
How do you deploy a function?
You deploy a function using Deployment package.
What are the types of deployment packages?
- .zip file archive
2. Container image
What is the .zip file archive deployment package ?
.zip file archive contains the code and dependencies. Lambda provides the OS and runtime environment to execute the code.
What is the container image deployment package ?
With the container image deployment package, you add the function code, dependencies, OS and Lambda runtime to the image.