Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Level 200 (Introductory)
Puneet Agarwal, AWS Ent...
AWS compute offerings
VM Task Function
Service EC2 ECS Lambda
H/W OS Runtime
Unit of scale
Level of
abstraction
AWS compute offerings
I want to
configure
machines,
storage,
networking,
and my OS
I want to run
servers,
configure
applic...
Agenda
• Why AWS Lambda
• How it works
• Use cases
• Sample architecture
• Best practices
Why AWS Lambda
Servers
How will the application
handle server hardware failure?
How can I control
access from my servers?
When should I d...
Operations and management Scaling
Provisioning and utilization Availability and fault tolerance
Owning servers means deali...
Serverless compute: AWS Lambda
COMPUTE
SERVICE
EVENT-
DRIVEN
Run arbitrary
code without
managing
servers
Code only runs
wh...
AWS Lambda: Run code in response to events
Lambda functions: Stateless, trigger-based code execution
Triggered by events:
...
Cost-effective and
efficient
No infrastructure
to manage
Pay only for what you use
Bring your
own code
Productivity-focuse...
How it works
Using AWS Lambda
Bring your own code
• Node.js, Java, Python
• Bring your own libraries
(even native ones)
Simple resource...
Using AWS Lambda
Authoring functions
• WYSIWYG editor or
upload packaged .zip
• Third-party plugins
(Eclipse, Visual Studi...
Application components for serverless apps
EVENT SOURCE FUNCTION SERVICES (ANYTHING)
Changes in
data state
Requests to
end...
Amazon
S3
Amazon
DynamoDB
Amazon
Kinesis
AWS
CloudFormation
AWS
CloudTrail
Amazon
CloudWatch
Amazon
SNS
Amazon
SES
Amazon
...
Use cases
Analytics
• Operational management
• Live dashboards
Data workflows
• Content management
• ETL workflows
Multiple applicat...
Everybody knows this 3-tier web app diagram
https://d0.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Architectures.p...
Here is what that translates to in real life
http://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_web_01.pdf
Updated real-world “serverless” architecture
https://s3.amazonaws.com/awslambda-reference-architectures/web-app/lambda-ref...
Example: Real-time file processing
https://github.com/awslabs/lambda-refarch-fileprocessing
Example: Stream processing
https://github.com/awslabs/lambda-refarch-streamprocessing
What to expect from the session
15-20 minutes of processing  now in seconds
2x order of magnitude for cost savings
https:...
Serverless IoT with AWS Lambda @ iRobot
AWS
Lambda
Amazon
CloudFront
Amazon
S3
Amazon
DynamoDB
Amazon
Redshift
Amazon
Route 53 Amazon VPC
Amazon
CloudWatch
AWS
Cl...
Serverless → distributed by nature
Component graph
becomes call graph
Distributed systems
thinking is required from
the st...
API Gateway
App requests
over HTTPS
CRUD
operations
IoT
MQTT
CRUD
operations
IoT
MQTT
MQTT
Presigned
URL
Staging
bucket
SQS/CloudWatch Events
CloudWatch event
every 5 minutes
Lambda runs
for 5 minutesSQS queue
Best practices
AWS Lambda best practices
 Limit your function/code size
 Node – remember execution is asynchronous
 500 MB /tmp direct...
Best practice: Use versions and aliases
Versions = immutable copies of code + properties
Aliases = mutable pointers to ver...
The function networking environment
 Default - a default network environment within VPC is provided for you
 Access to t...
Additional best practices
 Externalize authorization to IAM roles whenever possible
 Least privilege and separate IAM ro...
Takeaways
• Many applications can go serverless
• Data processing, back ends, triggers, web hooks
• Lambda functions are o...
Next steps
1. Go to console.aws.amazon.com/lambda and create your first
Lambda function. (The first 1M requests are on us!...
Remember to complete
your evaluations!
Upcoming SlideShare
Loading in …5
×

Getting Started with AWS Lambda and the Serverless Cloud

2,492 views

Published on

How to use Lambda to build web, mobile, or IoT backends and voice-enabled apps, and we'll show you how to extend both AWS and third party services by triggering Lambda functions.

Published in: Technology
  • Be the first to comment

Getting Started with AWS Lambda and the Serverless Cloud

  1. 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Level 200 (Introductory) Puneet Agarwal, AWS Enterprise Solutions Architect September 22, 2016 Getting Started with AWS Lambda and the Serverless Cloud
  2. 2. AWS compute offerings VM Task Function Service EC2 ECS Lambda H/W OS Runtime Unit of scale Level of abstraction
  3. 3. AWS compute offerings I want to configure machines, storage, networking, and my OS I want to run servers, configure applications, and control scaling Run my code when it’s needed Service EC2 ECS Lambda How do I choose?
  4. 4. Agenda • Why AWS Lambda • How it works • Use cases • Sample architecture • Best practices
  5. 5. Why AWS Lambda
  6. 6. Servers How will the application handle server hardware failure? How can I control access from my servers? When should I decide to scale out my servers? When should I decide to scale up my servers? What size servers are right for my budget? How much remaining capacity do my servers have? (AAHHHHHHHHH!!)
  7. 7. Operations and management Scaling Provisioning and utilization Availability and fault tolerance Owning servers means dealing with ...
  8. 8. Serverless compute: AWS Lambda COMPUTE SERVICE EVENT- DRIVEN Run arbitrary code without managing servers Code only runs when it needs to run
  9. 9. AWS Lambda: Run code in response to events Lambda functions: Stateless, trigger-based code execution Triggered by events: • Direct sync and async API calls • AWS service integrations • Third-party triggers • Many more … Makes it easy to: • Perform data-driven auditing, analysis, and notification • Build back-end services that perform at scale
  10. 10. Cost-effective and efficient No infrastructure to manage Pay only for what you use Bring your own code Productivity-focused compute platform to build powerful, dynamic, modular applications in the cloud Run code in standard languages Focus on business logic Benefits of AWS Lambda 1 2 3
  11. 11. How it works
  12. 12. Using AWS Lambda Bring your own code • Node.js, Java, Python • Bring your own libraries (even native ones) Simple resource model • Select power rating from 128 MB to 1.5 GB • CPU and network allocated proportionately Flexible use • Synchronous or asynchronous • Integrated with other AWS services Flexible authorization • Securely grant access to resources and VPCs • Fine-grained control for invoking your functions
  13. 13. Using AWS Lambda Authoring functions • WYSIWYG editor or upload packaged .zip • Third-party plugins (Eclipse, Visual Studio) Monitoring and logging • Metrics for requests, errors, and throttles • Built-in logs to Amazon CloudWatch Logs Programming model • Use processes, threads, /tmp, sockets normally • AWS SDK built in (Python and Node.js) Stateless • Persist data using external storage • No affinity or access to underlying infrastructure
  14. 14. Application components for serverless apps EVENT SOURCE FUNCTION SERVICES (ANYTHING) Changes in data state Requests to endpoints Changes in resource state Node Python Java … more coming soon
  15. 15. Amazon S3 Amazon DynamoDB Amazon Kinesis AWS CloudFormation AWS CloudTrail Amazon CloudWatch Amazon SNS Amazon SES Amazon API Gateway Amazon Cognito AWS IoT Amazon Alexa Cron events DATA STORES ENDPOINTS REPOSITORIES EVENT/MESSAGE SERVICES Event sources that integrate with AWS Lambda … and the list will continue to grow!
  16. 16. Use cases
  17. 17. Analytics • Operational management • Live dashboards Data workflows • Content management • ETL workflows Multiple application types Interactive back ends • Bots • Webhooks Autonomous IT • Policy engines • Infrastructure management
  18. 18. Everybody knows this 3-tier web app diagram https://d0.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Architectures.pdf
  19. 19. Here is what that translates to in real life http://media.amazonwebservices.com/architecturecenter/AWS_ac_ra_web_01.pdf
  20. 20. Updated real-world “serverless” architecture https://s3.amazonaws.com/awslambda-reference-architectures/web-app/lambda-refarch-webapp.pdf
  21. 21. Example: Real-time file processing https://github.com/awslabs/lambda-refarch-fileprocessing
  22. 22. Example: Stream processing https://github.com/awslabs/lambda-refarch-streamprocessing
  23. 23. What to expect from the session 15-20 minutes of processing  now in seconds 2x order of magnitude for cost savings https://www.youtube.com/watch?v=TXmkj2a0fRE Nordstrom Recommendations
  24. 24. Serverless IoT with AWS Lambda @ iRobot
  25. 25. AWS Lambda Amazon CloudFront Amazon S3 Amazon DynamoDB Amazon Redshift Amazon Route 53 Amazon VPC Amazon CloudWatch AWS CloudFormation AWS CloudTrail AWS Config AWS IAMAWS KMSAWS WAF Amazon Cognito Amazon SNS Amazon API Gateway Amazon SQS Amazon Elasticsearch Service Amazon Kinesis Amazon QuickSight AWS IoT How iRobot leverages AWS
  26. 26. Serverless → distributed by nature Component graph becomes call graph Distributed systems thinking is required from the start Event-based architecture
  27. 27. API Gateway App requests over HTTPS CRUD operations
  28. 28. IoT MQTT CRUD operations
  29. 29. IoT MQTT MQTT Presigned URL Staging bucket
  30. 30. SQS/CloudWatch Events CloudWatch event every 5 minutes Lambda runs for 5 minutesSQS queue
  31. 31. Best practices
  32. 32. AWS Lambda best practices  Limit your function/code size  Node – remember execution is asynchronous  500 MB /tmp directory provided to each function  Don’t assume function will reuse underlying infrastructure  But take advantage of it when it does occur  You own the logs  Include details from service-provided context  Create custom metrics  Operations-centric vs. business-centric
  33. 33. Best practice: Use versions and aliases Versions = immutable copies of code + properties Aliases = mutable pointers to versions  Rollbacks  Staged promotions  “Lock” behavior for client
  34. 34. The function networking environment  Default - a default network environment within VPC is provided for you  Access to the Internet always permitted to your function  No access to VPC-deployed assets  Customer VPC - Your function executes within the context of your own VPC  Privately communicate with other resources within your VPC  Familiar configuration and behavior with:  Subnets  Elastic network interfaces (ENIs)  EC2 security groups  VPC route tables  NAT gateway
  35. 35. Additional best practices  Externalize authorization to IAM roles whenever possible  Least privilege and separate IAM roles  Externalize configuration  DynamoDB is great for this  Make sure your downstream setup “keeps up” with Lambda scaling  Limit concurrency when talking to relational databases  Be aware of service throttling  Engage AWS Support to increase your limits  Contact AWS Support before known large scaling events
  36. 36. Takeaways • Many applications can go serverless • Data processing, back ends, triggers, web hooks • Lambda functions are opinionated • State, invocation modes, and deployments • The ecosystem continues to grow • Tooling, languages, and application capabilities
  37. 37. Next steps 1. Go to console.aws.amazon.com/lambda and create your first Lambda function. (The first 1M requests are on us!) 2. Stay up to date with AWS Lambda on the Compute blog and check out aws.amazon.com/lambda for scenarios and customer stories. 3. Send us your questions, comments, and feedback on the AWS Lambda Forums. Bonus points: Enter the AWS Serverless Chatbot Competition https://aws.amazon.com/blogs/aws/enter-the-aws-serverless-chatbot- competition/
  38. 38. Remember to complete your evaluations!

×