SlideShare a Scribd company logo
1 of 62
Your first multi-tier serverless
architecture on AWS
Jeshan G. Babooa
What you’ll learn about
What you’ll learn about
Host your first serverless webapp on AWS
What AWS services you’ll need for a multi-tier architecture
Automating the deployment
3-tier architecture
Public Domain, via Wikipedia
Where does this architecture come from?
Reference: https://d0.awsstatic.com/whitepapers/AWS_Serverless_Multi-Tier_Architectures.pdf
What can you build with this?
W3C [CC BY 3.0], via Wikimedia Commons
Presentation tier
W3C [CC BY 3.0], via Wikimedia Commons
Logic tier
API Gateway Lambda
Data tier
DynamoDB
WalkthroughStep-by-step
Data tier
Let’s use DynamoDB to set up our
table {
"completed": false,
"id": 1485277189149,
"title": "one"
}
Example TODO
Data tier
Let’s use DynamoDB to set up our
table
https://console.aws.amazon.com/dynamodb
Data tier
Click create table
Data tier
Use todo as table name and id of type
Number as primary key.
Logic tier
We will create our epic API with the
API gateway.
https://console.aws.amazon.com/apigateway/home
Logic tier
Choose an api name, e.g multi-tier:
Logic tier
An empty API will be created:
Logic tier
Now onto Lambda
https://console.aws.amazon.com/lambda
Logic tier
Choose the api name that you created
Logic tier
Enter a name. We’ll use a function
written in Node.js.
Logic tier
Paste the code available on github
https://github.com/jeshan/lambdatv/blob/master/multi-tier-
architecture-todomvc/aws/index.js
Logic tier
The service’s main logic is found in the
exports.handler function. We use
exports.handler to tell Lambda that
this is the lambda function we want to
run.
Logic tier
I put the logic in a switch statement
where each case corresponds to one
of the CRUD operations:
Logic tier
Create a role with the name multi-tier
or use an existing one. You’ll need the
"Simple Microservice permissions" to
be able to write to DynamoDB tables.
Logic tier
Click create function
Logic tier
https://pa71qoosib.execute-api.eu-west-
1.amazonaws.com/prod/multi-tier
Our API and Lambda function is
available as shown in the screenshot:
Logic tier
We need an additional permission...
Logic tier
Let’s add the permission quickly using
the Identify and Access Management
console.
https://console.aws.amazon.com/iam/home#/roles/multi-tier
Logic tier
Add the DynamoDB Full Access policy:
Logic tier
The policy should appear as shown
after saving:
Logic tier
Select the API, then the resource and
then Enable CORS:
Logic tier
Then deploy it on the same stage that
was created before, i.e prod:
Logic tier
Choose the prod stage and then click
deploy
Presentation tier
https://pa71qoosib.execute-api.eu-west-
1.amazonaws.com/prod/multi-tier
Edit this file:
https://github.com/jeshan/lambdatv/blob/master/multi-tier-
architecture-todomvc/site/js/services/todoStorage.js
Presentation tier
Set the apiGatewayBaseUrl constant
to be equal to the endpoint:
Presentation tier
If you want to understand how it’s
used, read how the api factory is
coded:
Presentation tier
Go to the S3 console at:
https://console.aws.amazon.com/s3
Presentation tier
Upload the files contained in the site
folder on github:
https://github.com/jeshan/lambdatv/tree/master/multi-
tier-architecture-todomvc/site
Presentation tier
When the upload has completed,
select all of them and make them
public so that they are viewable
publicly:
Presentation tier
Now we need to enable website
hosting. Open properties for your
bucket and use the settings as shown
here:
Presentation tier
Your website should now be up and
running:
Presentation tier
Use your own domain:
multitier.jeshan.co.s3-website-eu-west-1.amazonaws.com
Presentation tier
Use your own domain:
“But wait… there’s
more!”
“What if I want to
automate this whole
process?”
Setup AWS CLI:
http://docs.aws.amazon.com/cli/latest/userguide/installing.html
Follow the link:
https://github.com/jeshan/lambdatv/tree/master/multi-tier-architecture-
todomvc/aws
Automate this
This is how the first script looks like:
Automate this
Create table script:
aws dynamodb create-table --table-name ${TABLE_NAME} 
--attribute-definitions AttributeName=id,AttributeType=N 
--key-schema KeyType=HASH,AttributeName=id 
--provisioned-throughput WriteCapacityUnits=1,ReadCapacityUnits=1
Automate this
Upload website script: aws s3 sync . s3://$DOMAIN --acl public-read
aws s3 website s3://$DOMAIN --index-document index.html
Automate this
Just fill in a chosen domain and you’re
good to go:
“What if my app is not
AngularJS based?”
Generating SDKs
Check this url:
https://eu-west-
1.console.aws.amazon.com/apigateway/home?region=eu-
west-1#/apis/${YOUR_API}/stages/prod
Recommendation:
Use Swagger
Use Swagger
http://swagger.io
Use Swagger
http://editor.swagger.io
Let’s recap
Recap
What the finished goods looks like:
Before you go...
Coming soon
Part 2 of this tutorial where I’ll cover:
1. How to make the frontend faster using a CDN
2. How to use SSL on your own domain
3. How to add your second set of microservices
.. and more
Serverless on AWS
I’ll explore services that are a great fit
for serverless
What would you like
to watch?
If you want the written
guide, incl. links:
https://www.lambdatv.com/Your-first-serverless-multi-tier-web-app-on-
AWS-(updated-for-2017)
Thanks!
Jeshan G. Babooa
LambdaTV.com

