The Art of Product Building Series
Session 4: Deployment
Building Evolable System on AWS
Dhaval Nagar
● 12x AWS Certified
● AWS User Group Leader - Surat
● AWS Serverless Hero (since 2020)
● AWS Certification SME - Associate
● Founder @ AppGambit - AWS Consulting Partner
I am..
● Why use Cloud
● What’s inside Amazon Web Services
● Use cases
● Design Evolable Systems
● Summary
Agenda
Why use Cloud - Startups and Cloud
Launch
MVP Faster
Focus on
Feature Engineering
Iterate Quickly
Fail Fast
Keep Cost
Minimum
AWS is the leader in the Cloud
Infrastructure and Platform Services as
per the Gartner Magic Quadrant 2020.
Some of the most popular services on
AWS are:
● RDS and Aurora for Database
● DynamoDB for NoSQL Database
● Lambda for Serverless Computing
● S3 for Data Storage and Hosting
● SageMaker for Machine Learning
● And many more...
Why use AWS
What’s inside Amazon Web Services
Before we jump on AWS
With More Power comes More
Responsibilities
AWS is quite vast, but focus on What you Need
Take a simple example of Amazon EC2 Instances
● Charge for Per Second depending on your Configurations
○ Instance Family
○ Number of CPU
○ Amount of RAM
● Charge for Allocated Disk Size and Type
○ Size of Disk in GBs
○ HDD vs SSD
● Charge for Data Transfer
○ Data Transfer IN is FREE
○ Data Transfer OUT is NOT
https://blog.floydhub.com/aws-cost-optimization-for-ml-infra-ec2/
● Growing a system in a natural way,
● By adding the minimum amount of code to satisfy the business needs
● In an iterative and incremental approach.
When done right, the code structure changes continuously to optimize for
change, thus allowing a constant speed of development for longer periods of
time.
Evolutionary Design is the practice of
● Growing a system in a natural way,
● By adding the minimum amount of code to satisfy the business needs
● In an iterative and incremental approach.
When done right, the code structure changes continuously to optimize for
change, thus allowing a constant speed of development for longer periods of
time.
Evolutionary Design is the practice of
Own Less, Build More
● Use the Right Service with Right Configurations
○ Do you need Virtual Machines running 24x7!!
○ Do you need 100gb of Disk space to start with!!
● Don’t Reinvent the wheel
○ Don’t code for every feature
○ Outsource undifferentiated heavy-lifting
● Always Monitor your Cost and Usage
○ Think like a Startup
○ Experiment and Learn
https://acloudguru.com/blog/engineering/aws-lambda-is-winning-but-first-it-had-to-die
Monitor your Spending, Utilize Free Tier
AWS Budget Console
AWS Free Tier
Let’s explore your Problem Statements and see
what all we can do in the AWS Cloud.
Talk is Cheap
Web Apps on AWS
Normal Web Application needs...
● Web Server
● Application Server
● Authentication
● Database
● Storage
● Outbound Communication
* Many of these are applicable to non-web applications as well.
Normal Web Application needs...
Required
● Web Server
● Application Server
● Authentication
● Database
● Storage
● Outbound Communication
Optional
● Security
● Scaling
● High Availability
● Cost effective
AWS Web Application
Amazon S3
Web Server
Amazon EC2
● Need virtual machine for
HTML/CSS/JS?
● Data Transfer Out is PAID
● Additional ops like OS task, libraries,
security, change rollout, etc
● Supports static web hosting
● Highly scalable
● Serverless and Cost-effective
● No additional maintenance
● Can also host Images, Videos, Audios,
etc
AWS Web Application
Application Server
Amazon EC2
● Need virtual machine 24x7?
● What kind of configuration required?
● What happens if usage increases or
no usage at all!
● Additional ops like OS task, libraries,
security, change rollout, etc
● API Gateway and Lambda both are
event-driven and serverless
● Both can scale from 0 to thousands
without any additional effort
● No additional maintenance
● API Gateway supports HTTP, REST
and Web Socket
● Lambda supports Nodejs, Python,
Ruby, Java, Go, C#, and Containers
API Gateway AWS Lambda
AWS Web Application
Amazon Cognito
User Authentication
Custom Code
● Why should we write the User
Authentication logic at all!!!
● Fully-managed User Authentication
Service
● Signup, Sign In, MFA, Password
policy, etc
● 50K Active Monthly Users are FREE
● UI can be customized
● Supports Event Triggers to run
custom code with Lambda functions
AWS Web Application
Amazon RDS
Database
Amazon EC2
● Install and maintain the database in
virtual machine
● Configuration dilemma, CPU, RAM,
Storage!!!
● Cost for 24x7
● Who will manage Backup,
Monitoring, Scaling and Security?
● SQL Database Services
● RDS and Aurora both are managed
services
● Can scale horizontally and vertically
with minimal effort
● Backup, Monitoring and Security
features are Built-in
● These are charged for 24x7
Amazon Aurora
AWS Web Application
Amazon RDS
Serverless vs Managed Database
Amazon DynamoDB
● DynamoDB is serverless NoSQL
Database
● Pay only for Storage and Query
● Scale from 0 to Petabytes in storage
● Aurora Serverless is a serverless SQL
database
● Designed for infrequent access
● SQL Database Services
● RDS and Aurora both are managed
services
● Can scale horizontally and vertically
with minimal effort
● Backup, Monitoring and Security
features are Built-in
Amazon Aurora
Amazon Aurora
Serverless
AWS Web Application
Amazon S3
File Storage
Amazon EC2 Disk
● VM attached storage is good for
frequent read/write
● Manual ops to manage scaling,
unwanted files, backup, etc
● Can’t access directly, need compute
to access the stored files
● Fully-managed, Serverless, Scalable,
Web Storage service
● Supports different tiers to align the
storage based on the requirements
● Security and Access can be tailored
based on the requirements
AWS Web Application Architecture
AWS Web Application Architecture
How can this Architecture Evolve!!
WITH OWN LESS AND BUILD MORE
Everything is Event-Driven
Events are “distributed” and “consumed”
Event-Driven Architecture
In Event-Driven Architecture events are emitted and consumed. Almost all of
the AWS services emit events:
● Amazon Cognito can emit Auth-related Events
● API Gateway can emit HTTP request events
● Lambda can emit Success/Failure events
● S3 can emit file operation events
● DynamoDB can emit the record operation events
What about Optional targets
● Security
○ Managed / Serverless services has limited accessibility
○ You can’t SSH into Lambda, API Gateway or S3
● Scaling
○ Serverless natively comes with Auto Scaling
● High Availability
○ Serverless services are designed for high availability
● Cost effective
○ Serverless follows Pay for Consumption model
○ Pay for API Calls
○ Pay for Lambda execution time per request
○ Pay for Storage used
Mobile App Backend Architecture
Mobile App Backend Architecture
IoT App Architecture | iRobot Roomba
https://aws.amazon.com/solutions/case-studies/irobot-iot/
IoT App Architecture | iRobot Roomba
https://aws.amazon.com/solutions/case-studies/irobot-iot/
How to Monitor if Everything is Serverless
● Managed or Serverless services are designed with abstraction
● Little or no visibility of the underlying infrastructure
● AWS provides other services like CloudWatch to check what is going on
inside these services and how our code runs
Amazon CloudWatch
Alarm Rule Event
(time-based)
Event
(event-based)
Logs
How to Control if Everything is Distributed
● Building and linking functions are EASY, controlling these functions at scale
is HARD
● AWS Step Functions helps to orchestrate a controlling logic to run and
monitor the execution flow
Let’s see a fully Serverless Web App that helps to Store Files Securely
Demo
https://github.com/AppGambitStudio/serverless-docs
● Use Serverless Framework or SAM for Serverless Application Development
● Use CodeCommit, CodeBuild and CodePipeline for the CI/CD
● Use CloudWatch for Logging and Monitoring
● Use X-Ray for tracing errors and performance issues
● Use AWS Budgets to configure expected budgets and alerts
AWS Dev Tools
● AWS has service(s) for every possible use case
● Cloud is powerful but use it wisely and only as much as you need
● Own less and Build more
● Serverless technologies are mature and powerful now
● Event-driven systems can “evolve” easily
● Experiment and Learn
Wrap Up
No server is easier to manage than “no server”
- Werner Vogels, Amazon.com CTO
● Serverless Application Architecture
https://docs.aws.amazon.com/whitepapers/latest/serverless-multi-tier-architectures-
api-gateway-lambda/welcome.html
● iRobot Case Study https://aws.amazon.com/solutions/case-studies/irobot-iot/
● SQQUID 100% Serverless Case Study
https://www.serverless.com/blog/sqquid-one-hundred-percent-serverless
● Building An Infinitely Scalable Online Recording Campaign For David Guetta & UEFA
https://www.serverless.com/blog/introducing-serverless-partners-meet-parallax
● Serverless Examples by Use case
https://www.simform.com/serverless-examples-aws-lambda-use-cases/
Other references
Thank You!
Coming up next week...
Session 5
Measure & Iterate
focus, focus, focus—and focus specifically on the single thing
you’re going to be better at than everyone else.
That is your competitive edge. Build a great product, listen to
users, and repeat.
Outsource everything else - especially your infrastructure.
https://increment.com/cloud/why-startups-should-run-on-cloud-providers/
The takeaway is...

