Leveraging Serverless in Fullstack
Total Page:16
File Type:pdf, Size:1020Kb
Leveraging serverless in full-stack development Eric Johnson – Sr. Developer Advocate – Serverless, AWS @edjgeek © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Who am I? • @edjgeek • Husband and father of 5 • Senior Developer Advocate – Serverless, AWS • Serverless tooling and automation nerd • Solutions & software architect (> 25 years) • Music lover • Pizza lover (without pineapple) • Pusher of #ServerlessForEveryone © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Application architecture journey © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The single server architecture Proxy/Firewall: NGINX, Apache, F5, Zeus Server: IIS, Apache, Tomcat Many application architectures Code: Node, .Net, Ruby, Java, start here. Go, Python Database: SQL, MySQL, PostgreSQL, Mongo, Cassandra © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The tiered architecture Proxy/Firewall We then break applications into tiers based Server on functionality. Database © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The tiered architecture Proxy/Firewall Even Client separating the client and backend. Backend Database © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The redundant tiered architecture Proxy/Firewall Client load balancer As applications Client scale, we build in redundancy. Backend load balancer Backend Database © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The “more” redundant tiered architecture © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The “more” redundant tiered architecture More redundant, more infrastructure, more management, more cost. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The containers architecture Proxy/Firewall But what about containers? Client Backend Database © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The “more” redundant containers architecture Proxy/Firewall Load balancer Client Backend Database © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The “more” redundant containers architecture Proxy/Firewall More redundant, Load balancer more infrastructure, more management, Client more cost. Backend Database © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to the cloud AWS Cloud VPC Availability Zone Availability Zone Application Load Balancer Client Auto Scaling group Instance(s) Instance(s) Application Load Balancer Backend Auto Scaling group Instance(s) Instance(s) Amazon RDS Amazon RDS © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving containers to the cloud AWS Cloud VPC Availability Zone Availability Zone Application Load Balancer Application Auto Scaling group Amazon Elastic Amazon Elastic Container Service Container Service Amazon RDS Amazon RDS © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving containers to the cloud AWS Cloud VPC Availability Zone Availability Zone Application Load Balancer Application Auto Scaling group Moving to the cloud offers sophisticated automation and tooling Amazon Elasticto help manage scaling and redundancy.Amazon Elastic Container Service Container Service Amazon RDS Amazon RDS © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving containers to the cloud AWS Cloud VPC Availability Zone Availability Zone Application Load Balancer Application Auto Scaling group Amazon Elastic But… Amazon Elastic Container Service Container Service Amazon RDS Amazon RDS © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving containers to the cloud AWS Cloud VPC Availability Zone Availability Zone Application Load Balancer Application Auto Scaling group There is still infrastructure to manage and pay for. Amazon Elastic Amazon Elastic Container Service Container Service Amazon RDS Amazon RDS © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Hello serverless! © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What is serverless? No infrastructure provisioning, Automatic scaling no management Pay for value Highly available and secure © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless applications Event source Function Services Changes in Node.js data state Python Java Requests to C# endpoints Go Ruby Runtime API Changes in Resource state © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Common AWS Lambda use cases Web Apps Backends Data Chatbots Amazon Alexa IT Automation Processing • Static • Apps & • Real time • Powering • Powering • Policy engines websites services • MapReduce chatbot logic voice- • Extending AWS enabled apps • Complex • Mobile • Batch services web apps • IoT • Alexa Skills • Infrastructure • Packages Kit management for Flask and Express © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Common AWS Lambda use cases I will be spending Web Apps Backends Data mostChatbots of the timeAmazon in the Alexa IT Automation Processing Web Apps and • Static • Apps & • Real time • PoweringBackend area.• Powering • Policy engines websites services • MapReduce chatbot logic voice- • Extending AWS enabled apps • Complex • Mobile • Batch services web apps • IoT • Alexa Skills • Infrastructure • Packages Kit management for Flask and Express © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless in full-stack development? © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – client Assumption: Client is separate from backend. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – client Assumption: Client is separate from backend. If not, don’t worry, I’ll cover that too. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – client Amazon Simple Storage Service • Hosting for http and https • Object versioning • Bucket policy, ACL, and IAM security controls. • 99.999999999% (11 9s) data durability • Custom domains • Domain redirects © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – client Amazon S3 Lambda@edge AWS Amplify Console • Powered by Lambda@edge and Amazon S3 • CI/CD • Build configurations • Feature branch deployments • Global availability (CDN) • Basic password protection © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – API The proxy/firewall now points directly at the backend. © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – API Amazon API Gateway • Load balancing and redundancy built in • REST, WebSocket • 10k+ requests per second (soft limit) • Private, regional or global options • Application authentication and authorization • SSL offloading • Custom domains • API user keys and throttling • Data validation • Resource Policy, IAM security © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – compute AWS Lambda • Supports Node, Python, Go, Ruby, Java, and .NetCore natively • Custom runtime for all other languages • Triggered by many internal and external events • 1k concurrent invocations (soft limit) • Triggered synchronously and asynchronously © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – database Amazon Amazon Amazon Aurora DocumentDB (with DynamoDB MongoDB compatibility) Amazon Amazon RDS Amazon Quantum Redshift Ledger Database Amazon Amazon Neptune Timestream © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – database Amazon Amazon Amazon Aurora DocumentDB (with DynamoDB MongoDB compatibility) In a web stack, these are the most common database options Amazon Amazon RDS Amazon Quantum Redshift Ledger Database Amazon Amazon Neptune Timestream © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Moving to serverless – database Relational Databases NoSQL Databases Amazon Aurora Amazon RDS Amazon Amazon Serverless DynamoDB DocumentDB • Serverless • Simple scaling • Serverless • Highly redundant • Highly redundant • Engine native • Highly redundant • Highly available • Highly available replication • Highly available • MongoDB • Auto scaling • Microsoft SQL • Global tables Compatible • PostgreSQL • MySQL • High input and • MySQL • PostgreSQL output • MariaDB • Oracle © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Putting it all together © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A basic website AWS Cloud Users Amazon API Lambda Amazon Gateway function DynamoDB Table Amazon Amazon RDS Proxy Aurora © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A basic website AWS Cloud HTML can be rendered by the Lambda function and returned to the user. Users Amazon API Lambda Amazon Gateway function DynamoDB Table Amazon Amazon RDS Proxy Aurora © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A basic website AWS Cloud Users Amazon API Lambda Amazon Gateway function DynamoDB Table Pools and shares connections established with the relational database Amazon Amazon RDS Proxy Aurora © 2020, Amazon Web Services, Inc. or its Affiliates. All rights reserved. A basic website AWS Cloud Users Amazon