SlideShare a Scribd company logo
1 of 34
Download to read offline
Serverless With
Lambda, NodeJS and ClaudiaJS
AWSome Meetup on 31st of October
Hi, I’m Riza
Serverless
“A new cloud compu!ng trend
that changes the way you think
about wri!ng and maintaining
applica!ons.”
Tomasz Janczuk
Chief Architect for Webtasks at Auth0
“The essence of
the serverless trend is the
absence of the server
concept during so"ware
development.”
Tomasz Janczuk
Chief Architect for Webtasks at Auth0
Faas
Amazon Lambda
Google Func!ons
Azure Func!ons
GOTO; Conf 2017
"For 400.000 ac!ve user we have paid $0.53 for
Lambda. Now, beat that with your hos!ng cost!"
Gojko Adzic from MindMup
Designing for the Serverless Age
h!ps://www.youtube.com/watch?v=w7X4gAQTk2E
I’m sold!
Really?
ButILove’em
Especially this
Don’t you worry
*Fully-managed your serverless architecture
*Required to use CloudForma"on
*Build-in support for CI/CD workflows
* Golang-based framework
* Deployment op"mized
* Concurrent for quick deploy
* Deployment u"lity, not a framework
* Extensions for new features
* unit-test Lambda func"ons
“Serverless is like ice cream.
It’s nice to talk about it, but
much be"er to try out.”
The Casts
A Serverless Host
Deployment Library
Services
Database
The Architecture
First Act...

Ac!on!!
$ vim ~/.aws/credentials
[default]
aws_access_key_id = YOUR_ACCESS_KEY
aws_secret_access_key = YOUR_ACCESS_SECRET
Second Act...

Install Claudia
$ npm install -g claudia
Third Act...

Write our service
$ mkdir claudia-icecream-shop
$ cd claudia-icecream-shop
$ npm init
$ npm install aws-sdk claudia-api-builder
$ vim index.js
Third Act...

Write our service
const ApiBuilder = require('claudia-api-builder')
const AWS = require('aws-sdk')
const api = new ApiBuilder()
const dynamoDb = new
AWS.DynamoDB.DocumentClient()
const TABLENAME = 'icecreams'
Third Act...

Write our service
api.post('/icecreams',
request 
=> {
const params = {
TableName: TABLENAME,
Item: {
icecreamid: request.body.id,
name: request.body.name
}
}
return dynamoDb.put(params).promise()
},
{ success: 201 }
)
Third Act...

Write our service
api.get('/icecreams', request 
=> {
return dynamoDb
.scan({ TableName: TABLENAME })
.promise()
.then(response 
=> response.Items)
})
module.exports = api
Fourth Act...

Setup DynamoDB
$ mkdir policy
$ vim policy/dynamodb-policy.json
Fourth Act...

Setup DynamoDB
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"dynamodb:DeleteItem",
"dynamodb:GetItem",
"dynamodb:PutItem",
"dynamodb:Scan"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
Fourth Act...

Setup DynamoDB
Fourth Act...

Setup DynamoDB
$ aws dynamodb create-table 
--table-name
icecreams 
--attribute-definition 
AttributeName=icecreamid,AttributeType=S 

--key-schema 
AttributeName=icecreamid,KeyType=HASH 

--provisioned-throughput 
ReadCapacityUnits=1,WriteCapacityUnits=1 

--region ap-southeast-1 

--query TableDescription.TableArn 
--output
text
Fi"h Act...

Time for deploy
$ claudia create 
--region ap-southeast-1 

--api-module index 
--policies policy
Fi"h Act...

