Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Building a web application without servers

  • Sé el primero en comentar

  • Sé el primero en recomendar esto

Building a web application without servers

  1. 1. © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Building a web application without servers Raymond Lai Solutions Architect raymlai@amazon.com
  2. 2. Running servers makes me sad Photo by Justin Veenema
  3. 3. <start> It’s easier than ever to build web applications that are: • Massively scalable • Highly available and fault-tolerant • Easily secured • Cost-aligned with usage Without: • Managing a single server or container orchestration system • Patching operating systems • Monitoring operating system metrics to control scaling
  4. 4. How?
  5. 5. With serverless No infrastructure provisioning, no management Automatic scaling Pay for value Highly available and secure
  6. 6. Exploring a basic web application technology stack InternetMobile/ Web apps ?Frontend ?Backend ?Database
  7. 7. Exploring a basic web application technology stack InternetMobile/ Web apps ?Backend ?Database ?Frontend
  8. 8. Frontend servers • Serve mostly static contents • HTML • CSS • JavaScript • Image, video, etc. • Might generate dynamic contents with languages like PHP • Reactive Web Framework • Non-blocking and event-driven applications • Using declarative approach • With interface library and data request capabilities • Easier to support multiple platforms PastPresent
  9. 9. Two options for serverless hosting of static content Roll your own with Amazon Simple Storage Service (Amazon S3) Amazon S3 AWS Amplify CLI & Amplify Console AWS Amplify
  10. 10. Amazon S3 Amazon S3 • Can host static websites • Supports fine-grained permission control • Acts as a logging endpoint for Web services • Supports encryption at transit and at rest • Lifecycle capabilities to rotate data across tiers and even delete them if needed Amazon CloudFront • Cache static content at the edge for faster delivery • Dynamic and static content • Custom SSL certificates • Low TTLs (as short as 0 seconds) Responsetime Serverload Response time Server load Response time Server load No CDN CDN for static content CDN for static and dynamic content
  11. 11. AWS Amplify makes it easy to create, configure, and implement scalable mobile and web apps powered by AWS • Framework • Cloudservices • Developertools • Continuousdeployment • Hosting
  12. 12. AWS Amplify Step 1: “amplify init”
  13. 13. AWS Amplify Step 2: “amplify add hosting” & define repository
  14. 14. AWS Amplify Hosting for static web applications • Integrated with Git • Built-in CI/CD workflows (supports Git branches) • Host a friendly URL with CDN • Support for auth controls • Built-in rewrites and redirects of URL • Deploy SPA with popular frontend frameworks such as Vue, Angular, and React AWS Amplify
  15. 15. InternetMobile/Web apps Exploring a basic web application technology stack ?Backend ?DatabaseAWS Amplify
  16. 16. AWS Amplify Exploring a basic web application technology stack ?InternetMobile/Web apps ?Database ?Backend
  17. 17. APIs are the front door of modern applications
  18. 18. To put it simply: Amazon API Gateway makes it easy to host serverless APIs
  19. 19. Amazon API Gateway: Types of APIs Amazon API Gateway API Gateway cache Amazon CloudWatch monitoring Fully managed CloudFront distribution Edge-optimizedRegionalPrivate Edge-optimized • Utilizes CloudFront to reduce TLS connection overhead (reduces roundtrip time) • Designed for a globally distributed set of clients Regional • Recommended API type for general use cases • Designed for building APIs for clients in the same region Private • Only accessible from within VPC (and networks connected to VPC) • Designed for building APIs used internally or by private microservices AWS Lambda functions Any other AWS service
  20. 20. Secure with your Amazon API Gateway Several mechanisms for adding authorization/authentication and restricting API access • IAM permissions – use IAM policies and AWS credentials to grant access • Lambda authorizers – use Lambda to validate a bearer token (e.g., OAuth or SAML) or request parameters and grant access • Amazon Cognito user pools – create a completely managed user management system • Resource policies – can restrict based on IP, VPC, and AWS Account ID
  21. 21. AWS Amplify InternetMobile/Web apps Exploring a basic web application technology stack ?DatabaseAmazon API Gateway ?
  22. 22. Event-driven compute Functions as a service Serverless FaaS AWS Lambda
  23. 23. Serverless applications Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Function Node.js Python Java C# Go Ruby Runtime API Serverless applications Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Function Node.js Python Java C# Go Ruby Runtime API Serverless applications Services (anything) Changes in data state Requests to endpoints Changes in resource state Event source Function Node.js Python Java C# Go Ruby Runtime API
  24. 24. Lambda execution model Synchronous (push) Asynchronous (event) Stream (poll-based) /order Amazon API Gateway Lambda function Amazon DynamoDB Amazon Kinesis changes AWS Lambda service Lambda function Amazon SNS Amazon S3 reqs Lambda function
  25. 25. Smart resource allocation Stats for Lambda function that calculates 1000 times all prime numbers <= 1000000 128 MB 11.722965 sec $0.024628 256 MB 6.678945 sec $0.028035 512 MB 3.194954 sec $0.026830 1024 MB 1.465984 sec $0.024638 Best Worst Lambda exposes only a memory control, with the % of CPU core and network capacity allocated to a function proportionally Match resource allocation (up to 3 GB) to logic
  26. 26. Lambda permissions model Function policies • “Actions on bucket X can invoke Lambda function Z" • Resource policies allow for cross-account access • Used for sync and async invocations Execution role • “Lambda function A can read from DynamoDB table users” • Define what AWS resources / API calls this function can access via IAM • Used in streaming invocations Event source ServicesFunction
  27. 27. AWS Amplify InternetMobile/Web apps Exploring a basic web application technology stack ?DatabaseAmazon API Gateway AWS Lambda
  28. 28. Mobile/Web apps Internet AWS Amplify Exploring a basic web application technology stack Amazon API Gateway AWS Lambda ?Database
  29. 29. © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  30. 30. Common data categories Relational Key value Document In memory Graph Time series Ledger Aurora, RDS DynamoDB Amazon DocumentDB ElastiCache Neptune Timestream QLDBAWS Service(s)
  31. 31. Amazon DynamoDB Fast and flexible NoSQL database service for any scale Enterprise-ready ACID transactions Encryption at rest On-demand backup and restore Performance at scale Handles millions of requests per second Delivers microsecond latency Automated global replication Serverless Maintenance-free Auto scaling On-demand capacity mode
  32. 32. Why we choose DynamoDB? All Amazon database services have: • Easy scale controls + ability to handle massive scale • High availability and durability • Backup/restore capabilities • Billing options that can scale with your business need But in sticking with the theme of serverless, DynamoDB wins out: • Pay-for-what-you-use billing • Dynamic scaling without the need to preconfigure capacity Again, most of this will depend on what your use case is
  33. 33. AWS Amplify Exploring a basic web application technology stack Amazon API Gateway AWS Lambda Amazon DynamoDB Mobile/Web apps Internet
  34. 34. </end> By combining these services, we can build a completely serverless application stack • No servers to manage • Automatic scalability to handle most workloads • High availability and fault tolerance out of the box • Numerous security controls throughout the stack • Aligned costs to consumption
  35. 35. Thank you! © 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved. Raymond Lai raymlai@amazon.com

×