Crio.do - Deployment on AWS Masterclass

  • 2.
    The Art ofProduct Building Series
  • 3.
    Session 4: Deployment BuildingEvolable System on AWS Dhaval Nagar
  • 4.
    ● 12x AWSCertified ● AWS User Group Leader - Surat ● AWS Serverless Hero (since 2020) ● AWS Certification SME - Associate ● Founder @ AppGambit - AWS Consulting Partner I am..
  • 5.
    ● Why useCloud ● What’s inside Amazon Web Services ● Use cases ● Design Evolable Systems ● Summary Agenda
  • 6.
    Why use Cloud- Startups and Cloud Launch MVP Faster Focus on Feature Engineering Iterate Quickly Fail Fast Keep Cost Minimum
  • 7.
    AWS is theleader in the Cloud Infrastructure and Platform Services as per the Gartner Magic Quadrant 2020. Some of the most popular services on AWS are: ● RDS and Aurora for Database ● DynamoDB for NoSQL Database ● Lambda for Serverless Computing ● S3 for Data Storage and Hosting ● SageMaker for Machine Learning ● And many more... Why use AWS
  • 8.
  • 9.
    Before we jumpon AWS With More Power comes More Responsibilities
  • 10.
    AWS is quitevast, but focus on What you Need Take a simple example of Amazon EC2 Instances ● Charge for Per Second depending on your Configurations ○ Instance Family ○ Number of CPU ○ Amount of RAM ● Charge for Allocated Disk Size and Type ○ Size of Disk in GBs ○ HDD vs SSD ● Charge for Data Transfer ○ Data Transfer IN is FREE ○ Data Transfer OUT is NOT
  • 11.
  • 12.
    ● Growing asystem in a natural way, ● By adding the minimum amount of code to satisfy the business needs ● In an iterative and incremental approach. When done right, the code structure changes continuously to optimize for change, thus allowing a constant speed of development for longer periods of time. Evolutionary Design is the practice of
  • 13.
    ● Growing asystem in a natural way, ● By adding the minimum amount of code to satisfy the business needs ● In an iterative and incremental approach. When done right, the code structure changes continuously to optimize for change, thus allowing a constant speed of development for longer periods of time. Evolutionary Design is the practice of
  • 14.
    Own Less, BuildMore ● Use the Right Service with Right Configurations ○ Do you need Virtual Machines running 24x7!! ○ Do you need 100gb of Disk space to start with!! ● Don’t Reinvent the wheel ○ Don’t code for every feature ○ Outsource undifferentiated heavy-lifting ● Always Monitor your Cost and Usage ○ Think like a Startup ○ Experiment and Learn https://acloudguru.com/blog/engineering/aws-lambda-is-winning-but-first-it-had-to-die
  • 15.
    Monitor your Spending,Utilize Free Tier AWS Budget Console AWS Free Tier
  • 16.
    Let’s explore yourProblem Statements and see what all we can do in the AWS Cloud. Talk is Cheap
  • 17.
  • 18.
    Normal Web Applicationneeds... ● Web Server ● Application Server ● Authentication ● Database ● Storage ● Outbound Communication * Many of these are applicable to non-web applications as well.
  • 19.
    Normal Web Applicationneeds... Required ● Web Server ● Application Server ● Authentication ● Database ● Storage ● Outbound Communication Optional ● Security ● Scaling ● High Availability ● Cost effective
  • 20.
    AWS Web Application AmazonS3 Web Server Amazon EC2 ● Need virtual machine for HTML/CSS/JS? ● Data Transfer Out is PAID ● Additional ops like OS task, libraries, security, change rollout, etc ● Supports static web hosting ● Highly scalable ● Serverless and Cost-effective ● No additional maintenance ● Can also host Images, Videos, Audios, etc
  • 21.
    AWS Web Application ApplicationServer Amazon EC2 ● Need virtual machine 24x7? ● What kind of configuration required? ● What happens if usage increases or no usage at all! ● Additional ops like OS task, libraries, security, change rollout, etc ● API Gateway and Lambda both are event-driven and serverless ● Both can scale from 0 to thousands without any additional effort ● No additional maintenance ● API Gateway supports HTTP, REST and Web Socket ● Lambda supports Nodejs, Python, Ruby, Java, Go, C#, and Containers API Gateway AWS Lambda
  • 22.
    AWS Web Application AmazonCognito User Authentication Custom Code ● Why should we write the User Authentication logic at all!!! ● Fully-managed User Authentication Service ● Signup, Sign In, MFA, Password policy, etc ● 50K Active Monthly Users are FREE ● UI can be customized ● Supports Event Triggers to run custom code with Lambda functions
  • 23.
    AWS Web Application AmazonRDS Database Amazon EC2 ● Install and maintain the database in virtual machine ● Configuration dilemma, CPU, RAM, Storage!!! ● Cost for 24x7 ● Who will manage Backup, Monitoring, Scaling and Security? ● SQL Database Services ● RDS and Aurora both are managed services ● Can scale horizontally and vertically with minimal effort ● Backup, Monitoring and Security features are Built-in ● These are charged for 24x7 Amazon Aurora
  • 24.
    AWS Web Application AmazonRDS Serverless vs Managed Database Amazon DynamoDB ● DynamoDB is serverless NoSQL Database ● Pay only for Storage and Query ● Scale from 0 to Petabytes in storage ● Aurora Serverless is a serverless SQL database ● Designed for infrequent access ● SQL Database Services ● RDS and Aurora both are managed services ● Can scale horizontally and vertically with minimal effort ● Backup, Monitoring and Security features are Built-in Amazon Aurora Amazon Aurora Serverless
  • 25.
    AWS Web Application AmazonS3 File Storage Amazon EC2 Disk ● VM attached storage is good for frequent read/write ● Manual ops to manage scaling, unwanted files, backup, etc ● Can’t access directly, need compute to access the stored files ● Fully-managed, Serverless, Scalable, Web Storage service ● Supports different tiers to align the storage based on the requirements ● Security and Access can be tailored based on the requirements
  • 26.
    AWS Web ApplicationArchitecture
  • 27.
    AWS Web ApplicationArchitecture
  • 28.
    How can thisArchitecture Evolve!! WITH OWN LESS AND BUILD MORE
  • 29.
  • 30.
    Events are “distributed”and “consumed”
  • 31.
    Event-Driven Architecture In Event-DrivenArchitecture events are emitted and consumed. Almost all of the AWS services emit events: ● Amazon Cognito can emit Auth-related Events ● API Gateway can emit HTTP request events ● Lambda can emit Success/Failure events ● S3 can emit file operation events ● DynamoDB can emit the record operation events
  • 32.
    What about Optionaltargets ● Security ○ Managed / Serverless services has limited accessibility ○ You can’t SSH into Lambda, API Gateway or S3 ● Scaling ○ Serverless natively comes with Auto Scaling ● High Availability ○ Serverless services are designed for high availability ● Cost effective ○ Serverless follows Pay for Consumption model ○ Pay for API Calls ○ Pay for Lambda execution time per request ○ Pay for Storage used
  • 33.
    Mobile App BackendArchitecture
  • 34.
    Mobile App BackendArchitecture
  • 35.
    IoT App Architecture| iRobot Roomba https://aws.amazon.com/solutions/case-studies/irobot-iot/
  • 36.
    IoT App Architecture| iRobot Roomba https://aws.amazon.com/solutions/case-studies/irobot-iot/
  • 37.
    How to Monitorif Everything is Serverless ● Managed or Serverless services are designed with abstraction ● Little or no visibility of the underlying infrastructure ● AWS provides other services like CloudWatch to check what is going on inside these services and how our code runs Amazon CloudWatch Alarm Rule Event (time-based) Event (event-based) Logs
  • 38.
    How to Controlif Everything is Distributed ● Building and linking functions are EASY, controlling these functions at scale is HARD ● AWS Step Functions helps to orchestrate a controlling logic to run and monitor the execution flow
  • 40.
    Let’s see afully Serverless Web App that helps to Store Files Securely Demo https://github.com/AppGambitStudio/serverless-docs
  • 41.
    ● Use ServerlessFramework or SAM for Serverless Application Development ● Use CodeCommit, CodeBuild and CodePipeline for the CI/CD ● Use CloudWatch for Logging and Monitoring ● Use X-Ray for tracing errors and performance issues ● Use AWS Budgets to configure expected budgets and alerts AWS Dev Tools
  • 42.
    ● AWS hasservice(s) for every possible use case ● Cloud is powerful but use it wisely and only as much as you need ● Own less and Build more ● Serverless technologies are mature and powerful now ● Event-driven systems can “evolve” easily ● Experiment and Learn Wrap Up No server is easier to manage than “no server” - Werner Vogels, Amazon.com CTO
  • 43.
    ● Serverless ApplicationArchitecture https://docs.aws.amazon.com/whitepapers/latest/serverless-multi-tier-architectures- api-gateway-lambda/welcome.html ● iRobot Case Study https://aws.amazon.com/solutions/case-studies/irobot-iot/ ● SQQUID 100% Serverless Case Study https://www.serverless.com/blog/sqquid-one-hundred-percent-serverless ● Building An Infinitely Scalable Online Recording Campaign For David Guetta & UEFA https://www.serverless.com/blog/introducing-serverless-partners-meet-parallax ● Serverless Examples by Use case https://www.simform.com/serverless-examples-aws-lambda-use-cases/ Other references
  • 44.
  • 45.
    Coming up nextweek... Session 5 Measure & Iterate
  • 46.
    focus, focus, focus—andfocus specifically on the single thing you’re going to be better at than everyone else. That is your competitive edge. Build a great product, listen to users, and repeat. Outsource everything else - especially your infrastructure. https://increment.com/cloud/why-startups-should-run-on-cloud-providers/ The takeaway is...