際際滷

際際滷Share a Scribd company logo
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Ioannis Polyzos, Senior Solutions Architect
01/07/2022
Getting started building
your first serverless web application on
AWS
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Agenda
 Evolution of computing
 What is serverless ?
 AWS Lambda
 Use Cases
 API Gateway
 Frameworks
 Thank you
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
There is no server better than
no server
 Werner Vogels, CTO Amazon
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Evolution of computing
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lets take a look at the evolution of computing
Physical Servers
in Datacenters
Virtual Servers
in Datacenters
a
Virtual Servers
in the Cloud
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Each progressive step was better
Physical Servers
in Datacenters
a
Virtual Servers
in the Cloud
 Higher utilization
 Faster provisioning speed
 Improved uptime
 Disaster recovery
 Hardware independence
Virtual Servers
in Datacenters
 Trade CAPEX for OPEX
 More scale
 Elastic resources
 Faster speed and agility
 Reduced maintenance
 Better availability and
fault tolerance
 Better Automation
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
What is serverless ?
No servers to provision
or manage
Scales with usage
Never pay for idle Availability and fault
tolerance build int
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Serverless means :
Greater agility
Less Overhead
Better focus
Increased Scale
More flexibility
Faster time to market
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Lambda
Zero administration
Focus on business logic, not infrastructure.
Just upload your code, and AWS Lambda
handles the rest.
Autoscaling
AWS Lambda scales the infrastructure as needed
to match the event rate and pay as you go at
100ms intervals.
Bring your own code
Code in Node.JS, Java, Python or C#.
Create threads and processes, run batch scripts or
other .exe files.
Sync and Async events
Respond to application calls with low-latency
real-time functions.
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
AWS Lambda
Event-driven compute
Function as a Service
Serverless FaaS
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
What does Lambda Handle
 Load Balancing
 Auto Scaling
 Handling Failures
 Security Isolation
 OS Management
 Managing Utilization
(and much more) for you
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Serverless Lambda Applications
Function
Services
(any)
Changes in data state
Requests to endpoints
Changes in resource state
Node.js
Python
Ruby
Java
Go
.NET
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Anatomy of Lambda function
import json
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
Handler() function
Function to be executed
upon invocation
Event object
Data sent during Lambda
function Invocation
Context object
Methods available to interact
with runtime information
(request ID, log group, more)
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Demo
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda pricing
 Buy compute time in
increments of 1ms !
 Low request change
 No hourly, daily or monthly
minimums
 No per device fees
 Never pay for idle
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda execution model
API Gateway
/order
Lambda function
Synchronous (push)
SNS S3
Asynchronous (event)
(reqs)
Lambda function
DynamoDB Kinesis
Changes
AWS Lambda
Service
Lambda function
Poll Based
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda API
SDK Clients
Lambda directly invoked
via invoke API
 API provided by the Lambda
service
 Used by all other services that
invoke Lambda across all models
 Supports sync and async
 Can pass any event payload,
structure you want
 Client included in every SDK
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Lambda permissions model
Fine grained security controls for both
execution and invocation
Execution policies:
 Define what AWS resources/API calls can this
function access via IAM
 Used in streaming invocations e.g. "Lambda
function A can read from DynamoDB table
users"
Function policies:
 Used for sync and async invocations
 e.g. Actions on bucket X can invoke Lambda
function Z"
Resource policies allow for cross account access
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Use cases
Web Applications
 Static Sites
 Complex web
apps
 Packages for Flask
and Express
Back-Ends
 Apps & Services
 Mobile
 IoT
Chatbots
 Powering
Chatbot logic
Data Processing
 Real time
 Map Reduce
 Batch
Amazon Alexa
 Powering Voice
Enabled Apps
 Alexa Skills Kit
I里 Automation
 Policy Engines
 Extending AWS
Services
 Infrastructure
Management
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
API Gateway
Create a unified
API frontend for
multiple micro
services
DDoS protection
and throttling
for your
backend
Authenticate and
authorize requests
to a backend
Throttle, meter, and
monetize API usage
by third-party
developers
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Demo
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Frameworks
AWS SAM
Serverless
AWS Amplify
SPARTA
Claudia.js

