How to take advantage of the AWS platform to create an efficient, scalable and "economically" sustainable software ecosystem. All this without OS to install or "patch" and especially without servers to maintain.
min bare metal server virtualization containers serverless > 30% 5% 10-15% 20-25% The lower the utilization, the less value you’re getting for your money
RPC) (past - then) exactly once delivery at least once delivery A long time ago 2017 Changes requires a massive shift in the way IT operates Message-Passing Shared-Nothing
responding to requests for computation and processing data based on events and ensuring application code loads, executes, and runs with sufficient resources.
and the philosophies of functional programming. Breaking down your application logic into small, discrete parts (or, pure functions) you can explicitly declare, test and control application logic in a demonstrable and repeatable way.
to scale up an entire application; instead, it distributes and scales only specific functions. The user pays only for the time function in serving the requests.
the business logic 2. Discrete services that react to events or requests 3. Scaled, fault tolerant and secure by provider 4. Significantly depend on third-party services 5. Cost-efficient: you will never pay for idle servers and you are charged by individual invocations
Model (by IAM) Simple Development & Deployment (a zip file) Reduced TTM & Developer Focused Pay Per Execution & Run when I need it Continuous Scaling & Fault Tolerance
& state data in local server memory There’s no dedicated hardware option with serverless Testing is more complicated We have some Lambda limits Vendor Lock-In
don’t know how or where objects are stored ◉ S3 stores those objects transparently ◉ We don't have space or disks to manage ◉ We are charged only by amount stored
Lambda executes code on demand ◉ We don’t know how or where code are executed ◉ We don't have VM’s or containers to manage ◉ We are charged only by invocations / execution time
by an event ◦ Fully automated (resources allocation) ◉ Require ◦ An event source (where the event happens) ◦ A function to execute (a zip package) ◦ An event source mapping (metadata) ◦ Right permissions (role & policies)
to lambda processing ◦ Lambda then executes code by passing the event payload to the function handler ◉ Who ? ◦ Api calls made by AWS SDK ◦ Manual user invocation via the Web Console ◦ HTTP requests through the Api Gateway ◦ Scheduled (Cron/Jobs) ◦ Events raised in AWS (S3, Kinesis, DynamoDb, etc..)
send a response back to the event source. ◦ Events are queued before being used to invoke the Lambda function (retry policies) ◦ Used by S3, SNS ◉ Request-Response (sync) ◦ Forces Lambda to execute the function synchronously and return the response to the caller. ◦ Used by API Gateway, AWS Console, AWS SDK, etc.
A service (like S3 o API Gateway) publishes an event to Lambda and directly invokes the function ◦ Event source mapping reside in the service (S3) ◉ Pull (stream based) ◦ Lambda runtime polls streaming event source (Kinesis or DynamoDB) and invokes the function when new data arrives. ◦ Event source mapping reside in Lambda
- PUSH Async invoke Sync invoke Kinesis Streams and DynamoDB Streams Events are queued, support retries on errors and DLQ Event Source is responsible for retries
contains metadata about current execution Callback: returns errors or success message to the caller File JS: handler.js + Exports: hello = handler.hello
Infrastructure • Scaffolding & Automation • Multi-Runtimes (NodeJs, Java, Pyton, etc...) • Permission Management (full IAM) • Multi-Providers (less vendor lock-in) • Local Development • Extensibility in mind (plug-ins model) • Open source • Community Support • and much more...
region: eu-west-1 functions: hello: description: "Hello WebDev lambda!" handler: handler.hello Serveless YML “A Service is the Framework's unit of organization. You can think of it as a project file, though you can have multiple services for a single application. It's where you define your Functions, the Events that trigger them, and the Resources your Functions use”
➔ step by step: ➔ create an Hello World API ➔ deploy the API to un AWS environment ➔ invoke the API endpoint to see it working ➔ add a function and new endpoint to the API ➔ deploy the updated API ➔ invoke the new endpoint