AWS

Online Interview Questions

Lambda

AWS Lambda is a serverless compute service provided by Amazon Web Services (AWS) that allows you to run code without provisioning or managing servers. With AWS Lambda, you can upload your code, and it automatically handles everything required to run and scale your function to meet demand. This includes managing compute resources, scaling based on the request volume, and handling high availability.

  • Event-driven: AWS Lambda can be triggered by various AWS services such as S3, DynamoDB, SQS, and SNS, or even HTTP requests via API Gateway.
  • Pay-per-use: You pay only for the compute time your code consumes, in 100-millisecond increments. There is no charge when your code is not running.
  • Automatic Scaling: Lambda scales automatically by running code in response to incoming traffic, so there is no need to manage servers.
  • Supports Multiple Languages: Lambda supports a variety of programming languages, including Node.js, Python, Ruby, Java, Go, .NET Core, and custom runtimes (using Lambda's custom runtime feature).
  • Integrated with AWS Services: You can easily integrate Lambda with other AWS services such as DynamoDB, S3, Kinesis, and CloudWatch.
  • Copy

    Common Use Cases:
    • Data Processing: Automatically process files uploaded to S3 buckets, such as resizing images or transforming data.
    • API Backends: Use AWS Lambda in conjunction with API Gateway to build serverless RESTful APIs.
    • Real-time Stream Processing: Process real-time data from Kinesis streams or DynamoDB streams.
    • Automation Tasks: Use Lambda for tasks like backups, notifications, or maintenance operations.
    Example Flow:
    1. Trigger: A new file is uploaded to an S3 bucket.
    2. Lambda function: This triggers the Lambda function that processes the file.
    3. Output: The function processes the file (e.g., resizing an image) and stores the result in another S3 bucket or database.

    Copy