Lambda Flashcards
AWS Lambda
serverless and event-driven compute service.
Lambda function
source code along with all dependencies. memory: 128-1536MB. run between 1 to 300 seconds. default configured timeout for a lambda function is 3 seconds.
Parameters
Maximum execution time – UP TO 5 MINUTES;
IAM ROLE:
Handler name: the method name to be used by Lambda.
Lambda function invocation types
synchronous and asynchronous. can be only specified at the time of manually executing a lambda function.
Lambda function over VPC
by default, Lambda function code is deployed in a private VPC. AWS Lambda does not support connecting to resources within dedicated tenancy VPCs.
Stream-based services
Amazon Kinesis Streams and Amazon DynamoDB
Best Practice
write a lambda function in a stateless style.
Persistent sate should be stored in another cloud service, such as Amazon S3 or DynamoDB.
separate core logic from Lambda handler.
when deploying, avoid DNS resolution for a public hostname. specify at least one subnet in each AZ with lambda function configuration.
make sure sufficient subnet IPs are free to allow lambda functions to scale.
using static initialization or constructor to help improve the performance.
when possible, keep alive and reuse connections such as database or HTTP that were established in an earlier invocation.
use environment variables; …