Lambda Flashcards
(30 cards)
What is AWS Lambda?
AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers. You only pay for the compute time you consume.
How does AWS Lambda work?
Lambda runs your code in response to events such as HTTP requests, file uploads to S3, or messages from SNS/SQS. You upload the code, set a trigger, and AWS handles execution.
What are the key features of AWS Lambda?
Serverless architecture, automatic scaling, pay-per-use pricing, integrated monitoring, and event-driven triggers.
What are Lambda triggers?
Triggers are services or events that cause a Lambda function to execute. Examples include S3, DynamoDB, SNS, API Gateway, and CloudWatch.
What languages does AWS Lambda support?
As of now, Lambda supports Python, JavaScript (Node.js), Java, C#, Go, Ruby, and PowerShell.
What are the use cases of AWS Lambda?
Use cases include serverless APIs, real-time file processing, IoT backends, chatbots, cron jobs, and ETL pipelines.
How do you monitor AWS Lambda?
Monitoring is done using Amazon CloudWatch logs and metrics, AWS X-Ray for tracing, and Lambda Insights for detailed performance data.
What is the max execution timeout for AWS Lambda?
The maximum timeout for a Lambda function is 15 minutes (900 seconds).
What is the default memory allocated to a Lambda function?
Default is 128MB, but it can be increased up to 10,240MB in 1MB increments.
How is concurrency handled in Lambda?
Lambda scales automatically with incoming requests, and concurrency limits define how many functions can run simultaneously.
What are cold starts in Lambda?
A cold start happens when AWS spins up a new container to handle a request. This can cause latency. It usually occurs when the function hasn’t been used recently.
How can you reduce Lambda cold starts?
Use provisioned concurrency, optimize function code, reduce package size, and keep functions warm using scheduled events.
What are environment variables in Lambda?
Environment variables store configuration settings and secrets, which can be accessed during function execution.
What are Lambda Layers?
Layers are a way to package libraries, dependencies, and custom runtimes separately from the main Lambda function code.
What is the Lambda execution role?
It’s an IAM role that grants Lambda permission to access other AWS services.
How can Lambda access a VPC?
You configure Lambda to connect to a VPC by setting up security groups and subnet IDs in its network settings.
What is Provisioned Concurrency?
It keeps a Lambda function initialized and ready to respond instantly to requests, reducing cold starts.
What is the difference between Lambda@Edge and regular Lambda?
Lambda@Edge runs functions closer to users by executing them at AWS Edge locations, ideal for CDN and low-latency scenarios.
What are Lambda destinations?
Destinations define what happens after function execution, allowing routing of success or failure events to services like SNS, SQS, or Lambda.
How do you deploy Lambda functions?
Functions can be deployed via the AWS Management Console, CLI, SDKs, Serverless Framework, SAM (Serverless Application Model), or Terraform.
How is error handling done in Lambda?
Use retries, DLQs (dead letter queues), error logging via CloudWatch, and try/catch in code. Destinations can also help manage errors.
What is the maximum package size for a Lambda deployment?
The zipped deployment package size can be up to 50MB (direct upload) or 250MB (via S3). Unzipped, it can go up to 250MB.
What is the difference between synchronous and asynchronous invocation in Lambda?
Synchronous waits for the function to complete (e.g., API Gateway), while asynchronous queues the event and returns immediately (e.g., S3, SNS).
What is AWS SAM?
AWS Serverless Application Model (SAM) is a framework for building serverless applications with simplified syntax for Lambda, API Gateway, etc.