MIDWAY
AWS : Third Party :
息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark.
Thank you for attending!
Ioannis Polyzos
Senior Solutions Architect
ipolyzos@amazon.com
@ipolyzos

More Related Content

Getting started building your first serverless web application on AWS

  • 1. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Ioannis Polyzos, Senior Solutions Architect 01/07/2022 Getting started building your first serverless web application on AWS
  • 2. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Agenda Evolution of computing What is serverless ? AWS Lambda Use Cases API Gateway Frameworks Thank you
  • 3. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. There is no server better than no server Werner Vogels, CTO Amazon
  • 4. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Evolution of computing
  • 5. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Lets take a look at the evolution of computing Physical Servers in Datacenters Virtual Servers in Datacenters a Virtual Servers in the Cloud
  • 6. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Each progressive step was better Physical Servers in Datacenters a Virtual Servers in the Cloud Higher utilization Faster provisioning speed Improved uptime Disaster recovery Hardware independence Virtual Servers in Datacenters Trade CAPEX for OPEX More scale Elastic resources Faster speed and agility Reduced maintenance Better availability and fault tolerance Better Automation
  • 7. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. What is serverless ? No servers to provision or manage Scales with usage Never pay for idle Availability and fault tolerance build int
  • 8. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Serverless means : Greater agility Less Overhead Better focus Increased Scale More flexibility Faster time to market
  • 9. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. AWS Lambda Zero administration Focus on business logic, not infrastructure. Just upload your code, and AWS Lambda handles the rest. Autoscaling AWS Lambda scales the infrastructure as needed to match the event rate and pay as you go at 100ms intervals. Bring your own code Code in Node.JS, Java, Python or C#. Create threads and processes, run batch scripts or other .exe files. Sync and Async events Respond to application calls with low-latency real-time functions.
  • 10. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. AWS Lambda Event-driven compute Function as a Service Serverless FaaS
  • 11. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. What does Lambda Handle Load Balancing Auto Scaling Handling Failures Security Isolation OS Management Managing Utilization (and much more) for you
  • 12. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Serverless Lambda Applications Function Services (any) Changes in data state Requests to endpoints Changes in resource state Node.js Python Ruby Java Go .NET
  • 13. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Anatomy of Lambda function import json def lambda_handler(event, context): # TODO implement return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } Handler() function Function to be executed upon invocation Event object Data sent during Lambda function Invocation Context object Methods available to interact with runtime information (request ID, log group, more)
  • 14. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Demo
  • 15. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Lambda pricing Buy compute time in increments of 1ms ! Low request change No hourly, daily or monthly minimums No per device fees Never pay for idle
  • 16. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Lambda execution model API Gateway /order Lambda function Synchronous (push) SNS S3 Asynchronous (event) (reqs) Lambda function DynamoDB Kinesis Changes AWS Lambda Service Lambda function Poll Based
  • 17. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Lambda API SDK Clients Lambda directly invoked via invoke API API provided by the Lambda service Used by all other services that invoke Lambda across all models Supports sync and async Can pass any event payload, structure you want Client included in every SDK
  • 18. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Lambda permissions model Fine grained security controls for both execution and invocation Execution policies: Define what AWS resources/API calls can this function access via IAM Used in streaming invocations e.g. "Lambda function A can read from DynamoDB table users" Function policies: Used for sync and async invocations e.g. Actions on bucket X can invoke Lambda function Z" Resource policies allow for cross account access
  • 19. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Use cases Web Applications Static Sites Complex web apps Packages for Flask and Express Back-Ends Apps & Services Mobile IoT Chatbots Powering Chatbot logic Data Processing Real time Map Reduce Batch Amazon Alexa Powering Voice Enabled Apps Alexa Skills Kit I里 Automation Policy Engines Extending AWS Services Infrastructure Management
  • 20. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. API Gateway Create a unified API frontend for multiple micro services DDoS protection and throttling for your backend Authenticate and authorize requests to a backend Throttle, meter, and monetize API usage by third-party developers
  • 21. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Demo
  • 22. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Frameworks AWS SAM Serverless AWS Amplify SPARTA Claudia.js MIDWAY AWS : Third Party :
  • 23. 息 2022, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark. Thank you for attending! Ioannis Polyzos Senior Solutions Architect ipolyzos@amazon.com @ipolyzos