Upgrade to Pro — share decks privately, control downloads, hide ads and more …

re:Invent 2019 - Serverless

re:Invent 2019 - Serverless

During this year's Re:Invent conference, several interesting features and services were released for serverless by AWS. With these new capabilities, you can get better insights into serverless performance, keep your functions hyper-ready for lower latency and orchestrate messaging between your Lambda functions with less code and complexity.

Marek Kuczynski

January 09, 2020
Tweet

More Decks by Marek Kuczynski

Other Decks in Technology

Transcript

  1. © 2019, Amazon Web Services, Inc. or its affiliates. All

    rights reserved. Serverless at re:Invent 2019 Marek Kuczynski Serverless Specialist Solutions Architect for EMEA Amazon Web Services @marekq
  2. Serverless architectures SERVICES (ANYTHING) Changes in data state Requests to

    endpoints Changes in resource state EVENT SOURCE FUNCTION Node.js Python Java C# Go Ruby PowerShell Bring your own runtime
  3. (A)synchronous invocations and stream processing Synchronous (push) Asynchronous (event) Stream

    (poll-based) Amazon DynamoDB Amazon SNS /order Amazon S3 reqs Amazon Kinesis Data Streams changes AWS Lambda service function Amazon API Gateway Lambda function Lambda function
  4. Where we added new functionality • Performance improvements and reducing

    latency You can serve your requests faster, cheaper and with lower latencies • Reducing the cost of your workload You can choose alternatives for serving API’s and orchestrating functions • Easier processing of messages between functions You have to maintain less code and “glue” logic between your functions • Richer capabilities to monitor, debug and trace your workload You can debug problems faster and optimize for performance more effectively
  5. Provisioned Concurrency for AWS Lambda INTRODUCING Provisioned Concurrency keeps functions

    initialized and hyper-ready to respond in double-digit milliseconds. Customers fully control when or how long to enable Provisioned Concurrency. Taking advantage of Provisioned Concurrency requires no changes to your code.. Ideal for latency-sensitive applications
  6. Bootstrap the runtime Start your code Lambda: The execution lifecycle

    Cold start Warm start Download your code Start new container Time
  7. • Greater control over the start up time of your

    Lambda functions. • Functions stay initialized and hyper- ready to respond in double-digit milliseconds. • No code changes necessary • Ideal for interactive applications such as web or mobile backends AWS Lambda Provisioned Concurrency • Customers are building: • Applications that have strict latency SLAs • Applications that support high-velocity traffic bursts
  8. Provisioning concurrency • Provisioning scheduled in advance • Schedule in

    advance to allow for scale-up • Provision in increments of 5 minutes • Invocations above the provisioned concurrency are handled by on-demand Lambda 0 500 1000 1500 2000 2500 0 500 1000 1500 2000 2500 8:00 8:10 8:20 8:30 8:40 8:50 9:00 9:10 9:20 9:30 9:40 9:50 10:00 10:10 10:20 10:30 10:40 10:50 11:00 11:10 11:20 11:30 11:40 11:50 12:00 Traffic (TPS) Provisioned concurrency
  9. Concurrency and latency 0 500 1000 1500 2000 2500 0

    500 1000 1500 2000 2500 8:00 8:10 8:20 8:30 8:40 8:50 9:00 9:10 9:20 9:30 9:40 9:50 10:00 10:10 10:20 10:30 10:40 10:50 11:00 11:10 11:20 11:30 11:40 11:50 12:00 Traffic (TPS) Provisioned concurrency 0 500 1000 1500 2000 2500 8:00 8:10 8:20 8:30 8:40 8:50 9:00 9:10 9:20 9:30 9:40 9:50 10:00 10:10 10:20 10:30 10:40 10:50 11:00 11:10 11:20 11:30 11:40 11:50 12:00 p100 latency p100 latency P100 latency spike for a regular cold start when we exceeded the provisioned concurrency This behavior is configurable using Per Function Concurrency throttling
  10. Applications that: • Serve content such as ads during a

    live stream • Mobile applications such as games • Marketing blitzes or flash sales Lambda will: • Provisioning scheduled in advance • Schedule in advance to allow for scale-up • Provision in increments of 5 minutes • Invocations above the provisioned concurrency are handled by on-demand Lambda Use Cases: High-velocity traffic bursts
  11. Lambda runtime updates • Node.js 12 • Updated V8 engine

    • Public/Private class fields • Java 11 • HTTP client (standard) • The var keyword • Python 3.8 • Assignment expressions • Positional-only arguments * Python 2.7 has critical patch support from AWS until end of 2020. We encourage to move to Python 3.x as soon as possible; https://aws.amazon.com/blogs/compute/continued-support-for-python-2-7- on-aws-lambda/
  12. HTTP APIs for Amazon API Gateway PREVIEW Achieve up to

    70% cost reduction and 50% latency reduction compared to REST APIs. HTTP APIs are also easier to configure than REST APIs, allowing you to focus more time on building applications. Reduce application costs by up to 70%
  13. HTTP APIs for Amazon API Gateway • JWT Authorizers -

    supports native OpenID Connect (OIDC) authorization. You can configure API Gateway to parse incoming JWT tokens, and allow or deny requests based on the OAuth scopes in the token. • Default Stages and Routes - make it easier to work with APIs. When you assign a default stage, you are able to serve your API from the base URL. This means you no longer need an explicit stage in your API. https://{api_id}.execute-api.{region}.amazonaws.com/ • Fully customizable CORS experience.
  14. Choosing Between HTTP APIs and REST APIs Authorizers HTTP API

    REST API AWS Lambda ✓ IAM ✓ Amazon Cognito ✓ * ✓ Native OpenID Connect / OAuth 2.0 ✓ Integration HTTP API REST API HTTP proxy ✓ ✓ Lambda proxy ✓ ✓ HTTP ✓ AWS services ✓ Private integration ✓ Mock ✓ * You can use Amazon Cognito as a JWT issuer.
  15. Choosing Between HTTP APIs and REST APIs (cont'd) API Management

    HTTP API REST API Usage plans ✓ API keys ✓ Security HTTP API REST API Client certificates ✓ AWS WAF ✓ Resource policies ✓ API Type HTTP API REST API Regional ✓ ✓ Edge-optimized ✓ Private ✓
  16. Choosing Between HTTP APIs and REST APIs (cont'd) Development HTTP

    API REST API Cache ✓ Request transformation ✓ Request / response validation ✓ Test invocation ✓ CORS configuration ✓ Automatic deployments ✓ Default stage ✓ Default route ✓ AWS Service Integrations HTTP API REST API AWS X-Ray ✓
  17. AWS Step Functions Express Workflows INTRODUCING Orchestrate AWS compute, database,

    and messaging services at rates up to 100,000 events per second, suitable for high-volume event processing workloads such as IoT data ingestion, microservices orchestration, and streaming data processing and transformation. Faster: greater than 100K state transitions per second
  18. Which one is right for my customer’s use case? Standard

    Workflows • IT automation • report generation • order processing • payment and billing processing • machine learning model training • ELT and big data orchestration (AWS Glue, Amazon EMR) • media processing (video, images, audio) Express Workflows • event driven microservices orchestration • high volume data processing • IoT data ingestion • order / cart validation • payment reconciliation
  19. Which one is right for my customer’s use case? (cont'd)

    • Sometimes the answer will be both • Express Workflows can be nested within a Standard Workflow, enabling customers to use Express Workflows for short periods of task execution and a Standard Workflow for long periods of task execution or waiting Start End Validate Image Rekognition Thumbnail Add tags Store Metadata Approval notification Approval received
  20. Standard vs. Express Workflows Standard Express Console Step Functions Step

    Functions State Machine Definition Amazon States Language Amazon States Language Documentation Step Functions Step Functions
  21. Standard vs. Express Workflows (cont'd) Standard Express Maximum duration 365

    days 5 minutes Start execution refill rate 300 per second 6,000 per second State transition refill rate 1300 per second None Execution semantics Exactly-once workflows step execution At-least-once workflow step execution
  22. Standard vs. Express Workflows (cont'd) Standard Express Executions Executions are

    persisted and have ARNs Executions are not persisted except as log data Execution history Stored in Step Function, with tooling for visual debugging in the console Sent to CloudWatch Logs State transition default limits 1300 per second There is no limit Service Integrations Supports all service integrations and activities. Supports all service integrations. Does not support activities. Patterns Supports all patterns Does not support Job-run (.sync) or Callback (.wait For Callback).
  23. AWS Lambda Destinations Designate an asynchronous target for Lambda function

    invocation results. You can set one destination for a success, and another for a failure. This unlocks really useful patterns for distributed event-based applications and can reduce code to send function results to a destination manually.
  24. Amazon EventBridge Event source SaaS event bus Custom event bus

    Default event bus Rules AWS Lambda Amazon Kinesis AWS Step Functions Additional targets
  25. Amazon EventBridge Schema Registry PREVIEW Store event structure - or

    schema - in a shared central location, so it’s faster and easier to find the events you need. Generate code bindings right in your IDE to represent an event as an object in code.
  26. Amazon EventBridge Schemas (Preview) • Write event-driven code with the

    same ease as defining APIs • Central schema registry • Discover new schemas automatically once published to your event bus. • Search for schemas directly from VS Code and IntelliJ. • Strongly typed bindings allow you to treat events as objects. Library: v1.0.6 Code of components is the truth Wireframes are not redlines unless specifically stated feedback: [email protected] Search all schemas 5 versions AWS-EC2-EBSVolumeNotification AWS event schema Last updated 13:15 PST Jun 23, 2019 [#] versions [Schema name - link to the latest version] [Schema registry] Last updated 00:00 [time zone] [date] [#] versions [Schema name - link to the latest version] [Schema registry] Last updated 00:00 [time zone] [date] [#] versions [Schema name - link to the latest version] [Schema registry] Last updated 00:00 [time zone] [date] [#] versions [Schema name - link to the latest version] [Schema registry] Last updated 00:00 [time zone] [date] [#] versions [Schema name - link to the latest version] [Schema registry] Last updated 00:00 [time zone] [date] [#] versions [Schema name - link to the latest version] [Schema registry] Last updated 00:00 [time zone] [date] 45 versions AWS-CodeBuild-BuildStateChange Discovered schema Last updated 13:15 PST Jun 23, 2019 version 1 Am-on-call-update-notification Custom schema Last updated 13:15 PST Jun 23, 2019 1 2 All schemas AWS event schema registry Info Discovered schema registry Info my-org-custom-schema- registry Schemas Event discoery Event discoery EventBridge EventBridge Schemas [A schema is … Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur. A schema registry is… Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat.] Create custom schema Create custom registry Select all schemas or a registry Documentation Event buses Events Rules Partner event sources Schemas Schema discovery Dashboard EventBridge Feedback Feedback English English © 2008 - 2016, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2008 - 2016, Amazon Web Services, Inc. or its affiliates. All rights reserved. Privacy Policy Privacy Policy Terms of Use Terms of Use Schemas Library: v1.0.6 Code of components is the truth Wireframes are not redlines unless specifically stated feedback: [email protected] [schema-name… … … ……] Edit description Delete schema (all versions) Schema details Lorem ipsum dolor sit amdhet sed, consectetur adipiscing elit. Mauris a nisl cursus, imperdiet. Description [schema-name… … … … … … .. .] Schema name 3 Number of Versions [Event type … … … …] Event type arn:schemas:48569308563781:schema/events/ticketstatuschangecall Schema ARN 10:27 PST, Sep 27, 2019 Last modified on [custom registry] Schema registry Created on 10:27 PST, Sep 27, 2019 "properties": { "source": { "$id": "#/properties/source", "type": "array", "title": "The Source Schema", "items": { "$id": "#/properties/source/items", "type": "string", "title": "The Items Schema", "default": "", "examples": [ "aws.events”z24], "pattern": "^(.*)$" } }, "detail-type": {…}, "detail": {…}, } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Action Delete schema version 3 Download schema (version 3) Save as new version Download code binding Version 3 Manage tags Tags (2) Value Key [value] [key-value] [value] [key-value] [Schema name] [Schema registry] [Schema registry] Schemas Schemas Event discovery Event discovery EventBridge EventBridge version 3 Documentation Event buses Events Rules Partner event sources Schemas Schema discovery Dashboard EventBridge Schemas Feedback Feedback English English © 2008 - 2016, Amazon Web Services, Inc. or its affiliates. All rights reserved. © 2008 - 2016, Amazon Web Services, Inc. or its affiliates. All rights reserved. Privacy Policy Privacy Policy Terms of Use Terms of Use Schemas All schemas (69) aws.events schema registry (33) Discovered schema registry(24) aws.s3 (3) Recently used schemas (9) Schema template My custom schema registry-1 (12) aws.s3.aws_api_call_via_cl aws.s3.ec2_instance-launc aws.s3.ec2_instance-termi aws.sns (22) aws.ec2 (8)
  27. CloudWatch Embedded Metrics Format • Embed custom metrics alongside detailed

    log event data, and CloudWatch will automatically extract the custom metrics so you can visualize and alarm on them, for real-time incident detection • Open-source client libraries available for Node.js and Python
  28. Amazon RDS Proxy PREVIEW Fully managed, highly available database proxy

    feature for Amazon RDS. Pools and shares DB connections to make applications more scalable, more resilient to database failures, and more secure. Pool and share app scaling availability DB failover times data security access controls Fully managed compatible
  29. Helpful links to learn more about serverless AWS Compute blog

    https://aws.amazon.com/blogs/compute/ AWS Mobile blog https://aws.amazon.com/blogs/mobile/ More information about serverless features released at re:Invent https://aws.amazon.com/blogs/compute/icymi-serverless-reinvent- recap-2019/
  30. Thank you! © 2019, Amazon Web Services, Inc. or its

    affiliates. All rights reserved. Marek Kuczynski @marekq