4. 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!!)
5. Operations and management Scaling
Provisioning and utilization Availability and fault tolerance
Owning servers means dealing with ...
6. Key Differences Between Compute Offerings
VM Task Function
Service EC2 ECS Lambda
H/W OS Runtime
Unit of scale
Level of
abstraction
8. AWS Lambda: Run code in response to events
FUNCTION SERVICES (ANYTHING)
Changes in
data state
Requests to
endpoints
Changes in
resource state
Node
Python
Java
C#
EVENT SOURCE
9. Amazon S3 Amazon
DynamoDB
Amazon Kinesis
AWS
CloudFormation
AWS CloudTrail Amazon
CloudWatch
Amazon Cognito
Amazon SNSAmazon
SES
Cron events
DATA STORES ENDPOINTS
CONFIGURATION REPOSITORIES EVENT/MESSAGE SERVICES
Example event sources that trigger AWS Lambda
… and a few more with more on the way!
AWS
CodeCommit
Amazon
API Gateway
Amazon
Alexa
AWS IoT AWS Step
Functions
10. Using AWS Lambda
Bring your own code
• Node.js, Java, Python,
C#
• Bring your own libraries
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
Programming model
• Use processes, threads,
/tmp, sockets normally
• AWS SDK built in
(Python and Node.js)
11. Automatic Scaling
• Each event is a Lambda request
• Lambda scales to match the
event rate
• Don’t worry about over or under
provisioning
• Pay only for what you use
12. Common Use Cases
Web
Applications
• Static
websites
• Complex web
apps
• Packages for
Flask and
Express
Data
Processing
• Real time
• MapReduce
• Batch
Chatbots
• Powering
Chatbot logic
Backends
• Apps &
services
• Mobile
• IoT
</></>
Amazon
Alexa
• Powering
voice-enabled
apps
• Alexa Skills
Kit
IT
Automation
• Policy engines
• Extending
AWS services
• Infrastructure
management
19. Technologies We Used
• Node.js and JavaScript
• AWS Lambda
• Amazon Alexa service and Alexa Skills Kit
(https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs)
21. Code Snippet - weather.js
Publish this function for
fetching weather data
Invoke external WebService
Return weather info in TEXT
22. Code Snippet - lamdba.js
Include Alexa Skills Kit
Include weather.js module
Initial an Alexa handler
and register all handlers
Open Skill
Stop Skill
About weather
Recipe for pork
Say a joke
23. Code Snippet - lamdba.js – Cont.
Launch Skill function
Weather Intent function
Retrieve Slots (City Name)
Get weather information by
City Name
Speak out (emit)
weather information
24. Packing Node.js Function
#For MacOS
zip -r -q dist/lambda.zip ./ -x "FILE_OR_DIR_1" "FILE_OR_DIR_2"
AWS-SDK can be excluded!!
44. No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault
tolerance built in
Benefits of Lambda and Serverless Compute
45. AWS Lambda Pricing
• Charged by
• Request count
($0.2 per 1m requests)
• Compute
($0.00001667 per GB*second)
• Buy compute time in
100 ms increments
• No minimums fees
• No per-device fees
Free Tier
1 million requests and 400,000
GB*second of compute every month,
every customer
Example
• 256MB of memory
• Executed 3 million times per month
• It ran for 1 second each time
Around $6.2 per month!
https://s3.amazonaws.com/lambda-tools/pricing-calculator.html
46. Takeaways
• Serverless doesn’t actually mean that we have no
servers. It means that you don’t need to deal with them
anymore and focus on your business logic
• Many use cases can go Serverless computing
• Web, data processing, interactive backends, Chatbots, Alexa,
auto managing AWS resources
• Bots development on AWS is easy and agile
• Serverless ecosystem continues to grow
• Tooling, languages, and application capabilities
48. Next steps
1. Go to console.aws.amazon.com/lambda and create your first
Lambda function
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. See https://aws.amazon.com/serverless for reference
architectures, samples, and links to more content.
4. Send us your questions, comments, and feedback on the AWS
Lambda Forums.