Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AWS Lambda - Compute without infrastructure - a...

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →

AWS Lambda - Compute without infrastructure - a very brief overview

Presented at the AWSNE meetup on 5th May 2015 - a brief overview of the benefits of AWS Lambda.

http://www.meetup.com/Amazon-Web-Services-North-East/

Avatar for Mike Shutlar

Mike Shutlar

May 05, 2015

More Decks by Mike Shutlar

Other Decks in Technology

Transcript

  1. AWS Lambda Compute without infrastructure - a very brief overview

    Mike Shutlar – AWS Solutions Architect & Developer
  2. What is Lambda? A compute service that acts on events

    or requests (push/pull) › “Connective tissue for AWS services” › Scaling is automatic to event rate › Only pay for what is used – don’t pay for idle › Billed in 100ms increments (against allocated memory)
  3. Most importantly There is no infrastructure… › to provision (to

    handle capacity/scaling) › to setup › to manage (monitor, patch, log, etc) › to pay for 24/7 when in use or not
  4. Other services can use Lambda… Other services can use Lambda

    via supported services: › CloudTrail -> S3 -> Lambda › SES -> SNS -> Lambda (e.g. bounced emails) › CloudWatch -> SNS -> Lambda › ECS -> CloudWatch -> SNS -> Lambda › Applications can also generate events
  5. Lambda functions Somewhat confusingly named › JavaScript/Node.js › Stateless (if

    state needed, use S3/DynamoDB) › Request-driven – triggered by events (e.g. S3 PUT) › Sub 100ms latency to execute
  6. BYOC Bring Your Own Code › Include libraries with function

    (including native) › Create threads/processes › Run primitive Linux utilities › Write to /tmp
  7. Things of note Good things to keep in mind: ›

    Can’t run a webserver › Can offload process-intensive tasks – provision less › Doubling memory allocated doubles CPU share › Generous permanent free tier
  8. Containers Lambda functions run in an Amazon Linux container ›

    Container may be re-used (no control though) › Can take advantage of (possible) re-use › e.g. caching in /tmp › Running processes are frozen, then thawed if re-used
  9. Reducing costs Recently re-wrote a thumbnailing service to use Lambda

    › Eliminated the need for an EC2 instance › Reduced the annual cost from ~$750 to ~$2 › 99.73% cost reduction › No longer have to spend time maintaining infrastructure
  10. Recursion e.g. Lambda function PUTting into an S3 bucket that

    generates PUT events that Lambda function acts upon › To avoid, use separate input & output buckets/tables/etc › Or use flags to indicate already processed, e.g. S3 custom metadata › This will still involve twice the Lambda invocations
  11. Coming soon… Lambda features in the works: › Java ›

    Python › Access to resources within VPCs › Ability to access EFS
  12. More information Useful links: › AWS Lambda Documentation › AWS

    Lambda FAQs › AWS Compute Blog › AWS Lambda: Event-driven Code in the Cloud