SlideShare uma empresa Scribd logo
1 de 47
Baixar para ler offline
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Bob Kinney, AWS Serverless (Amazon API Gateway)
December 1, 2016
SVR402
Operating Your Production
API
What to Expect from the Session
Brief review of Amazon API Gateway/AWS Lambda
Monitoring Your API
Amazon CloudWatch Metrics/Alarms
Amazon CloudWatch Logs
Protecting Your API
Throttling
Authorization
Usage Plans
Managing Your API
Amazon API Gateway
Create a unified
API front end for
multiple
microservices
Authenticate and
authorize
requests to a
back end
DDoS protection
and throttling for
your back end
Throttle, meter,
and monetize API
usage by third-
party developers
API Gateway Integrations
Internet
Mobile Apps
Websites
Services
Lambda
functions
AWS
API Gateway
Cache
Endpoints on
Amazon EC2
All publicly
accessible
endpoints
Amazon
CloudWatch
Monitoring
Amazon
CloudFront
Any other
AWS service
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
AWS Lambda
1 2 3
Meet Doug
Doug loves coffee.
Doug also writes apps.
Doug built TAMPR–a service for
sharing reviews of coffee and coffee
shops.
Doug built the TAMPR back end
serverless, with API Gateway and
Lambda.
First Reviews of TAMPR
“I want to love this app, but every time
I try to check in with my morning
coffee, I get errors.”
“The app works great if I’m getting an
afternoon coffee, but during the
mornings it’s almost unusable.”
“Too many errors, it never seems to
work.”
Monitoring Your API:
Amazon CloudWatch Metrics
Amazon CloudWatch Metrics
API Gateway default metrics set:
Count–Total number of invokes received by API Gateway
4XXError–Number of invokes that generated a 4XX error
(includes throttling)
5XXError–Number of invokes that generated a 5XX error
Latency–Total time API Gateway took to fully process request
IntegrationLatency–Time API Gateway took to call integration
CacheHitCount–Number of successful cache fetches
CacheMissCount–Number of unsuccessful cache fetches
Amazon CloudWatch Metrics
Detailed metrics:
Same set of metrics at method level
Can be enabled globally or only for specific methods
GET PUT DELETE
Amazon CloudWatch Metrics
Default Metrics
Included for free
Broken down by API stage
Detailed Metrics
Standard CloudWatch pricing
Broken down by method
Amazon CloudWatch Alarms
Any metric can be tied to an alarm
Alarm notifications can be sent to an Amazon SNS topic
SNS topic can then send to any number of destinations:
E-mail address
Amazon SQS queue
Lambda function
CloudWatch Alarms–NEW
Error and cache metrics now support averages
Alarm on the rate of failures in your API, not just raw count!
Demo
Check in with Doug
Doug now has alarms to be alerted
when his customers get errors calling
his serverless API, but how does he
know why his customers get errors?
Monitoring Your API:
Amazon CloudWatch Logs
Amazon CloudWatch Logs
API Gateway logging:
Two levels of logging, ERROR and INFO
Optionally log method request/body content
Set globally in stage, or override per method
Lambda logging:
Logging directly from your code
Basic request information included
Log pivots:
Build metrics based on log filters
Jump to logs that generated metrics
Amazon CloudWatch Logs
So many log streams…
CloudWatch Logs
apilogs - https://github.com/rpgreen/apilogs
Search and stream your API Gateway logs (and Lambda)
Basic syntax highlighting
View API Gateway and Lambda logs together
Demo
Check in with Doug
Thanks to logging, Doug now knows
that his API is generating errors during
peak loads because there’s spurious
traffic hitting a particular API method at
a much higher than expected rate due
to a bug in the mobile app.
He now needs a way to to limit the
traffic from those devices to let other
traffic through.
Protecting Your API:
Throttling
API Gateway Throttling
Three levels of throttling for APIs:
API key-level throttling–Configurable in usage plan
Method-level throttling–Configurable in stage settings
Account-level throttling–Limits can be increased
API Gateway Throttling
Token bucket algorithm:
Burst–the maximum size of the bucket
Rate–the number of tokens added to the bucket
API Gateway Throttling–NEW
Limits apply in order of most specific to least specific:
API key, method, account
Requests throttled for any reason will no longer be billed
Demo
Check in with Doug
Thanks to throttling, Doug has limited
the impact from the buggy version of
the application to affecting only the
one method.
He can ship updates to affected
customers to re-route traffic as
needed.
TAMPR Promotions
TAMPR has become popular, and
coffee shops and roasters are
contacting Doug to discuss
possibilities of promotions through the
app.
Doug needs a way to allow these
shops to create accounts and create
and edit promotions on demand.
Protecting Your API:
Authentication/Authorization
Authentication Type Comparison
Feature AWS IAM CUSTOM AMAZON
COGNITO
Authentication X X X
Authorization X X
Signature V4 X
Amazon Cognito User Pools X X
Third-Party Authentication X
Additional Costs NONE Pay per
authorizer invoke
NONE
API Gateway Authorization–NEW
CUSTOM authorizers support additional returned context:
key/value dictionary
Requests that fail authorization will no longer be billed
Demo
Check in with Doug
TAMPR promotions have been a hit,
and the app is more popular than ever.
Doug is now speaking with other
services, such as a new site focused
on brunch spots, on how they can
work together.
Doug wants a way he can expose
portions of his API to these third
parties, but track their usage for
potential billing opportunities.
Protecting Your API:
Usage Plans
API Key Throttling
Rate/Burst per API Key
API Key Usage
Daily usage records
API Key Quota
Periodic limits per API Key
API Gateway Usage Plans
Demo
Check in with Doug
TAMPR is continuing to grow, and
Doug is now bringing in people to help
work on updates.
He is looking for ways to formalize the
update process.
Managing Your API
Stages are named links to a deployed version of your API
Recommended for managing API lifecycle:
dev/test/prod
alpha/beta/gamma
Support for parameterized values via stage variables
API Stages
Maintain multiple versions of your Lambda code and link a
named alias
Works great in combination with API stages and stage
variables
Lambda Versions
Run your APIs within your own DNS zone
Recommended for supporting multiple versions:
api.tampr.com/v1 -> restapi1
api.tampr.com/v2 -> restapi2
Custom Domains
Portable API definition (JSON/YAML)
Import/export your API:
Swagger extensions for API Gateway
Recommended for tracking changes to your API
Swagger
Chalice - https://github.com/awslabs/chalice
Python microframework, includes deployment scripts
Serverless - https://github.com/serverless/serverless
Node.js, Python, Java, and Scala
Describe API and other resources
SAM - https://github.com/awslabs/serverless-application-model
Serverless Application Model
Extends AWS CloudFormation
Can integrate with AWS CodePipeline for CI/CD solution
Deployment Mechanisms
Be Like Doug
• Monitor your APIs with metrics and
alarms to find problems.
• Use logging to diagnose problems
with your APIs.
• Make use of throttling and
authentication to limit blast radius
and protect critical API components.
• Make your API available to third
parties via usage plans.
• Manage your API with
stages/versions and deployment
tools.
Have Questions?
Visit the Application Services Booth!
Forums
https://forums.aws.amazon.com/
StackOverflow
http://stackoverflow.com/questions/tagged/aws-api-gateway
Thank you!
Remember to complete
your evaluations!

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Security Best Practices for Serverless Applications - July 2017 AWS Online T...
Security Best Practices for Serverless Applications  - July 2017 AWS Online T...Security Best Practices for Serverless Applications  - July 2017 AWS Online T...
Security Best Practices for Serverless Applications - July 2017 AWS Online T...
 