Time for deploy
{
"lambda": {
"role": "ice-cream-shop-executor",
"name": "ice-cream-shop",
"region": "us-east-1"
},
"api": {
"id": "your-service-id",
"module": "index",
"url": “https:
//xxx.execute-api.ap-
southeast-1.amazonaws.com/latest"
}
}
$ curl -H "Content-Type: application/json"
-X POST -d
‘{“icecreamId”:”123","name":"chocolate"}' 
https:
//xxx.execute-api.ap-
southeast-1.amazonaws.com/latest/icecreams
Sixth Act...

Trying it out
Sixth Act...

Trying it out
$ curl https:
//xxx.execute-api.ap-
southeast-1.amazonaws.com/latest/icecreams
[{“icecreamId”: 123, “name”: “chocolate”}]
Seventh Act...

Some updates
$ claudia update
That’s Pretty much it!
Now go, you deserve some ice
cream!
h!ps://github.com/rizafahmi/claudia-ice-cream

More Related Content

What's hot

Java2day 2013 : Modern workflows for javascript integration
Java2day 2013 : Modern workflows for javascript integrationJava2day 2013 : Modern workflows for javascript integration
Java2day 2013 : Modern workflows for javascript integration
Mite Mitreski
 
Using Backbone with CakePHP
Using Backbone with CakePHPUsing Backbone with CakePHP
Using Backbone with CakePHP
Richard McIntyre
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
Peter Lubbers
 

What's hot (20)

The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web Components
 
Tailwind CSS - KanpurJS
Tailwind CSS - KanpurJSTailwind CSS - KanpurJS
Tailwind CSS - KanpurJS
 
Going Node.js at Netflix
Going Node.js at NetflixGoing Node.js at Netflix
Going Node.js at Netflix
 
SxSW 2015
SxSW 2015SxSW 2015
SxSW 2015
 
Intro to sbt-web
Intro to sbt-webIntro to sbt-web
Intro to sbt-web
 
Java2day 2013 : Modern workflows for javascript integration
Java2day 2013 : Modern workflows for javascript integrationJava2day 2013 : Modern workflows for javascript integration
Java2day 2013 : Modern workflows for javascript integration
 
Intro to Sails.js
Intro to Sails.jsIntro to Sails.js
Intro to Sails.js
 
Thomas Lobinger
Thomas LobingerThomas Lobinger
Thomas Lobinger
 
Automated perf optimization - jQuery Conference
Automated perf optimization - jQuery ConferenceAutomated perf optimization - jQuery Conference
Automated perf optimization - jQuery Conference
 
Introduction to Vue.js DevStaff Meetup 13.02
Introduction to Vue.js  DevStaff Meetup 13.02Introduction to Vue.js  DevStaff Meetup 13.02
Introduction to Vue.js DevStaff Meetup 13.02
 
Drupal point of vue
Drupal point of vueDrupal point of vue
Drupal point of vue
 
Using Backbone with CakePHP
Using Backbone with CakePHPUsing Backbone with CakePHP
Using Backbone with CakePHP
 
Getting Started with Angular - Stormpath Webinar, January 2017
Getting Started with Angular - Stormpath Webinar, January 2017Getting Started with Angular - Stormpath Webinar, January 2017
Getting Started with Angular - Stormpath Webinar, January 2017
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
 
Transforming Front-End Disaster Code™ Into A Maintainable Masterpiece
Transforming Front-End Disaster Code™ Into A Maintainable MasterpieceTransforming Front-End Disaster Code™ Into A Maintainable Masterpiece
Transforming Front-End Disaster Code™ Into A Maintainable Masterpiece
 
Brief Intro to Phoenix - Elixir Meetup at BukaLapak
Brief Intro to Phoenix - Elixir Meetup at BukaLapakBrief Intro to Phoenix - Elixir Meetup at BukaLapak
Brief Intro to Phoenix - Elixir Meetup at BukaLapak
 
Using WordPress as a Backend for Your React Project
Using WordPress as a Backend for Your React ProjectUsing WordPress as a Backend for Your React Project
Using WordPress as a Backend for Your React Project
 
JavaScript Web Workers
JavaScript Web WorkersJavaScript Web Workers
JavaScript Web Workers
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
 
Why try angularJS?
Why try angularJS?Why try angularJS?
Why try angularJS?
 

Similar to AWS Lambda with ClaudiaJS

Similar to AWS Lambda with ClaudiaJS (20)

Serverless computing with AWS Lambda
Serverless computing with AWS Lambda Serverless computing with AWS Lambda
Serverless computing with AWS Lambda
 
AWS Serverless Workshop
AWS Serverless WorkshopAWS Serverless Workshop
AWS Serverless Workshop
 
CloudFork
CloudForkCloudFork
CloudFork
 
Serverless Design Patterns
Serverless Design PatternsServerless Design Patterns
Serverless Design Patterns
 
Serveless design patterns (VoxxedDays Luxembourg)
Serveless design patterns (VoxxedDays Luxembourg)Serveless design patterns (VoxxedDays Luxembourg)
Serveless design patterns (VoxxedDays Luxembourg)
 
Building serverless apps with Node.js
Building serverless apps with Node.jsBuilding serverless apps with Node.js
Building serverless apps with Node.js
 
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky..."Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
"Automating AWS Infrastructure with PowerShell", Martin Beeby, AWS Dev Day Ky...
 
Rails in the Cloud
Rails in the CloudRails in the Cloud
Rails in the Cloud
 
Building Serverless APIs on AWS
Building Serverless APIs on AWSBuilding Serverless APIs on AWS
Building Serverless APIs on AWS
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Serveless Design Patterns (Serverless Computing London)
Serveless Design Patterns (Serverless Computing London)Serveless Design Patterns (Serverless Computing London)
Serveless Design Patterns (Serverless Computing London)
 
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)Serverless cat detector   workshop - cloudyna 2017 (16.12.2017)
Serverless cat detector workshop - cloudyna 2017 (16.12.2017)
 
Exploring Serverless Architectures: AWS Lambda
Exploring Serverless Architectures: AWS LambdaExploring Serverless Architectures: AWS Lambda
Exploring Serverless Architectures: AWS Lambda
 
