SlideShare a Scribd company logo
1 of 51
Download to read offline
Serverless Adventures
with AWS Lambda and
Clojure
________ ______
__ ___/______________ ________________ /___________________
_____ _ _ _ ___/_ | / / _ _ ___/_ /_ _ _ ___/_ ___/
____/ // __/ / __ |/ // __/ / _ / / __/(__ )_(__ )
/____/ ___//_/ _____/ ___//_/ /_/ ___//____/ /____/
.d8b. d8888b. db db d88888b d8b db d888888b db db d8888b. d88888b .d8888. db d8b db d888888b d888888b db db
d8' `8b 88 `8D 88 88 88' 888o 88 `~~88~~' 88 88 88 `8D 88' 88' YP 88 I8I 88 `88' `~~88~~' 88 88
88ooo88 88 88 Y8 8P 88ooooo 88V8o 88 88 88 88 88oobY' 88ooooo `8bo. 88 I8I 88 88 88 88ooo88
88~~~88 88 88 `8b d8' 88~~~~~ 88 V8o88 88 88 88 88`8b 88~~~~~ `Y8b. Y8 I8I 88 88 88 88~~~88
88 88 88 .8D `8bd8' 88. 88 V888 88 88b d88 88 `88. 88. db 8D `8b d8'8b d8' .88. 88 88 88
YP YP Y8888D' YP Y88888P VP V8P YP ~Y8888P' 88 YD Y88888P `8888Y' `8b8' `8d8' Y888888P YP YP YP
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚
β”‚ β”‚
β”‚ ___ ____ __ ____ _______. __ ___ .___ ___. .______ _______ ___ β”‚
β”‚ /    /  / / / | | | /  | / | | _  |  /  β”‚
β”‚ / ^   / / / | (----` | | / ^  |  / | | |_) | | .--. | / ^  β”‚
β”‚ / /_   /   | | / /_  | |/| | | _ < | | | | / /_  β”‚
β”‚ / _____   / / .----) | | `----./ _____  | | | | | |_) | | '--' | / _____  β”‚
β”‚ /__/ __ &&&&&&&&&&/ |_______/ |_______/__/ __ |__| |__| |______/ |_______/ /__/ __ β”‚
β”‚ &::::::::::& β”‚
β”‚ &::::&&&:::::& ╔════════════════════════════════════════════════════════════════════════════════╗ β”‚
└────────────────&::::&───&::::&────╣ β• β”€β”€β”˜
&::::& &::::& β•‘ β•‘
&::::&&&::::& β•‘ ______ __ ______ __ __ __ .______ _______ β•‘
&::::::::::& β•‘ / || | / __  | | | | | | | _  | ____| β•‘
&:::::::&& β•‘ | ,----'| | | | | | | | | | | | | |_) | | |__ β•‘
&::::::::& &&&& β•‘ | | | | | | | | .--. | | | | | | | / | __| β•‘
&:::::&&::& &:::& β•‘ | `----.| `----.| `--' | | `--' | | `--' | | | ----.| |____ β•‘
&:::::& &::&&:::&& β•‘ ______||_______| ______/ ______/ ______/ | _| `._____||_______| β•‘
&:::::& &:::::& β•‘ β•‘
&:::::& &::::& β•‘ β•‘
&::::::&&&&::::::&& β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
&&::::::::&&&::::&
&&&&&&&& &&&&&
Lars Trieloff
!❀
! @trieloff
!" @trieloff
!"
!"#$%&'
!
What?
Excel + HTTP = Excelsior
!"
github.com/trieloff/excelsior
!
Why?
! Clojure
Ξ» !
! 12 βœ•
12factor.net
! Swagger
swagger.io
!"?
AWS Lambda!
!" = #
!" = #
!"
AWS Ξ» + Clojure Ξ» = β™₯
!
Sounds good.
Sounds too good.
Sounds too good to be true.
If something sounds too
good to be true, it
probably is.
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚
β”‚ β”‚
β”‚ Clojure β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ ! β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”˜ β”‚
β”‚ AWS Lambda β”‚
β”‚ β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
!
How?
β†’ ! github.com/metosin/compojure-api
β†’ " github.com/jpb/ring-aws-lambda-adapter
β†’ # github.com/mjul/docjure
β†’ β­• circleci.com
β†’ % github.com/mhjort/lein-clj-lambda
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚
β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β”‚ Docjure !β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AWS API Gateway β”‚
β”‚ β”‚ β”‚ My code " β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Άβ”‚swagger.json│─────Import─────▢│ β”‚
β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ Export β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚ Compojure API # β”œβ”€β”Όβ”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚
β”‚ Ring Lambda Adapter $ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β”‚ Proxy
β”‚ β”‚
β”‚ β–Ό
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ β”‚ β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AWS Lambda β”‚
└───────────Build % ─────▢│ server.jar │────Deploy──────▢│ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚
β”‚ β”‚
β”‚ β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
!
Problems?
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚
β”‚ β”‚
β”‚ Clojure β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚!"#β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”˜ β”‚
β”‚ AWS Lambda β”‚
β”‚ β”‚
β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
!"
github.com/trieloff/lein-aws-apigateway
!"
AWS API Gateway
!"
AWS IAM Permissions
Execution failed due to configuration error: Invalid
permissions on Lambda function
aws lambda add-permission 
--function-name <name> 
--statement-id <someid> 
--action "lambda:*" 
--principal "apigateway.amazonaws.com"
! docs.aws.amazon.com/cli/latest/reference/
lambda/add-permission.html
!
Tips?
Think small
100 LOC should be
enough for a Lambda
function. !
Think
modular
Two tiny functions are
better than one large
function. !
!"
github.com/trieloff/salvador
Think
Stateless
simplicity, performance,
composablity ☠
Be lazy
Sit, don’t stand on the
shoulders of giants. Re-
use, don’t re-invent. β™»
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β”‚ Typeform │───Redirect──▢│ Excelsior │───Redirect──▢│ Salvador β”‚
β”‚ β”‚ β”‚ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–² β–²
β”‚ β”‚
Spreadsheet Template
β”‚ β”‚
β”‚ β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ β”‚ β”‚ β”‚
β”‚ S3 β”‚ β”‚ S3 β”‚
β”‚ β”‚ β”‚ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Smile & Share
Community eats code for
breakfast. β˜•
!
⏰
AWS Ξ» + Clojure Ξ» = β™₯
! Rainbow Parentheses make " #
))))))))))))*

More Related Content

Viewers also liked

How to get value out of data
How to get value out of dataHow to get value out of data
How to get value out of dataLars Trieloff
Β 
Business Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsBusiness Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsLars Trieloff
Β 
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfAutomated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfLars Trieloff
Β 
Automated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgAutomated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgLars Trieloff
Β 
AMEX Meetings&Events 2015 Global Meetings & Events Forecast
AMEX Meetings&Events 2015 Global Meetings & Events ForecastAMEX Meetings&Events 2015 Global Meetings & Events Forecast
AMEX Meetings&Events 2015 Global Meetings & Events ForecastLausanne Montreux Congress
Β 
Blue Yonder - NOAH16 London
Blue Yonder - NOAH16 LondonBlue Yonder - NOAH16 London
Blue Yonder - NOAH16 LondonNOAH Advisors
Β 
Forecasting - MENA 2012 Conference
Forecasting - MENA 2012 ConferenceForecasting - MENA 2012 Conference
Forecasting - MENA 2012 ConferenceMohammed Hadi
Β 
Automated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamAutomated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamLars Trieloff
Β 
How to market and sell unbundled travel
How to market and sell unbundled travelHow to market and sell unbundled travel
How to market and sell unbundled travelKevin May
Β 
ADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkLars Trieloff
Β 
Automated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtAutomated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtLars Trieloff
Β 
Forecasting and Managing Passenger Growth
Forecasting and Managing Passenger GrowthForecasting and Managing Passenger Growth
Forecasting and Managing Passenger GrowthLockheed-Martin
Β 
Airport forecasting
Airport forecastingAirport forecasting
Airport forecastingMohammed Hadi
Β 
Presentation on forecasting
Presentation on forecasting Presentation on forecasting
Presentation on forecasting Muhammad Sharjeel
Β 
Airline and Airport Big Data: Impact and Efficiencies
Airline and Airport Big Data: Impact and EfficienciesAirline and Airport Big Data: Impact and Efficiencies
Airline and Airport Big Data: Impact and EfficienciesJoshua Marks
Β 
Marketing Airline
Marketing AirlineMarketing Airline
Marketing Airlinezeeshanvali
Β 
A Brief History of Big Data
A Brief History of Big DataA Brief History of Big Data
A Brief History of Big DataBernard Marr
Β 

Viewers also liked (20)

How to get value out of data
How to get value out of dataHow to get value out of data
How to get value out of data
Β 
Business Reasons for Predictive Applications
Business Reasons for Predictive ApplicationsBusiness Reasons for Predictive Applications
Business Reasons for Predictive Applications
Β 
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data DüsseldorfAutomated Decision Making with Predictive Applications – Big Data Düsseldorf
Automated Decision Making with Predictive Applications – Big Data Düsseldorf
Β 
Automated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data HamburgAutomated Decision making with Predictive Applications – Big Data Hamburg
Automated Decision making with Predictive Applications – Big Data Hamburg
Β 
AMEX Meetings&Events 2015 Global Meetings & Events Forecast
AMEX Meetings&Events 2015 Global Meetings & Events ForecastAMEX Meetings&Events 2015 Global Meetings & Events Forecast
AMEX Meetings&Events 2015 Global Meetings & Events Forecast
Β 
Blue Yonder - NOAH16 London
Blue Yonder - NOAH16 LondonBlue Yonder - NOAH16 London
Blue Yonder - NOAH16 London
Β 
Forecasting - MENA 2012 Conference
Forecasting - MENA 2012 ConferenceForecasting - MENA 2012 Conference
Forecasting - MENA 2012 Conference
Β 
Automated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data AmsterdamAutomated decision making with predictive applications – Big Data Amsterdam
Automated decision making with predictive applications – Big Data Amsterdam
Β 
How to market and sell unbundled travel
How to market and sell unbundled travelHow to market and sell unbundled travel
How to market and sell unbundled travel
Β 
ADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it WorkADDD (Automated Data Driven Decisions) – How To Make it Work
ADDD (Automated Data Driven Decisions) – How To Make it Work
Β 
Automated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data FrankfurtAutomated decision making with predictive applications – Big Data Frankfurt
Automated decision making with predictive applications – Big Data Frankfurt
Β 
Forecasting and Managing Passenger Growth
Forecasting and Managing Passenger GrowthForecasting and Managing Passenger Growth
Forecasting and Managing Passenger Growth
Β 
Airport forecasting
Airport forecastingAirport forecasting
Airport forecasting
Β 
Presentation on forecasting
Presentation on forecasting Presentation on forecasting
Presentation on forecasting
Β 
Airline and Airport Big Data: Impact and Efficiencies
Airline and Airport Big Data: Impact and EfficienciesAirline and Airport Big Data: Impact and Efficiencies
Airline and Airport Big Data: Impact and Efficiencies
Β 
Marketing Airline
Marketing AirlineMarketing Airline
Marketing Airline
Β 
A4A Industry Review and Outlook
A4A Industry Review and OutlookA4A Industry Review and Outlook
A4A Industry Review and Outlook
Β 
Big Data For Flight Delay Report
Big Data For Flight Delay ReportBig Data For Flight Delay Report
Big Data For Flight Delay Report
Β 
Big data analysis concepts and references
Big data analysis concepts and referencesBig data analysis concepts and references
Big data analysis concepts and references
Β 
A Brief History of Big Data
A Brief History of Big DataA Brief History of Big Data
A Brief History of Big Data
Β 

More from Lars Trieloff

Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldPutting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldLars Trieloff
Β 
Automated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisAutomated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisLars Trieloff
Β 
Automated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaAutomated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaLars Trieloff
Β 
10 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 201410 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 2014Lars Trieloff
Β 
The DNA of Marketing
The DNA of MarketingThe DNA of Marketing
The DNA of MarketingLars Trieloff
Β 
Cross community campaigns with CQ5
Cross community campaigns with CQ5Cross community campaigns with CQ5
Cross community campaigns with CQ5Lars Trieloff
Β 
Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Lars Trieloff
Β 
Advanced Collaboration And Beyond
Advanced Collaboration And BeyondAdvanced Collaboration And Beyond
Advanced Collaboration And BeyondLars Trieloff
Β 
Getting Into The Flow With CQ DAM
Getting Into The Flow With CQ DAMGetting Into The Flow With CQ DAM
Getting Into The Flow With CQ DAMLars Trieloff
Β 
The Zero Bullshit Architecture
The Zero Bullshit ArchitectureThe Zero Bullshit Architecture
The Zero Bullshit ArchitectureLars Trieloff
Β 
Creating Value In Social Networking
Creating Value In Social NetworkingCreating Value In Social Networking
Creating Value In Social NetworkingLars Trieloff
Β 
5 Ways To Build Asset Centric Applications
5 Ways To Build Asset Centric Applications5 Ways To Build Asset Centric Applications
5 Ways To Build Asset Centric ApplicationsLars Trieloff
Β 
REST and AJAX Reconciled
REST and AJAX ReconciledREST and AJAX Reconciled
REST and AJAX ReconciledLars Trieloff
Β 
Β΅jax in 30 minutes (for Stockholm)
Β΅jax in 30 minutes (for Stockholm)Β΅jax in 30 minutes (for Stockholm)
Β΅jax in 30 minutes (for Stockholm)Lars Trieloff
Β 
Β΅jax in 30 minutes
Β΅jax in 30 minutesΒ΅jax in 30 minutes
Β΅jax in 30 minutesLars Trieloff
Β 
Living in a multiligual world: Internationalization for Web 2.0 Applications
Living in a multiligual world: Internationalization for Web 2.0 ApplicationsLiving in a multiligual world: Internationalization for Web 2.0 Applications
Living in a multiligual world: Internationalization for Web 2.0 ApplicationsLars Trieloff
Β 
Mindquarry For Cocoon Users
Mindquarry For Cocoon UsersMindquarry For Cocoon Users
Mindquarry For Cocoon UsersLars Trieloff
Β 

More from Lars Trieloff (17)

Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless WorldPutting the F in FaaS: Functional Compositional Patterns in a Serverless World
Putting the F in FaaS: Functional Compositional Patterns in a Serverless World
Β 
Automated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data ParisAutomated decision making using Predictive Applications – Big Data Paris
Automated decision making using Predictive Applications – Big Data Paris
Β 
Automated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data ViennaAutomated decision making with big data – Big Data Vienna
Automated decision making with big data – Big Data Vienna
Β 
10 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 201410 Things I Learned About Pricing – Product Camp Berlin 2014
10 Things I Learned About Pricing – Product Camp Berlin 2014
Β 
The DNA of Marketing
The DNA of MarketingThe DNA of Marketing
The DNA of Marketing
Β 
Cross community campaigns with CQ5
Cross community campaigns with CQ5Cross community campaigns with CQ5
Cross community campaigns with CQ5
Β 
Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5Mastering the customer engagement ecosystem with CQ5
Mastering the customer engagement ecosystem with CQ5
Β 
Advanced Collaboration And Beyond
Advanced Collaboration And BeyondAdvanced Collaboration And Beyond
Advanced Collaboration And Beyond
Β 
Getting Into The Flow With CQ DAM
Getting Into The Flow With CQ DAMGetting Into The Flow With CQ DAM
Getting Into The Flow With CQ DAM
Β 
The Zero Bullshit Architecture
The Zero Bullshit ArchitectureThe Zero Bullshit Architecture
The Zero Bullshit Architecture
Β 
Creating Value In Social Networking
Creating Value In Social NetworkingCreating Value In Social Networking
Creating Value In Social Networking
Β 
5 Ways To Build Asset Centric Applications
5 Ways To Build Asset Centric Applications5 Ways To Build Asset Centric Applications
5 Ways To Build Asset Centric Applications
Β 
REST and AJAX Reconciled
REST and AJAX ReconciledREST and AJAX Reconciled
REST and AJAX Reconciled
Β 
Β΅jax in 30 minutes (for Stockholm)
Β΅jax in 30 minutes (for Stockholm)Β΅jax in 30 minutes (for Stockholm)
Β΅jax in 30 minutes (for Stockholm)
Β 
Β΅jax in 30 minutes
Β΅jax in 30 minutesΒ΅jax in 30 minutes
Β΅jax in 30 minutes
Β 
Living in a multiligual world: Internationalization for Web 2.0 Applications
Living in a multiligual world: Internationalization for Web 2.0 ApplicationsLiving in a multiligual world: Internationalization for Web 2.0 Applications
Living in a multiligual world: Internationalization for Web 2.0 Applications
Β 
Mindquarry For Cocoon Users
Mindquarry For Cocoon UsersMindquarry For Cocoon Users
Mindquarry For Cocoon Users
Β 

Serverless adventures with AWS Lambda and Clojure

  • 1. Serverless Adventures with AWS Lambda and Clojure
  • 2. ________ ______ __ ___/______________ ________________ /___________________ _____ _ _ _ ___/_ | / / _ _ ___/_ /_ _ _ ___/_ ___/ ____/ // __/ / __ |/ // __/ / _ / / __/(__ )_(__ ) /____/ ___//_/ _____/ ___//_/ /_/ ___//____/ /____/ .d8b. d8888b. db db d88888b d8b db d888888b db db d8888b. d88888b .d8888. db d8b db d888888b d888888b db db d8' `8b 88 `8D 88 88 88' 888o 88 `~~88~~' 88 88 88 `8D 88' 88' YP 88 I8I 88 `88' `~~88~~' 88 88 88ooo88 88 88 Y8 8P 88ooooo 88V8o 88 88 88 88 88oobY' 88ooooo `8bo. 88 I8I 88 88 88 88ooo88 88~~~88 88 88 `8b d8' 88~~~~~ 88 V8o88 88 88 88 88`8b 88~~~~~ `Y8b. Y8 I8I 88 88 88 88~~~88 88 88 88 .8D `8bd8' 88. 88 V888 88 88b d88 88 `88. 88. db 8D `8b d8'8b d8' .88. 88 88 88 YP YP Y8888D' YP Y88888P VP V8P YP ~Y8888P' 88 YD Y88888P `8888Y' `8b8' `8d8' Y888888P YP YP YP β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ ___ ____ __ ____ _______. __ ___ .___ ___. .______ _______ ___ β”‚ β”‚ / / / / / | | | / | / | | _ | / β”‚ β”‚ / ^ / / / | (----` | | / ^ | / | | |_) | | .--. | / ^ β”‚ β”‚ / /_ / | | / /_ | |/| | | _ < | | | | / /_ β”‚ β”‚ / _____ / / .----) | | `----./ _____ | | | | | |_) | | '--' | / _____ β”‚ β”‚ /__/ __ &&&&&&&&&&/ |_______/ |_______/__/ __ |__| |__| |______/ |_______/ /__/ __ β”‚ β”‚ &::::::::::& β”‚ β”‚ &::::&&&:::::& ╔════════════════════════════════════════════════════════════════════════════════╗ β”‚ └────────────────&::::&───&::::&────╣ β• β”€β”€β”˜ &::::& &::::& β•‘ β•‘ &::::&&&::::& β•‘ ______ __ ______ __ __ __ .______ _______ β•‘ &::::::::::& β•‘ / || | / __ | | | | | | | _ | ____| β•‘ &:::::::&& β•‘ | ,----'| | | | | | | | | | | | | |_) | | |__ β•‘ &::::::::& &&&& β•‘ | | | | | | | | .--. | | | | | | | / | __| β•‘ &:::::&&::& &:::& β•‘ | `----.| `----.| `--' | | `--' | | `--' | | | ----.| |____ β•‘ &:::::& &::&&:::&& β•‘ ______||_______| ______/ ______/ ______/ | _| `._____||_______| β•‘ &:::::& &:::::& β•‘ β•‘ &:::::& &::::& β•‘ β•‘ &::::::&&&&::::::&& β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• &&::::::::&&&::::& &&&&&&&& &&&&&
  • 5. !
  • 7. Excel + HTTP = Excelsior
  • 9. !
  • 10. Why?
  • 15. !"?
  • 19. !"
  • 20. AWS Ξ» + Clojure Ξ» = β™₯
  • 21. !
  • 24. Sounds too good to be true.
  • 25. If something sounds too good to be true, it probably is.
  • 26. β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ Clojure β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ ! β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”˜ β”‚ β”‚ AWS Lambda β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • 27. !
  • 28. How?
  • 29. β†’ ! github.com/metosin/compojure-api β†’ " github.com/jpb/ring-aws-lambda-adapter β†’ # github.com/mjul/docjure β†’ β­• circleci.com β†’ % github.com/mhjort/lein-clj-lambda
  • 30. β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Docjure !β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AWS API Gateway β”‚ β”‚ β”‚ β”‚ My code " β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Άβ”‚swagger.json│─────Import─────▢│ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ Export β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ Compojure API # β”œβ”€β”Όβ”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ Ring Lambda Adapter $ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ Proxy β”‚ β”‚ β”‚ β–Ό β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AWS Lambda β”‚ └───────────Build % ─────▢│ server.jar │────Deploy──────▢│ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • 31. !
  • 33. β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ Clojure β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚!"#β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”˜ β”‚ β”‚ AWS Lambda β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • 37. Execution failed due to configuration error: Invalid permissions on Lambda function aws lambda add-permission --function-name <name> --statement-id <someid> --action "lambda:*" --principal "apigateway.amazonaws.com" ! docs.aws.amazon.com/cli/latest/reference/ lambda/add-permission.html
  • 38. !
  • 39. Tips?
  • 40. Think small 100 LOC should be enough for a Lambda function. !
  • 41. Think modular Two tiny functions are better than one large function. !
  • 44. Be lazy Sit, don’t stand on the shoulders of giants. Re- use, don’t re-invent. β™»
  • 45. β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ Typeform │───Redirect──▢│ Excelsior │───Redirect──▢│ Salvador β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β–² β–² β”‚ β”‚ Spreadsheet Template β”‚ β”‚ β”‚ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ β”‚ β”‚ β”‚ S3 β”‚ β”‚ S3 β”‚ β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • 46. Smile & Share Community eats code for breakfast. β˜•
  • 47. !
  • 49. AWS Ξ» + Clojure Ξ» = β™₯