Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Hitchhikers Guide To The Serverless Galaxy ...

The Hitchhikers Guide To The Serverless Galaxy - CodeEurope 2017, Wroclaw and Warsaw

"The Hitchhikers Guide To The Serverless Galaxy" presentation from CodeEurope 2017 conference in Wroclaw and Warsaw:

https://www.codeeurope.pl/en/speakers/slobodan-stojanovic

Slobodan Stojanović

May 23, 2017
Tweet

More Decks by Slobodan Stojanović

Other Decks in Programming

Transcript

  1. #codeeurope • WHAT IS SERVERLESS • HOW DOES IT WORK

    • WHY IS IT IMPORTANT • SERVERLESS PLATFORMS • WHEN SHOULD YOU USE IT • HOW DOES IT WORK WITH NODE.JS
  2. #codeeurope CTO AT CLOUD HORIZON AND JS BELGRADE MEETUP ORGANIZER

    github.com/stojanovic twitter.com/slobodan_ SLOBODAN STOJANOVIĆ
  3. #codeeurope “JUST BELIEVE EVERYTHING I TELL YOU, AND IT WILL

    ALL BE VERY, VERY SIMPLE” AH, WELL, I'M NOT SURE I BELIEVE THAT
  4. #codeeurope “WOULD IT SAVE YOU A LOT OF TIME IF

    I JUST GAVE UP AND WENT MAD NOW?”
  5. #codeeurope • HTTP REQUEST • FILE • NOTIFICATION • MAIL

    • STREAM • MANY OTHER THINGS WHAT CAN TRIGGER SERVERLESS FUNCTION
  6. #codeeurope • TIMEOUT BETWEEN 1 AND 300 SECONDS • 128MB

    TO 1.5GB OF MEMORY • 500MB OF NON-PERSISTENT STORAGE (/TMP) • DEFAULT CONCURRENT EXECUTION LIMIT: 1000
  7. #codeeurope • $0.20 PER 1 MILLION REQUESTS • FIRST MILLION

    REQUESTS / MONTH ARE FREE • $0.00001667 FOR EVERT GB-SECOND • FIRST 400.000 GB-SECONDS / MONTH ARE FREE
  8. #codeeurope • NODE.JS • PYTHON • JAVA • C# •

    SHELL SCRIPTS • ANY EXECUTABLE AWS LAMBDA
  9. #codeeurope • NODE.JS • C# • F# • PYHON •

    PHP • SHELL SCRIPTS • ANY EXECUTABLE AZURE FUNCTIONS
  10. #codeeurope “IT IS A MISTAKE TO THINK YOU CAN SOLVE

    ANY MAJOR PROBLEMS JUST WITH POTATOES”
  11. #codeeurope • REAL-TIME APPS WITH WEB SOCKETS • LOW-LATENCY APPS

    • WHEN YOU NEED CUSTOM SERVER CONFIG • WHEN YOU NEED COMPLIANCE • LONG RUNNING TASKS • COMPEX COMPUTING • WHEN YOU NEED TO PROVIDE SLA
  12. #codeeurope • GOOD STARTUP PERFORMANCE • SMALL MODULES • PERFORMANCE

    WITH LOW CPU AND MEMORY • SINGLE THREAD • EASY TO LEARN PROS
  13. #codeeurope ‘use strict’ console.log(‘Loading event’) exports.handler = (event, context, callback)

    => { console.log(‘“Hello”: ”World”’) callback(null, {“Hello”: ”World”}) } hello-world.js
  14. #codeeurope • CREATE LAMBDA FUNCTION • UPLOAD ZIP FILE •

    CREATE API GATEWAY • SET TRIGGER • SET PERMISSIONS • ~11 MINS READ: http://amzn.to/2kciIEt HOW TO DEPLOY IT TO AWS
  15. #codeeurope • DEPLOY AND UPDATE WITH SINGLE COMMAND • USE

    STANDARD NPM MODULES • NO BOILERPLATE, JUST FOCUS ON YOUR WORK • MANAGE MULTIPLE VERSIONS EASILY • GET STARTED QUICKLY, LOW LEARNING CURVE MAIN CHARACTERISTICS
  16. #codeeurope • npm i claudia -g • SET UP AWS

    CREDENTIALS (ONE TIME) • mkdir claudia-api && cd $_ • npm init -f • npm i claudia-api-builder -S • npm i huh -S prepare
  17. #codeeurope ‘use strict’ const Api = require(‘claudia-api-builder‘) const api =

    new Api() const excuse = require(‘huh’) api.get(‘/‘, () => { return excuse.get() }) module.exports = api api.js
  18. #codeeurope { "lambda": { "role": "codeeurope-executor", "name": "codeeurope", "region": "eu-central-1"

    }, "api": { "id": "d1weoszyg7", "module": "api", "url": "https://d1weoszyg7.execute-api.eu central-1.amazonaws.com/latest" } } result
  19. #codeeurope • SERVER “EXISTS” FOR FEW HUNDREDS OF MS •

    READ-ONLY, EXCEPT /TMP • NO DEDICATED SERVER • SANDBOX / CONTAINERS • NO CONFIGURATION • AUTO SCALING • AWS ECOSYSTEM AWS LAMBDA SECURITY
  20. #codeeurope • BAD CODE • BAD PERMISSIONS • 3RD PARTY

    LIBRARIES • PROBLEMS WITH OTHER BUILDING BLOCKS,
 SUCH AS SQL INJECTION • KEYS AND SECRETS PROBLEMS