Lambda Flashcards
What is AWS Lambda?
A service for runing code without provisioning a server
Services that invoke Lambda Functions Synchronously
"ELB Cognito Lex Alexa API Gateway CloudFront Kinesis Data Firehose Step Functions S3 Batch"
Services that invoke Lambda Functions Asynchronously
"S3 SNS SES CloudFormation CloudWatch Logs CloudWatch Events CodeCommit Config IoT IoT Events CodePipeline"
What may cause a Lambda to return an error message?
Max Memory Used
What may cause a Lambda to time out?
If a connection is unavailable due to access restrictions
What is the Dead-letter Queue feature?
“After a specified number of execution attempts have failed Lambda can forward the unprocessed payload to a DLQ such as an SQS or SNS for logging purposes
DLQs can trigger additonal Lambda functions”
What are the customers responsibilities when using Lambdas?
“Lambda function code
Providing access to AWS resources that trigger the Lambda function
Providing access to AWS resource destinations “
What is the Lambda memory limits per invocation?
memory allocation range min 128 MB/max 3008 MB (64 MB increments)
What is the Lambda timeout limits per invocation?
900 seconds (15 minutes)
What is the Lambda /tmp directory storage limit?
Ephemeral disk capacity (“/tmp” space) 512 MB
What are the Lambda incovation payload limits?
"invocation payloads include request and response 6 MB (synchronous) 256 KB (asynchronous)"
What triggers and destinations are available by default?
“None are available by default
The AWSLambdaBasicExecutionRole grants permission to write to CloudWatch Logs”
Max batch size Lambdas can recieve from resources?
“Streams and DynamoDB 10_000
SQS 10 “
How do you send a constant event from a CloudWatch trigger?
In the CloudWatch event rules configure the input using the option “constant (JSON text)”
What is Lambda Invoke API?
An API used to invoke lambda functions from custom applications
What CloudFront events can be used to trigger Lambda functions?
“CloudFront uses a CloudFront cache at edge locations to improve accessibility to other regions
Viewer request - from end user to cache
Origin request - from cache to server
Origin response - from server to cache
Viewer response - from cache to end user”
Do Lambda functions stay available while code is being configured?
Yes Lambdas remain in a consistant state from one version to another and function remains even while the code it being updated
What are the poll-based services that Lambda supports?
“*Poll-based services wait for an external device to check for rediness or state
Kinesis
DynamoDB
SQS”
What is the alias feature?
“It allows lambdas to have different reference names
alias’s allow functions to call lambdas without having to know the specific version the alias is pointing to
Use case creating a PROD and DEV alias”
In what case would a versioning number be reused?
“Never
even if a version is deleted new versions will have completely unique version numbers”
Valid syntax for ARNs representing Lambda functions
“Qualified ARN: the function ARN with the version suffix
arn: aws:lambda:aws-region:acct-id:function:helloworld:$LATEST arn: aws:lambda:aws-region:acct-id:function:helloworld:ALIAS
Unqualified ARN: the function ARN without the version suffix
arn:aws:lambda:aws-region:acct-id:function:helloworld”
How can you grant cross-account permissions to use Lambda functions?
“If an application and the lambda are in the same AWS account no explicit permission is needed
Otherwise the AWS account that owns the Lambda function must add permission on their lambda in its policy
IAM- Cross account role
““Statement””: { ““Effect””: ““Allow””, ““Action””: ““sts:AssumeRole””, ““Resource””: ““arn:aws:iam:ROLE_NAME:role/UpdateApp””
Lambda function policy cannot be edited from the AWS console only the AWS CLI or AWS SDK”
What is the maximum asynchronous invokation retries?
2
How do you pass encrypted environment variables to a Lambda function?
“Encrypt data in tansit to the lambda via KMS key
decrypt the data via the decryption helper in the console”
What actions are required by a Lambda execution role to write to logs?
“logs:CreateLogGroup
logs: CreateLogStream
logs: PutLogEvents”
What are the CloudWatch metrics able to trigger Lambda functions?
"Invocations Errors Dead letter error Duration Throttles IteratorAge ConcurrentExecutions UnreservedConcurrentExecutions"
What factors must be concidered when estimating cost?
“memory allocated to the Lambda function
total number of requests for the Lambda function”