Securing Serverless Architecture
Securing Serverless ArchitectureSecuring Serverless Architecture
Securing Serverless Architecture
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API Gateway
 
Deep Dive on Amazon Cognito - DevDay Los Angeles 2017
Deep Dive on Amazon Cognito - DevDay Los Angeles 2017Deep Dive on Amazon Cognito - DevDay Los Angeles 2017
Deep Dive on Amazon Cognito - DevDay Los Angeles 2017
 
Zombie Apocalypse Workshop by Warren Santer and Kyle Somers, Solutions Archit...
Zombie Apocalypse Workshop by Warren Santer and Kyle Somers, Solutions Archit...Zombie Apocalypse Workshop by Warren Santer and Kyle Somers, Solutions Archit...
Zombie Apocalypse Workshop by Warren Santer and Kyle Somers, Solutions Archit...
 
Building Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API GatewayBuilding Serverless Backends with AWS Lambda and Amazon API Gateway
Building Serverless Backends with AWS Lambda and Amazon API Gateway
 
Workshop: We love APIs
Workshop: We love APIsWorkshop: We love APIs
Workshop: We love APIs
 
BDA306 NEW LAUNCH! An Introduction to Amazon Lex, your service for building v...
BDA306 NEW LAUNCH! An Introduction to Amazon Lex, your service for building v...BDA306 NEW LAUNCH! An Introduction to Amazon Lex, your service for building v...
BDA306 NEW LAUNCH! An Introduction to Amazon Lex, your service for building v...
 