More Related Content

What's hot

AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...Amazon Web Services
 
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...Amazon Web Services
 
End-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS servicesEnd-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS servicesMassimo Ferre'
 
(CMP406) Amazon ECS at Coursera: A general-purpose microservice
(CMP406) Amazon ECS at Coursera: A general-purpose microservice(CMP406) Amazon ECS at Coursera: A general-purpose microservice
(CMP406) Amazon ECS at Coursera: A general-purpose microserviceAmazon Web Services
 
Deploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalkDeploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalkJulien SIMON
 
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Amazon Web Services
 
Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsJuan Basso
 
Continuous delivery and deployment on AWS
Continuous delivery and deployment on AWSContinuous delivery and deployment on AWS
Continuous delivery and deployment on AWSShiva Narayanaswamy
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon Web Services
 
Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...
Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...
Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...Amazon Web Services
 
Terraform day 1
Terraform day 1Terraform day 1
Terraform day 1Kalkey
 
Continuous delivery in AWS
Continuous delivery in AWSContinuous delivery in AWS
Continuous delivery in AWSAnton Babenko
 
Servlets made easy. 
Write once and run everywhere.
Servlets made easy. 
Write once and run everywhere.Servlets made easy. 
Write once and run everywhere.
Servlets made easy. 
Write once and run everywhere.ICON UK EVENTS Limited
 
