Section 13: AWS Serverless: Lambda Flashcards
What is serverless?
A new paradigm in which the developers donโt have to manage servers anymore
What do developers deploy when working in a serverless environment?
Just code (functions)
Does serverless mean that there are no servers?
No, it just means that you donโt have to manage/provision/see them
Are AWS SNS & SQS considered serverless services?
Yes!
Is AWS EB considered a serverless service?
No!
What AWS service helps with authentication and authorization?
Cognito
What serverless AWS service helps with real time big data analysis?
Kinesis
What is the pricing model of AWS Lambda?
You pay per request and compute time
What does the free tier of AWS Lambda include?
1,000,000 requests
400,000 GBs of compute time
What services allows easy monitoring of AWS Lambda functions?
CloudWatch
How much RAM do AWS Lambda have by default?
128 MB
How much RAM can AWS Lambda have at max?
3 GB
How can you improve the CPU and network capacity of your Lambda functions?
By increasing the RAM (CPU and network will improve as a side effect)
Can Lambda integrate with API Gateway?
Yes
Can Lambda integrate with AWS IoT?
Yes
Can Lambda integrate with most AWS services?
Yes
How can you create serverless cron jobs in AWS?
Setting a CloudWatch event to trigger a Lambda function
How much $ is 1,000,000 requests in AWS Lambda beyond the free tier?
0.20$
In what increments is function execution compute time billed?
In increments of 100ms
What does GBs mean?
GB-seconds
Length of time you can have functions running at 1 GB ram
You have 100 GBs
How many seconds do you have if your functions are running at 1 GB of ram?
100 seconds
You have 100 GBs
How many seconds do you have if your functions are running at 512 MB of ram?
200 seconds
You have 100 GBs
How many seconds do you have if your functions are running at 128 MB of ram?
800 seconds
What is the default timeout of Lambda functions?
3 seconds
What is the maximum timeout of Lambda functions?
15 minutes
How many seconds are in 15 minutes?
900 seconds
What must you make sure of when interacting with other AWS resources from your Lambda function in order for your function to run properly?
Make sure that the right IAM policies (permissions) are attached to the function service Role
Can you deploy your functions in a VPC? If so, what impact will it have on the function?
Yes, but it will increase the initialization time
Can you set environment variables for your Lambda functions?
Yes
How many functions can you have running at the same time within an AWS account?
Up to 1000 per region
What can you do if you need more than a 1000 functions to run at the same time?
Open ticket with the AWS support
How can you โreserveโ concurrency for a specefic function?
By setting the amount of โreserved concurrencyโ at the function level
What will each invocation over the concurrency limit trigger?
A โthrottleโ
What is throttle behaviour of a synchronous invocation?
Return a ThrottleError - 429
What is throttle behaviour of an asynchronous invocation?
Retry automatically and go to DLQ
How many times will a function asynchronous invocation be retried if it fails?
Two times
After a function asynchronous invocation fails twice, where do unprocessed events go?
To the specified DLQ
What is the payload of the event that goes to the DLQ from a failed Lambda function invocation?
Original payload
What can a Lambda function DLQ be?
SNS topic
SQS queue
What might be the reason if a Lambda function does not send failed invocations to a specified DLQ?
It does not have the right IAM permissions
How does CloudWatch help with monitoring and logging of AWS Lambda functions?
You get metrics in CloudWatch Metrics
You get log groups and streams in CloudWatch Logs
What might be the reason if a Lambda function does not send logs to CloudWatch?
It does not have the right IAM permissions
How to run the X-Ray daemon when you want to use X-Ray to trace your Lambda functions invocations?
Simply enable it in the Lambda configuration
What might be the reasons (plural) if a Lambda function does not send traces to X-Ray?
It does not have the right IAM permissions
You have forgotten to use the AWS X-Ray SDK in your code
In what increments can you set the memory (RAM) of a Lambda function?
Increments of 64 MB
What should you use if you need to temporarily store files while running a Lambda function?
The /tmp directory of the function container
What is the disk capacity of the local storage in /tmp
512 MB
What is the function deployment size limit (compressed zip)
50MB
What is size limit of the uncompressed function code?
250MB
Where should dependencies be when uploading a function to Lambda?
Zipped with the code
What is the size limit of environment variables?
4 KB
Where should you upload your functions code when deploying Lambda with CloudFormation?
In S3
How can you tell CloudFormation where is your code for your function?
Refer to the S3 zip file location
What is the Lambda /tmp space used for?
If your Lambda function needs to download a big file to work
If your Lambda function needs disk space to perform operations
What happens to the content in the /tmp directory after a function finishes executing?
It will remain as long as the execution context is frozen
What can you use for permanent persistence of objects used/created by AWS Lambda functions?
S3
What happens to the execution context of a Lambda function after it is executed?
It is maintained for some time in anticipation of another Lambda function invocation
When working on a Lambda function, what version are you editing?
$LATEST
When you want to use a Lambda in production, what should you do?
Publish a version and create an alias (ex: โPRODโ) which points to that version
When updating a Lambda function in production, what can you do to test the new function and make sure it runs smoothly?
Distribute a % of the Lambda executions to the new version
Can you modify a Lambda function version which has been published?
No, they are immutable
What are common alias which are a good idea to set in Lambda functions?
dev
test
prod
What do Lambda function aliases point to?
Specific versions, either
100% traffic => single version
Distributed traffic => different versions
Where should you perform heavy-duty work?
Connect to a DB, initialize AWS SDKs, pull in dependencies, etc.
Outside of your function handler
What is the function handler?
The handler is the method in your Lambda function that processes events
Should a Lambda function call itself?
No, you could get stuck in an infine loop and pay big $
What is Lambda@Edge?
Lambda functions which get executed in Edge locations
What are the two types requests/responses which Lambda@Edge allows you to modify?
ViewerRequest, OriginRequest,
OriginResponse, ViewerResponse
What are some use cases of Lambda@Edge?
Website Security and Privacy Dynamic Web Application at the Edge Search Engine Optimization (SEO) Intelligently Route Across Origins and Data Centers Bot Mitigation at the Edge Real-time Image Transformation A/B TestingUser Authentication and Authorization User Prioritization User Tracking and Analytics
In CloudWatch Lambda log groups, where are log streams coming from?
Lambda functions invocations
When changing/updating our lambda, what will be created in CloudWatch logs on the next execution?
A new log group for the new function version