An introduction to serverless architectures (February 2017)
An introduction to serverless architectures (February 2017)An introduction to serverless architectures (February 2017)
An introduction to serverless architectures (February 2017)
 
McrUmbMeetup 22 May 14: Umbraco and Amazon
McrUmbMeetup 22 May 14: Umbraco and AmazonMcrUmbMeetup 22 May 14: Umbraco and Amazon
McrUmbMeetup 22 May 14: Umbraco and Amazon
 
re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda
 
Serverless architecture with AWS Lambda (June 2016)
Serverless architecture with AWS Lambda (June 2016)Serverless architecture with AWS Lambda (June 2016)
Serverless architecture with AWS Lambda (June 2016)
 
AWS Summit Singapore - Lambda, Step Functions and Datadog: A Symphony
AWS Summit Singapore - Lambda, Step Functions and Datadog: A SymphonyAWS Summit Singapore - Lambda, Step Functions and Datadog: A Symphony
AWS Summit Singapore - Lambda, Step Functions and Datadog: A Symphony
 
VMware Cloud on AWS: A World of Unique Integrations Between VMware and AWS - ...
VMware Cloud on AWS: A World of Unique Integrations Between VMware and AWS - ...VMware Cloud on AWS: A World of Unique Integrations Between VMware and AWS - ...
VMware Cloud on AWS: A World of Unique Integrations Between VMware and AWS - ...
 
Deep Dive into AWS SAM: re:Invent 2018 Recap at the AWS Loft - San Francisco
Deep Dive into AWS SAM: re:Invent 2018 Recap at the AWS Loft - San FranciscoDeep Dive into AWS SAM: re:Invent 2018 Recap at the AWS Loft - San Francisco
Deep Dive into AWS SAM: re:Invent 2018 Recap at the AWS Loft - San Francisco
 

More from Riza Fahmi

More from Riza Fahmi (20)

Membangun Aplikasi Web dengan Elixir dan Phoenix
Membangun Aplikasi Web dengan Elixir dan PhoenixMembangun Aplikasi Web dengan Elixir dan Phoenix
Membangun Aplikasi Web dengan Elixir dan Phoenix
 
Berbagai Pilihan Karir Developer
Berbagai Pilihan Karir DeveloperBerbagai Pilihan Karir Developer
Berbagai Pilihan Karir Developer
 
Web dan Progressive Web Apps di 2020
Web dan Progressive Web Apps di 2020Web dan Progressive Web Apps di 2020
Web dan Progressive Web Apps di 2020
 
Remote Working/Learning
Remote Working/LearningRemote Working/Learning
Remote Working/Learning
 
How to learn programming
How to learn programmingHow to learn programming
How to learn programming
 
Rapid App Development with AWS Amplify
Rapid App Development with AWS AmplifyRapid App Development with AWS Amplify
Rapid App Development with AWS Amplify
 
Menguak Misteri Module Bundler
Menguak Misteri Module BundlerMenguak Misteri Module Bundler
Menguak Misteri Module Bundler
 
Beberapa Web API Menarik
Beberapa Web API MenarikBeberapa Web API Menarik
Beberapa Web API Menarik
 
MVP development from software developer perspective
MVP development from software developer perspectiveMVP development from software developer perspective
MVP development from software developer perspective
 
Ekosistem JavaScript di Indonesia
Ekosistem JavaScript di IndonesiaEkosistem JavaScript di Indonesia
Ekosistem JavaScript di Indonesia
 
Perkenalan ReasonML
Perkenalan ReasonMLPerkenalan ReasonML
Perkenalan ReasonML
 
How I Generate Idea
How I Generate IdeaHow I Generate Idea
How I Generate Idea
 
Strategi Presentasi Untuk Developer Workshop Slide
Strategi Presentasi Untuk Developer Workshop SlideStrategi Presentasi Untuk Developer Workshop Slide
Strategi Presentasi Untuk Developer Workshop Slide
 
Lesson Learned from Prolific Developers
Lesson Learned from Prolific DevelopersLesson Learned from Prolific Developers
Lesson Learned from Prolific Developers
 
Clean Code JavaScript
Clean Code JavaScriptClean Code JavaScript
Clean Code JavaScript
 
The Future of AI
The Future of AIThe Future of AI
The Future of AI
 
Chrome Dev Summit 2018 - Personal Take Aways
Chrome Dev Summit 2018 - Personal Take AwaysChrome Dev Summit 2018 - Personal Take Aways
Chrome Dev Summit 2018 - Personal Take Aways
 
Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6Essentials and Impactful Features of ES6
Essentials and Impactful Features of ES6
 
Modern Static Site with GatsbyJS
Modern Static Site with GatsbyJSModern Static Site with GatsbyJS
Modern Static Site with GatsbyJS
 
Introduction to ReasonML
Introduction to ReasonMLIntroduction to ReasonML
Introduction to ReasonML
 

Recently uploaded

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

AWS Lambda with ClaudiaJS