Building AWS Lambda Applications with the AWS Serverless Application Model (A...
Building AWS Lambda Applications with the AWS Serverless Application Model (A...Building AWS Lambda Applications with the AWS Serverless Application Model (A...
Building AWS Lambda Applications with the AWS Serverless Application Model (A...
 
Building APIs with Amazon API Gateway
Building APIs with Amazon API GatewayBuilding APIs with Amazon API Gateway
Building APIs with Amazon API Gateway
 
AWS Serverless Development
AWS Serverless DevelopmentAWS Serverless Development
AWS Serverless Development
 
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless CloudAWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
AWS Summit Auckland - Getting Started with AWS Lambda and the Serverless Cloud
 
AWS Mobile Hub
AWS Mobile HubAWS Mobile Hub
AWS Mobile Hub
 
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API GatewayStephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
Stephen Liedig: Building Serverless Backends with AWS Lambda and API Gateway
 
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
 
(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB
(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB
(GAM401) Build a Serverless Mobile Game w/ Cognito, Lambda & DynamoDB
 
Building Scalable Services with Amazon API Gateway - Technical 201
Building Scalable Services with Amazon API Gateway - Technical 201Building Scalable Services with Amazon API Gateway - Technical 201
Building Scalable Services with Amazon API Gateway - Technical 201
 
10 Tips For Serverless Backends With NodeJS and AWS Lambda
10 Tips For Serverless Backends With NodeJS and AWS Lambda10 Tips For Serverless Backends With NodeJS and AWS Lambda
10 Tips For Serverless Backends With NodeJS and AWS Lambda
 
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
AWS re:Invent 2016: All Your Chats are Belong to Bots: Building a Serverless ...
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 

Semelhante a AWS re:Invent 2016: Operating Your Production API (SVR402)

Semelhante a AWS re:Invent 2016: Operating Your Production API (SVR402) (20)

SRV307_Operating Your Serverless API at Scale
SRV307_Operating Your Serverless API at ScaleSRV307_Operating Your Serverless API at Scale
SRV307_Operating Your Serverless API at Scale
 
Operating Your Production API
Operating Your Production APIOperating Your Production API
Operating Your Production API
 
Operating your Production API
Operating your Production APIOperating your Production API
Operating your Production API
 
The ultimate api checklist by Blendr.io
The ultimate api checklist by Blendr.ioThe ultimate api checklist by Blendr.io
The ultimate api checklist by Blendr.io
 
Operating Your Serverless API in Production at Scale - AWS Online Tech Talks
Operating Your Serverless API in Production at Scale - AWS Online Tech TalksOperating Your Serverless API in Production at Scale - AWS Online Tech Talks
Operating Your Serverless API in Production at Scale - AWS Online Tech Talks
 
Operating Your Serverless API in Production at Scale - SRV217 - Chicago AWS S...
Operating Your Serverless API in Production at Scale - SRV217 - Chicago AWS S...Operating Your Serverless API in Production at Scale - SRV217 - Chicago AWS S...
Operating Your Serverless API in Production at Scale - SRV217 - Chicago AWS S...
 
API Best Practices
API Best PracticesAPI Best Practices
API Best Practices
 
Introduction to Serverless on AWS
Introduction to Serverless on AWSIntroduction to Serverless on AWS
Introduction to Serverless on AWS
 
Deep Dive on Serverless Stack
Deep Dive on Serverless StackDeep Dive on Serverless Stack
Deep Dive on Serverless Stack
 
Api gateway-security
Api gateway-securityApi gateway-security
Api gateway-security
 
Serverless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about serversServerless Computing: build and run applications without thinking about servers
Serverless Computing: build and run applications without thinking about servers
 
Amazon API Gateway
Amazon API GatewayAmazon API Gateway
Amazon API Gateway
 
AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...
AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...
AWS August Webinar Series - Building Serverless Backends with AWS Lambda and ...
 
Ci/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO ClubCi/CD for AWS Lambda Projects - JLM CTO Club
Ci/CD for AWS Lambda Projects - JLM CTO Club
 
Forza Computazionale e Applicazioni Serverless
Forza Computazionale e Applicazioni ServerlessForza Computazionale e Applicazioni Serverless
Forza Computazionale e Applicazioni Serverless
 
Serverless-AWS SAM CLI Session: Developer Meet Up
Serverless-AWS SAM CLI Session: Developer Meet UpServerless-AWS SAM CLI Session: Developer Meet Up
Serverless-AWS SAM CLI Session: Developer Meet Up
 
Raleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applicationsRaleigh DevDay 2017: Building serverless web applications
Raleigh DevDay 2017: Building serverless web applications
 
Mobile Application Development and Testing on AWS
Mobile Application Development and Testing on AWSMobile Application Development and Testing on AWS
Mobile Application Development and Testing on AWS
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverless
 
Core Dimensions of API Management
Core Dimensions of API ManagementCore Dimensions of API Management
Core Dimensions of API Management
 

Mais de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Mais de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

AWS re:Invent 2016: Operating Your Production API (SVR402)

  • 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Bob Kinney, AWS Serverless (Amazon API Gateway) December 1, 2016 SVR402 Operating Your Production API
  • 2. What to Expect from the Session Brief review of Amazon API Gateway/AWS Lambda Monitoring Your API Amazon CloudWatch Metrics/Alarms Amazon CloudWatch Logs Protecting Your API Throttling Authorization Usage Plans Managing Your API
  • 3. Amazon API Gateway Create a unified API front end for multiple microservices Authenticate and authorize requests to a back end DDoS protection and throttling for your back end Throttle, meter, and monetize API usage by third- party developers
  • 4. API Gateway Integrations Internet Mobile Apps Websites Services Lambda functions AWS API Gateway Cache Endpoints on Amazon EC2 All publicly accessible endpoints Amazon CloudWatch Monitoring Amazon CloudFront Any other AWS service
  • 5. 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 AWS Lambda 1 2 3
  • 6. Meet Doug Doug loves coffee. Doug also writes apps. Doug built TAMPR–a service for sharing reviews of coffee and coffee shops. Doug built the TAMPR back end serverless, with API Gateway and Lambda.
  • 7. First Reviews of TAMPR “I want to love this app, but every time I try to check in with my morning coffee, I get errors.” “The app works great if I’m getting an afternoon coffee, but during the mornings it’s almost unusable.” “Too many errors, it never seems to work.”
  • 8. Monitoring Your API: Amazon CloudWatch Metrics
  • 9. Amazon CloudWatch Metrics API Gateway default metrics set: Count–Total number of invokes received by API Gateway 4XXError–Number of invokes that generated a 4XX error (includes throttling) 5XXError–Number of invokes that generated a 5XX error Latency–Total time API Gateway took to fully process request IntegrationLatency–Time API Gateway took to call integration CacheHitCount–Number of successful cache fetches CacheMissCount–Number of unsuccessful cache fetches
  • 10. Amazon CloudWatch Metrics Detailed metrics: Same set of metrics at method level Can be enabled globally or only for specific methods GET PUT DELETE
  • 11. Amazon CloudWatch Metrics Default Metrics Included for free Broken down by API stage Detailed Metrics Standard CloudWatch pricing Broken down by method
  • 12. Amazon CloudWatch Alarms Any metric can be tied to an alarm Alarm notifications can be sent to an Amazon SNS topic SNS topic can then send to any number of destinations: E-mail address Amazon SQS queue Lambda function
  • 13. CloudWatch Alarms–NEW Error and cache metrics now support averages Alarm on the rate of failures in your API, not just raw count!
  • 14. Demo
  • 15. Check in with Doug Doug now has alarms to be alerted when his customers get errors calling his serverless API, but how does he know why his customers get errors?
  • 16. Monitoring Your API: Amazon CloudWatch Logs
  • 17. Amazon CloudWatch Logs API Gateway logging: Two levels of logging, ERROR and INFO Optionally log method request/body content Set globally in stage, or override per method Lambda logging: Logging directly from your code Basic request information included Log pivots: Build metrics based on log filters Jump to logs that generated metrics
  • 18. Amazon CloudWatch Logs So many log streams…
  • 19. CloudWatch Logs apilogs - https://github.com/rpgreen/apilogs Search and stream your API Gateway logs (and Lambda) Basic syntax highlighting View API Gateway and Lambda logs together
  • 20. Demo
  • 21. Check in with Doug Thanks to logging, Doug now knows that his API is generating errors during peak loads because there’s spurious traffic hitting a particular API method at a much higher than expected rate due to a bug in the mobile app. He now needs a way to to limit the traffic from those devices to let other traffic through.
  • 23. API Gateway Throttling Three levels of throttling for APIs: API key-level throttling–Configurable in usage plan Method-level throttling–Configurable in stage settings Account-level throttling–Limits can be increased
  • 24. API Gateway Throttling Token bucket algorithm: Burst–the maximum size of the bucket Rate–the number of tokens added to the bucket
  • 25. API Gateway Throttling–NEW Limits apply in order of most specific to least specific: API key, method, account Requests throttled for any reason will no longer be billed
  • 26. Demo
  • 27. Check in with Doug Thanks to throttling, Doug has limited the impact from the buggy version of the application to affecting only the one method. He can ship updates to affected customers to re-route traffic as needed.
  • 28. TAMPR Promotions TAMPR has become popular, and coffee shops and roasters are contacting Doug to discuss possibilities of promotions through the app. Doug needs a way to allow these shops to create accounts and create and edit promotions on demand.
  • 30. Authentication Type Comparison Feature AWS IAM CUSTOM AMAZON COGNITO Authentication X X X Authorization X X Signature V4 X Amazon Cognito User Pools X X Third-Party Authentication X Additional Costs NONE Pay per authorizer invoke NONE
  • 31. API Gateway Authorization–NEW CUSTOM authorizers support additional returned context: key/value dictionary Requests that fail authorization will no longer be billed
  • 32. Demo
  • 33. Check in with Doug TAMPR promotions have been a hit, and the app is more popular than ever. Doug is now speaking with other services, such as a new site focused on brunch spots, on how they can work together. Doug wants a way he can expose portions of his API to these third parties, but track their usage for potential billing opportunities.
  • 35. API Key Throttling Rate/Burst per API Key API Key Usage Daily usage records API Key Quota Periodic limits per API Key API Gateway Usage Plans
  • 36. Demo
  • 37. Check in with Doug TAMPR is continuing to grow, and Doug is now bringing in people to help work on updates. He is looking for ways to formalize the update process.
  • 39. Stages are named links to a deployed version of your API Recommended for managing API lifecycle: dev/test/prod alpha/beta/gamma Support for parameterized values via stage variables API Stages
  • 40. Maintain multiple versions of your Lambda code and link a named alias Works great in combination with API stages and stage variables Lambda Versions
  • 41. Run your APIs within your own DNS zone Recommended for supporting multiple versions: api.tampr.com/v1 -> restapi1 api.tampr.com/v2 -> restapi2 Custom Domains
  • 42. Portable API definition (JSON/YAML) Import/export your API: Swagger extensions for API Gateway Recommended for tracking changes to your API Swagger
  • 43. Chalice - https://github.com/awslabs/chalice Python microframework, includes deployment scripts Serverless - https://github.com/serverless/serverless Node.js, Python, Java, and Scala Describe API and other resources SAM - https://github.com/awslabs/serverless-application-model Serverless Application Model Extends AWS CloudFormation Can integrate with AWS CodePipeline for CI/CD solution Deployment Mechanisms
  • 44. Be Like Doug • Monitor your APIs with metrics and alarms to find problems. • Use logging to diagnose problems with your APIs. • Make use of throttling and authentication to limit blast radius and protect critical API components. • Make your API available to third parties via usage plans. • Manage your API with stages/versions and deployment tools.
  • 45. Have Questions? Visit the Application Services Booth! Forums https://forums.aws.amazon.com/ StackOverflow http://stackoverflow.com/questions/tagged/aws-api-gateway