Lamdba (Compute) Flashcards
What does Lambda do?
You upload some code and it runs it for you
When do you pay for Lambda?
You only pay for Lambda when code runs
What is key difference between Elastic Beanstalk and Lambda
Elastic Beanstalk is going to create and manage infrastructure for you and is going to use EC2 instances. Meant to do a full task or job.
Lambda you have no access to underlying hardware so it’s known as serverless. Does a single function well
Cloud Formation vs Elastic Beanstalk
Cloud Formation you still need to do deployments you would need to set up to deploy it. Cloud Formation is like blue print.
You can deploy it in Elastic Beanstalk. It uses Cloud Formation under the hood
What can Lambda help with?
Building an event driven architecture
Do the Autoscaling Group and Load Balancer work together
Yes
What is the serverless application model (SAM)
SAM is a way that you can define your infrastructure that is serverless ie., lambda and code
So it updates maintains etc
Java code and it’s dependencies are deployed in a lambda function, but it fails because the package size is too big
What should you do that wouldn’t need major QA testing
Create a Lambda layer for the dependencies
Popular serverless app that predicts stock prices has runtime of 100s and 60 requests per second
Its performance decrease during trading times
What solution could overcome performance issue
Initiate a Service Limit Increase Request
How can a start up switch between new versions of lambda function and rollback easily?
- Create alias with current version
- Point app to the alias created for Lambda function
- When you want to refresh app with next version, update alias
What causes a Lambda job to land in a DLQ?
- Function times out when processing
- The function fails to retrieve inputs from the event
A developer is using all at once deployment policy which causes all services to be out temporarily
What could they use instead
Rolling with an additional batch
If you are using Lambda for mobile app deployment. How would you do different font themes based on if its android or ios?
Use the “context” object in mobile SDK because it gives the lambda function automatic access to device and app info
How would you update SAM template used to deploy a lambda function to instantly switch traffic once it has been built and tested?
AutoPublishAlias: live
https://docs.aws.amazon.com/codedeploy/latest/userguide/tutorial-lambda-sam-template.html
If your output lambda is in a different format by mistake what error code will you get?
502