What is AWS Lambda
Key concept : Serverless
AWS Lambda is a compute service that enables you to run code without provisioning or managing servers. You pay only for the compute time you consume—there is no charge when your code is not running.
The code you run on AWS Lambda is uploaded as a “Lambda function”
The code must be written in a “stateless” style i.e. it should assume that there is no affinity to the underlying compute infrastructure
Anatomy of a Lambda function
How to package in Python, Java, C#
- Java Your deployment package can be a .zip file or a standalone jar; it is your choice. Use Maven or IDE plugins. Compiled class and resource files at root level, required jars in /lib directory.
The three ways to deploy an AWS Lambda function
The three Lambda execution models
How does the Push event model work
An event source directly invokes a Lambda function when it publishes an event
-> Sources : Amazon S3, Amazon SNS, Amazon Cognito, Amazon Echo, and user applications.
You do not use the AWS Lambda APIs to map your Lambda function to its event source. Instead, you use APIs from the event source to configure this mapping.
How does the Pull event model work
In the pull event model, AWS Lambda polls the event source and invokes your Lambda function when it detects an event.
-> Lambda is used for streaming event sources such as Amazon Kinesis and DynamoDB streams.
Lambda provides an API for you to create event source mappings that associate your Lambda function with a specific event source
How does the Direct invocation work
It causes AWS Lambda to run the function synchronously and returns the response immediately to the calling application letting you know whether the invocation happened.
It is available for custom applications.
Difference between Execution permissions and Invocation permissions
Execution permissions: The permissions that your Lambda function needs to access other AWS resources in your account. Execution roles determine what your function can do.
Invocation permissions: The permissions that the event source needs to communicate with your Lambda function. Invocation roles determine who can run your function
Difference between Push and Pull models for invocation permissions
How does versioning work
Versioning allows you to publish one or more versions of your Lambda function. Each time you publish a version, AWS Lambda copies the $LATEST version (code and configuration) to create a new version.
What is an alias
Aliases can be created for Lambda function. An alias is a Lambda resource and has its own unique ARN. An alias is like a pointer to a specific Lambda function version. It allows you to access the Lambda function without having to know the specific version the alias is pointing to.
What is a layer
A layer is a ZIP archive that contains libraries, a custom runtime, or other dependencies. With layers, you can use libraries in your function without needing to include them in your deployment package.
A function can use up to 5 layers at a time.
You can create layers, or use layers published by AWS and other AWS customers.
Function code best practices
Function configuration best practices
Other best practices (alarms/metrics/asynchronous invokes)