(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at ScaleAmazon Web Services
 
Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016David Brattoli
 
AEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAshokkumar T A
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSAmazon Web Services
 
Find your data - use GraphDB capabilities in XPages applications - and beyond
Find your data - use GraphDB capabilities in XPages applications - and beyond	Find your data - use GraphDB capabilities in XPages applications - and beyond
Find your data - use GraphDB capabilities in XPages applications - and beyond ICON UK EVENTS Limited
 
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...Amazon Web Services
 

What's hot (20)

AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
AWS December 2015 Webinar Series - Continuous Delivery to Amazon EC2 Containe...
 
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
 
End-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS servicesEnd-to-end CI/CD deployments of containerized applications using AWS services
End-to-end CI/CD deployments of containerized applications using AWS services
 
(CMP406) Amazon ECS at Coursera: A general-purpose microservice
(CMP406) Amazon ECS at Coursera: A general-purpose microservice(CMP406) Amazon ECS at Coursera: A general-purpose microservice
(CMP406) Amazon ECS at Coursera: A general-purpose microservice
 
Deploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalkDeploying your web application with AWS ElasticBeanstalk
Deploying your web application with AWS ElasticBeanstalk
 
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
Docker on AWS with Amazon ECR & ECS - Pop-up Loft Tel Aviv
 
Optimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x AppsOptimizing CakePHP 2.x Apps
Optimizing CakePHP 2.x Apps
 
CloudStack S3
CloudStack S3CloudStack S3
CloudStack S3
 
Continuous delivery and deployment on AWS
Continuous delivery and deployment on AWSContinuous delivery and deployment on AWS
Continuous delivery and deployment on AWS
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
 
Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...
Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...
Managing Docker & ECS Based Applications with AWS Elastic Beanstalk - DevDay ...
 
Terraform day 1
Terraform day 1Terraform day 1
Terraform day 1
 
Continuous delivery in AWS
Continuous delivery in AWSContinuous delivery in AWS
Continuous delivery in AWS
 
Servlets made easy. 
Write once and run everywhere.
Servlets made easy. 
Write once and run everywhere.Servlets made easy. 
Write once and run everywhere.
Servlets made easy. 
Write once and run everywhere.
 
(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale(CMP302) Amazon ECS: Distributed Applications at Scale
(CMP302) Amazon ECS: Distributed Applications at Scale
 
Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
 
AEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly toolsAEM - A Collection of developer friendly tools
AEM - A Collection of developer friendly tools
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
Find your data - use GraphDB capabilities in XPages applications - and beyond
Find your data - use GraphDB capabilities in XPages applications - and beyond	Find your data - use GraphDB capabilities in XPages applications - and beyond
Find your data - use GraphDB capabilities in XPages applications - and beyond
 
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay L...
 

Similar to Your First multi tier Serverless Architecture on AWS

Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Amazon Web Services
 
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbsAWS Chicago
 
Application Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldApplication Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldAmazon Web Services
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Amazon Web Services
 
Single Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST APISingle Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST APITejaswini Deshpande
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaManish Pandit
 
A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)Julien SIMON
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkAmazon Web Services
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Amazon Web Services
 
Just another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudyJust another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudyMaarten Balliauw
 
Developing Java Applications in AWS
Developing Java Applications in AWSDeveloping Java Applications in AWS
Developing Java Applications in AWSNemanja Kostic
 
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017Amazon Web Services
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platformNelson Kopliku
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventJohn Schneider
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Amazon Web Services
 
Serverless solution architecture in AWS
Serverless solution architecture in AWSServerless solution architecture in AWS
Serverless solution architecture in AWSRuncy Oommen
 
AWS CodeDeploy
AWS CodeDeploy AWS CodeDeploy
AWS CodeDeploy Ratan Das
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursAmazon Web Services
 

Similar to Your First multi tier Serverless Architecture on AWS (20)

Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
Continuous Integration e Delivery per (r)innovare lo sviluppo software e la g...
 
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
 
Deep Dive on Serverless Stack
Deep Dive on Serverless StackDeep Dive on Serverless Stack
Deep Dive on Serverless Stack
 
Application Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless WorldApplication Lifecycle Management in a Serverless World
Application Lifecycle Management in a Serverless World
 
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
Application Lifecycle Management in a Serverless World | AWS Public Sector Su...
 
Single Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST APISingle Page Web Applications with WordPress REST API
Single Page Web Applications with WordPress REST API
 
AWS Serverless Workshop
AWS Serverless WorkshopAWS Serverless Workshop
AWS Serverless Workshop
 
AWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and JavaAWS Lambda with Serverless Framework and Java
AWS Lambda with Serverless Framework and Java
 
A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)A 60-mn tour of AWS compute (March 2016)
A 60-mn tour of AWS compute (March 2016)
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic Beanstalk
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
 
Just another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudyJust another Wordpress weblog, but more cloudy
Just another Wordpress weblog, but more cloudy
 
Developing Java Applications in AWS
Developing Java Applications in AWSDeveloping Java Applications in AWS
Developing Java Applications in AWS
 
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
Building CICD Pipelines for Serverless Applications - DevDay Los Angeles 2017
 
High quality ap is with api platform
High quality ap is with api platformHigh quality ap is with api platform
High quality ap is with api platform
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Serverless solution architecture in AWS
Serverless solution architecture in AWSServerless solution architecture in AWS
Serverless solution architecture in AWS
 
