Azure Functions - Get rid of your servers, use functions!

Preview:

Citation preview

Get rid of your servers!

Use functions☁ + </> = 👊

Manuela RinkTechnical Evangelist@

#0The Theoretical Part**no excuses – first part needs to be theory!

Transformation from own “iron” to cloud VMs

Transformation from VMs to microservices / functions

We’ve come a long long way togetherThe cloud evolution

Serverlessor

Jeff*or

“just the next pig which is chased through the village?”

* Serverless is just a name, Paul Johnston

“[…] is a cloud computing code execution model in which the cloud provider fully manages starting and stopping virtual machines as necessary to serve requests, and requests are billed by an abstract measure of the resources required to satisfy the request, rather than per virtual machine, per hour.”

-- Wikipedia https://en.wikipedia.org/wiki/Serverless_computing

“Quick and easyrun pieces of code* in the cloud, without worrying about infrastructure or maintenance.”

-- Manu Rink, 2016

*of various size

AWS LambdaGA since April 2015

Azure FunctionsGA since November 2016

#1Functions!!!11eleven

*not long until the demos, I swear!

Code Events + data

Azure Functions

Inspired by Chris Anderson @ Microsoft

code outputinput

Inspired by Matthew Henderson @ Microsoft

“Function App” is a group of functions

“Function App”

foo()

bar()

foobar()

Inspired by Matthew Henderson @ Microsoft

Inherit from / Build on top of App Services

Full control of dependencies and connectors

Choose your fav language and coding

environment

Powerful integration of you existing Azure apps

Choose from a wide variety of triggers

100% operated

Open sourced

App Service Features and CapabilitiesEnterprise Grade AppsDesigned for secure mission-critical applications

Fully Managed PlatformOptimized for Availability and Automatic scale

High Productivity DevelopmentAgility through Continuous DeploymentHybrid Connections / VPN / VLAN

Scheduled BackupAzure Active Directory Integration Site Resiliency, HA, and DRWeb JobsRole Base Access Control Audit / Compliance Enterprise MigrationClient Certs CacheIP Restrictions/ SSLWeb SocketsSQL, MySQL, DocDB, & MongoSticky Sessions Authorization/ Authentication

Automated DeploymentAutoScaleBuilt-in Load BalancingWorldwide Datacenter CoverageEnd Point Monitoring & AlertsApp GalleryDR Site SupportWildCard SupportDedicated IP addressHTTP Compression CDN Support for WebsitesPremium WordPressApp Services Environments

Remote Debugging w/ Visual Studio Site Staging SlotsTesting in ProductionContinuous Integration/Deployment Git, Visual Studio Online and GitHubApp & Site DiagnosticsOS & Framework Patching Site Extensions Gallery NET, PHP, Python, Node, JavaFramework InstallerBrowser-based editingAuto-HealingLogging and Auditing Admin-SiteSupport Site Extension

Inspired by Matthew Henderson @ Microsoft

Templates• Azure Internal Service Triggers

• Blob• EventHub• Storage Queue• Service Bus Queue• Service Bus Topic

• Generic Triggers• Generic WebHook• GitHub WebHook• Http • Timer

Languages• Core• C#• JS/Node

• Experimental• PowerShell• Python• PHP• F#• Bash

#2Building the real stuff*!… in 4 stages*finally!

Yeaaah, but what can I build with ’em?

Scenario 0The Easy Cake

use HTTP trigger to provide HTTP endpointsto

build a Hello Cake endpoint

Scenario 0 – Easy cake! – Simple HTTP endpoint

Y

AX B

EasyCake

LIVE DEMO

Scenario 1Connect all the things!

use web hooks for wiring up heterogeneous services

to

connect Slack with your mobile backend

Scenario 1 - Connect all the things! – Slack & mobile backend

The Serverless Connector - Use Functions to write Slack posts in your mobile backend

Y

AX B

Connectall thethings!

LIVE DEMO

Scenario 2Like a pro!

use Blob Trigger to let function react on storage I/O of other function

to

build an image resizing service

Scenario 2 - Like a pro! – Image Resizing Service

https://github.com/codePrincess/resizingService

Scenario 2 - Like a pro! – Image Resizing Service

Y

AX B

Likeapro!

LIVE DEMO

Scenario 3The Fun Stuff!

use OCR of CS Computer Vision API and text detection logic in a function

to

build an identification card validation service

Scenario 3 – The fun stuff! – ID card validation service

https://github.com/codePrincess/funkyVerfication

Y

AX B

The funstuff!

LIVE DEMO

#3a Penny saved is a penny goT**’nuff said!

Cool stuff so far … and the costs?

*for the 1 million executions and the first 400.000 GB/s

It’s free*

Function executes 2.000.000 times with a duration of 1 second using 1536MB RAM

Resource consumption costs

2 million exec * 1 second = 2 million seconds1536 MB / 1024 MB = 1.5 GB1.5 GB * 2 million seconds = 3 million GBs3 million GBs – 400000 GBs = 2.6 million GBs2.6 million GBs * 0.000014 $/GBs = 41.60 $

Execution costs

2 million exec - 1 million exec = 1 million exec 1 million exec * 0.20$ = 0.20$

41.60$ + 0.20$ = 41.80$

Pricing OverviewPricing Calculator

Same example – just with 128MB RAM

0 $ + 0.20$ = 0.20$

Resource consumption costs

2 million exec * 1 second = 2 million seconds128 MB / 1024 MB = 0.125 GB0.125 GB * 2 million seconds = 0.25 million GBs0.25 million GBs – 400000 GBs = 0 GBs0 million GBs * 0.000016 $/GBs = 0 $

Execution costs

2 million exec - 1 million exec = 1 million exec 1 million exec * 0.20$ = 0.20$

#4... This is the end!

😻Easy to build & deploy – 100% operated

Various languages supported

Lot of triggers available

Inter-connectable in- & outside of Azure

Cost effective

#5... Where to go from here?

📚 Azure Functions documentationhttps://docs.microsoft.com/en-us/azure/azure-functions/

👸 Blogposts with How-Tos and source code to all examples in this deckhttps://medium.com/royallyserverless

😻 Nice and neat link and learning materialhttps://blogs.msdn.microsoft.com/appserviceteam/2016/12/01/running-azure-functions-locally-with-the-cli/ https://www.npmjs.com/package/azure-functions-cli https://contos.io/azure-functions-cli-quick-start-ee843dfbe72c#.v90g0n77d

🎉 Brandnew – Azure Functions now part of the Serverless Framework https://serverless.com/framework/docs/providers/azure/

It’s dangerous to go alone - take this!

Merci :)

Manu RinkTechnical Evangelist

marink@microsoft.com

@codeprincess

says

Recommended