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

Serverless Functions Azure, AWS, GCP

Serverless Functions Azure, AWS, GCP

Comparison of Function-as-a-Service offerings of AWS, Azure, and GCP

Mikhail Shilkov

October 30, 2019
Tweet

More Decks by Mikhail Shilkov

Other Decks in Programming

Transcript

  1. • Software developer • Cloud • Serverless • Functional programming

    • Microsoft Azure MVP https://mikhail.io @MikhailShilkov Mikhail Shilkov
  2. Language Azure Functions AWS Lambda Google Cloud Functions .NET (C#/F#)

    GA GA - Node.js (JS/TS) GA GA GA JVM (Java) GA GA - Python GA (Linux only) GA GA PowerShell Preview GA - Go - GA GA Ruby - GA - Comparison Table
  3. Azure Functions: Triggers and Bindings [FunctionName("MyFunc")] public static void Work(

    [TimerTrigger("0 */10 * * * *")] TimerInfo timer, [Blob("filename")] Stream stream, [Queue("myqueue")] out string message) { // body }
  4. AWS: JSON Input and Output exports.handler = async (event) =>

    { const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; };
  5. ASP.NET Core on AWS Lambda public class LambdaFunction : Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction

    { protected override void Init(IWebHostBuilder builder) { builder .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup() .UseApiGateway(); } }
  6. GCP: Express-like API exports.helloWorld = (req, res) => { let

    message = req.query.message || req.body.message || 'Hello World!'; res.status(200).send(message); };
  7. Azure Durable Functions public static async Task Sequential(DurableOrchestrationContext context) {

    var conf = await context.CallActivityAsync<ConfTicket> ("BookConference", "ServerlessDays"); var flight = await context.CallActivityAsync<FlightTickets> ("BookFlight", conf.Dates); await context.CallActivityAsync("BookHotel", flight.Dates); }
  8. Fighting Cold Starts: Azure [FunctionName("Warmer")] public static void WarmUp( [TimerTrigger("0

    */10 * * * *")] TimerInfo timer) { // No need to do anything }