AWS CodeDeploy
AWS CodeDeploy AWS CodeDeploy
AWS CodeDeploy
 
DevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office HoursDevOps for the Enterprise: Virtual Office Hours
DevOps for the Enterprise: Virtual Office Hours
 

Recently uploaded

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Your First multi tier Serverless Architecture on AWS

Editor's Notes

  1. Hi guys and girls. I’m Jeshan. welcome to Lambda TV where I explore serverless technologies on AWS
  2. In this video, you’re going to learn how to set up your first multi-tier serverless architecture on AWS
  3. You’ll learn about the services you’ll need and you’ll learn how to automate the setup. This presentation assumes that you have some experience deploying real-world apps before. To keep this tutorial to the point, I have omitted steps like how to setup the CLI so you must have a minimum of familiarity with AWS for you to get the most out of this video.
  4. Traditional applications consist of 3 tiers: Presentation tier which represents the user interface, the logic tier which executes arbitrary logic and the data tier for storage.
  5. You’ll learn about the prescribed multi-tier reference architecture from AWS. It is a whitepaper I read and would like to give you a walkthrough on how you can apply what’s written there.
  6. A multi-tier architecture designed as discussed here can be used in many types of apps. Web app, especially one with a static frontend (where I’m going to focus in this video) Mobile app (I’ll leave that for a future video) Or even any kind of app that can make web requests.
  7. In this architecture, it is AWS’s recommendation to use a front end that’s fully static. That is, it’s written only using HTML, CSS and JS. If you use PHP to generate html, then this system won’t work for you. Having a fully static website offers a lot of advantages, performance-related or otherwise; the server doesn’t have to dynamically generate the response, you can deliver your site to a global audience on a content delivery network, it can also be cached and compressed for you. So, back to AWS. You are going to host your frontend on S3 which is AWS’s main storage solution. Next, we’ll look at the 2 services for the logic tier. Next on to the logic tier...
  8. First there’s API Gateway Amazon API Gateway makes it easy for you to deploy scalable and secure APIs. You define methods and resources just as you would in a REST api. Then you tell it which routes need to execute what logic that you have defined in Lambda functions. Then it gives you https endpoints that you can tell your frontend code to call. AWS Lambda Lambda is my favourite piece of technology currently. Essentially, it means that you upload some functions and with minimal configuration, it can run and scale as and when needed on your behalf. Lambda also encourages you to think of your applications as a decoupled set of microservices. There are no servers to run (hence the term "serverless") and you only pay for resources consumed while functions run. You can execute millions of requests for less than a dollar and there’s even a million calls that you are given free of charge every month… which is cool. If you have ever managed servers before, you know that it can be a pain to make sure your servers are always secure, or figuring out how to autoscale and even how to deploy applications at scale. Thankfully, if you use Lambda, you won’t have to worry about that anymore. You can make a lambda function run on many types of events, like uploading a file, running on a schedule or like in our case, hitting https endpoints. Now let’s look at the data tier..
  9. 2 common options we have on AWS are Relational databases with AWS Relational Database Service (RDS) or NoSQL with DynamoDB. DynamoDB is AWS’s NoSQL offering that offers the performance we come to expect from AWS; high availability, performance and durability. There’s less administration required with it compared to a conventional relational database. Besides, it doesn’t require managing a server. We want a fully serverless solution, so we’ll go with DynamoDB for now.
  10. In this demo, I am going to show you how to make a TODO app work on serverless. You will be able to view todos, create and make updates to them with CRUD operations. Tip: Choose a region and use it throughout this demo. I’ll be using eu-west-1.
  11. The data tier Let me start with the data tier I’m going to show you how to setup the DynamoDB table. Our table called todo will consist of todos will consist of records that will look like the following; a completed flag to indicate that the TODO has been ticked, an ID and a title of the TODO
  12. After a few seconds, your table will be created. Next on to the logic tier. You will recall that this consists of the API gateway and Lambda.
  13. We will create our epic API with the API gateway. Go to https://console.aws.amazon.com/apigateway/home Create a new API by clicking Get Started:
  14. An empty API will be created. We’ll get back to that later.
  15. Choose the api that you just created. The select blueprint step will have many samples that you can use but skip to the Configure triggers step for this tutorial. Choose the api name that you created. Let’s leave the security open for now for simplicity. I’ll come back to it in a future tutorial.
  16. Enter a name. We’ll use a function written in Node.js. And you’re going to paste an example code further below.
  17. Let’s step in that code for a minute… It’s available at the link shown
  18. I tell lambda that I’ve finished doing the server side logic with a call to the context.succeed function. Take a few minutes to understand how this works. For example, you may want to check out how the docClient object is used to make operations on DynamoDB. Let’s move on with the Lambda function creation.
  19. This should successfully create our function.
  20. Save this endpoint; we’ll need it soon in our web application.
  21. Before proceeding, our microservice needs an additional permission that wasn’t added automatically for us, i.e the ability to batch write on to a dynamodb table. We need this permission to be able to delete several TODOs at once in our demo app.
  22. Let’s add the permission quickly using the Identify and Access Management console. If you used multi-tier as role name, you can find the role directly with the link shown
  23. One final thing before proceeding to the front end: Our demo is calling the microservice asynchronously from a web app. So, we need to enable CORS for browsers to allow it. Back to our API in the API Gateway.
  24. Now, we’re ready to connect our frontend to our API.
  25. Remember that our endpoint for our API is something like the one shown. Now, we need to tell our frontend to use it. The javascript file that is of interest to us is found at the github link on the screen
  26. Now it’s time to upload your website to Amazon S3 where’ll you host your frontend code.
  27. Create a bucket. Choose a name that suits you. If you want to use your own domain for the website (which you probably do), you must choose a name that equals that of your domain, e.g I own jeshan.co so I could choose multitier.jeshan.co.
  28. Now we need to enable website hosting. Open properties for your bucket and use the settings as shown here:
  29. Now to use your own domain, you want to setup a DNS CNAME record for your domain. For example, I enter multitier as host on my DNS config that points to the example link shown for my domain jeshan.co:
  30. After you save and the DNS record propagates, your website should be available at your chosen domain. Congrats, you’re now done with setting up your first multi-tier serverless architecture on AWS!
  31. I’d now like to cover a few topics on what I expected to find in the whitepaper but didn’t. For example, I’d love some automation. So how could I script this whole process?
  32. Setting up the various tiers on the UI is cool but it makes it difficult to automate. I’m making a couple of Bash scripts available so that you can automate the process. 1-setup-data-and-logic-tier.sh 2-setup-presentation-tier.sh Available the link shown.
  33. This is the Bash command to create a dynamodb table.
  34. to upload the website you need these two steps...
  35. There are some comments in there to help you find your way through it. Let me know in the comments if it doesn’t work for you.
  36. If you’re not using AngularJS, you can use SDKs that can been automatically generated for you by API Gateway. At the moment, it supports the platforms iOS, Java, plain JavaScript and Android.
  37. Here we have a very simple API; it’s just a CRUD. For a more involved API, I recommend you define the API with a tool called Swagger: it makes life easy for many reasons. We can import/export it into and out of api gateway. You can even use their editor web app to author your APIs.
  38. I’ll cover Swagger in part 2 of this tutorial.
  39. What the finished goods looks like:
  40. You now have a basic multi-tier architecture up and running on AWS. It is completely serverless: You have a simple data tier running on DynamoDB that’s highly scalable without any maintenance needed. You have a logic tier set up with API gateway and Lambda that are billable as and when used. You have a static website that’s highly performant running on just a couple of cents per month. So, I hope you liked it. Thanks for stopping by,
  41. I want to acknowledge that this wasn’t an introduction to the various services. So, I didn’t cover the basics of api gateway, S3 and so on. I wanted to focus on showing you how to get a basic 3-tier up and running
  42. Dynamodb, api gateway, step functions, lambda, codepipeline, codebuild, cloudformation, s3, cloudfront, xray, etc
  43. Tell me what you’d like to see because I want to make this channel a valuable free resource about serverless on AWS. If you’d like me to keep you in the loop, click the subscribe button and I’ll send you more great serverless tutorials soon.
  44. All the links mentioned are available on the blog as a written guide. Thanks for watching!