Mais conteúdo relacionado Semelhante a AWS Serverless per startup: come innovare senza preoccuparsi dei server (20) Mais de Amazon Web Services (20) AWS Serverless per startup: come innovare senza preoccuparsi dei server1. AWS Serverless per startup
come innovare senza preoccuparsi dei server
Fausto Palma
Solution Architect
2. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
2
What do we mean when we say serverless?
2. Flexible, automated scaling
scales by unit of work/consumption
rather than by server unit
1. No server management
no servers to provision, operate,
patch, etc.
3. Automated high availability
no need to architect for availability
because it is built into the service
4. Pay for value
you only pay for unit of work that
creates value rather than by server time
It is the running your application with your custom code …
3. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
3
AWS
Lambda
AWS
Fargate
Amazon
API Gateway
Amazon
SNS
Amazon
SQS
AWS
Step Functions
COMPUTE
DATA STORES
INTEGRATION
AWS
AppSync
Amazon Aurora
Serverless
Amazon
S3
Amazon
DynamoDB
Amazon
EventBridge
Serverless stack
4. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
4
Lambda service
Node.js
Python
Java
C#
Go
Ruby
Runtime API
Downstream servicesEvent source
Changes in
data state
Requests from
endpoints
Changes in
Resource state
Function
Lambda service
5. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
5
Lambda Execution Models
Synchronous Stream
Downstream
services
response
Asynchronous
Retry 1x-3x Downstream
services
destination
Event
source
Event
source
Downstream
services
destination
pointer
stream
Event
source
Retry until
expired
6. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
6
AWS
Lambda
AWS
Fargate
Amazon
API Gateway
Amazon
SNS
Amazon
SQS
AWS
Step Functions
COMPUTE
DATA STORES
INTEGRATION
AWS
AppSync
Amazon Aurora
Serverless
Amazon
S3
Amazon
DynamoDB
Amazon
EventBridge
Serverless stack
7. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
7
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
API Gateway
8. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
8
Types of APIs: Supported Protocol Details
RESTful: HTTP APIs or REST APIs Two way: WebSocket APIs
Client Client
• Request / Response
• HTTP Methods like GET, POST, etc
• Short-lived communication
• Stateless
• 2 way communication channel
• Serverless WebSocket
• Long-lived communication
• Stateful
request
response
Two way communication channel
9. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
9
API Architecture
Websites
Services
Amazon API Gateway
API Gateway Cache
(REST only)
Public
Endpoints on
Amazon EC2
Amazon
CloudWatch
Monitoring
All publicly accessible
endpoints
Lambda
Functions
Endpoints
in VPC
Applications
& Services
in VPC
Any other AWS
service
Fully-managed
CloudFront
Distribution
Edge-OptimizedRegionalPrivate
Applications
& Services
in the same
AWS Region AWS Direct
Connect
On-premises
HTTPS
Mobile client
Customer-managed
CloudFront Distribution
10. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
10
Types of APIs
Edge-Optimized (Available with REST APIs)
• Uses CloudFront to reduce TLS
connection overhead (reduces roundtrip
time)
• Designed for a globally distributed
clients
Regional (Available with all types)
• Recommended API type for
general use cases
• Designed for building APIs for
clients in the same region
Private (Available with REST APIs)
• Only accessible from within VPC
(and networks connected to VPC)
• Designed for building APIs used
internally or by private
microservices
RESTful APIs
HTTP APIs are the cheapest, fastest, best choice for
building APIs that only require API proxy functionality.
For APIs that require API proxy functionality and
management features in a single solution, API Gateway
also offers REST APIs.
WebSocket APIs
WebSocket APIs allow you to build real-time two-way
communication applications, such as chat apps and
streaming dashboards. API Gateway maintains a
persistent connection to handle message transfer
between a backend service and its clients.
11. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
11
API Security
• IAM Permissions for REST APIs & WebSocket
APIs
Use IAM policies and AWS credentials to
grant users access to APIs
• Lambda Authorizers for REST APIs &
WebSocket APIs
Use Lambda to validate a bearer token
(OAuth or SAML as examples) or request
parameters and grant access
• Cognito User Pools for all RESTful APIs
Create a completely managed user
management system
API Gateway offers several
mechanisms for adding
Authn/Authz to APIs.
All APIs from API Gateway
come with industry standard
security features such as
Native OIDC and OAuth2.
12. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
12
Infrastructure as code
AWS CloudFormation
AWS AmplifyAWS SAM AWS CDK
13. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
13
Example CDK code to create a simple module
https://github.com/aws-samples/aws-cdk-
examples/tree/master/python/api-sqs-lambda
Amazon API Gateway
Queue
AWS Lambda
cdk init Creates a new CDK project in
the current directory from a
specified template
cdk deploy Deploys the specified stack(s)
cdk destroy Destroys the specified stack(s)
14. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
14
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
Microservices
15. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
15
Microservices vs monolith applications
Each microservice does one
thing and stores its own data
Microservices
The monolith does
everything and uses a
single data source
Monolith
Messages and events
are the connection
between microservices
…
16. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
16
monolithic application
+ teams
2001
Lesson learned: decompose for agility
2002
microservices
Development transformation at Amazon
2 pizza teams
Full ownership & autonomy
You build it, you run it
DevOps – small, nimble teams
Focused innovation
17. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
17
© 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
AWS Training & Certifications
18. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential and Trademark
18
AWS Training & Certification
https://www.aws.training: Free on-demand courses to help you build new cloud skills
e-Learning: Architecting Serverless Solutions
https://www.aws.training/Details/eLearning?id=42594
e-Learning: Getting into the Serverless Mindset
https://www.aws.training/Details/eLearning?id=27198
e-learning: Introduction to Serverless Development
https://www.aws.training/Details/eLearning?id=27074
e-learning: AWS Lambda Foundations
https://www.aws.training/Details/eLearning?id=27197
For more info on AWS T&C visit: https://aws.amazon.com/it/training/
Video: Introduction to Amazon API Gateway
https://www.aws.training/Details/Video?id=16452
e-learning: Amazon API Gateway for Serverless Applications
https://www.aws.training/Details/eLearning?id=27199
e-learning: Amazon DynamoDB for Serverless Architectures
https://www.aws.training/Details/eLearning?id=27196
Video: Serverless Analytics
https://www.aws.training/Details/Video?id=26848