ASP.NET CORE ON
SERVERLESS
COMPUTING
Travis Gosselin | Principal Software Engineer
2
OVERVIEW
What is Serverless?
“Does that mean there are no servers?”
.NET Core on Serverless
AWS Lambda and other Serverless Components
ASP.NET Core MVC on AWS Lambda
Dealing with code granularity and using vendor abstractions
WHAT IS SERVERLESS?
3
DOES THAT MEAN
THERE ARE NO
SERVERS RUNNING IT?
4
“Serverless architectures refer to applications
that significantly depend on third-party services
("BaaS") or on custom code that's run in
ephemeral containers ("FaaS")”.
Martin Fowler
Programmer, Loud Mouth, Thought Worker
5
“Serverless Computing is like this - Your code, a
slider bar, and your credit card. You just have your
function out there and it will scale as long as you can pay
for it. It's as close to "cloudy" as The Cloud can get.”
Scott Hanselman
Microsoft
6
WHAT IS SERVERLESS?
7
Serverless: First used to describe continuous integration and source control
servers in “the cloud” (around 2010?).
SaaS Why Do I Care?
• No Servers Provision or Manage
• Never Pay for Idle or “Always On”
• Infinite, Automatic Scaling
• ITS CHEAPER!
EVOLUTION OF INFRASTRUCTURE
8
“A Spectrum of Compute”
Unit of
Scale
Packaging Execution Run Time Cost
VMs Machine Images Multi-threaded Hours to
months
Per VM / Hour
Containers Application Container File Multi-threaded,
single task
Minutes to
days
Per VM / Hour
Serverless Function Code Single-thread,
single-task
Micro-seconds
to seconds
Per Memory /
Second /
Request
AWS Re:invent 2016 – Werner Vogels
TRADITIONAL
9
SERVERLESS (FAAS)
DEMO
AWS LAMBDA with .NET Core
10
API GATEWAY
Lambda
• Managed FaaS
• Compute Service
• Node.js, Java, .NET,
Python
• Triggered by Events
CONSIDERATIONS
11
Multi-Tenancy
Vendor Limitations
Testing
Deploy / Package / Version
Monitoring & Debugging
Code Fragmentation / Granularity
Vendor Dep. / Lock-In
Security Touchpoints
Custom Optimizations
Server State
SERVERLESS IS “NOT
ONE SIZE FITS ALL”!
12
Mobile Backend
Static Websites
Event / Data Processing
Scheduled Tasks
Microservices!
“Serverless will Eat Containers in the Microservices world.”
13
“What's Better Than Microservices?
Serverless Microservices!”
DEMO
AWS LAMBDA with ASP.NET CORE MVC (WEB API)
14
/api/test1
/api/test2
/api/test3
API
Gateway
Proxy
Function
API GATEWAY
PROXY +ANY
GET /API/TEST1 JSON PAYLOAD
AWS SAM CLOUD FORMATION
YOUR CODE
RESOURCES
15
• Serverless Architectures: https://martinfowler.com/articles/serverless.html
• AWS VS Toolkit: https://aws.amazon.com/visualstudio/
• aws-lambda-dotnet: https://github.com/aws/aws-lambda-dotnet
• Meetup Weather API: https://github.com/travisgosselin/meetup-weather-api
travisgosselin.com @travisjgosselin

ASP.NET Core on Serverless Computing (AWS)

  • 1.
    ASP.NET CORE ON SERVERLESS COMPUTING TravisGosselin | Principal Software Engineer
  • 2.
    2 OVERVIEW What is Serverless? “Doesthat mean there are no servers?” .NET Core on Serverless AWS Lambda and other Serverless Components ASP.NET Core MVC on AWS Lambda Dealing with code granularity and using vendor abstractions
  • 3.
  • 4.
    DOES THAT MEAN THEREARE NO SERVERS RUNNING IT? 4
  • 5.
    “Serverless architectures referto applications that significantly depend on third-party services ("BaaS") or on custom code that's run in ephemeral containers ("FaaS")”. Martin Fowler Programmer, Loud Mouth, Thought Worker 5
  • 6.
    “Serverless Computing islike this - Your code, a slider bar, and your credit card. You just have your function out there and it will scale as long as you can pay for it. It's as close to "cloudy" as The Cloud can get.” Scott Hanselman Microsoft 6
  • 7.
    WHAT IS SERVERLESS? 7 Serverless:First used to describe continuous integration and source control servers in “the cloud” (around 2010?). SaaS Why Do I Care? • No Servers Provision or Manage • Never Pay for Idle or “Always On” • Infinite, Automatic Scaling • ITS CHEAPER!
  • 8.
    EVOLUTION OF INFRASTRUCTURE 8 “ASpectrum of Compute” Unit of Scale Packaging Execution Run Time Cost VMs Machine Images Multi-threaded Hours to months Per VM / Hour Containers Application Container File Multi-threaded, single task Minutes to days Per VM / Hour Serverless Function Code Single-thread, single-task Micro-seconds to seconds Per Memory / Second / Request AWS Re:invent 2016 – Werner Vogels
  • 9.
  • 10.
    DEMO AWS LAMBDA with.NET Core 10 API GATEWAY Lambda • Managed FaaS • Compute Service • Node.js, Java, .NET, Python • Triggered by Events
  • 11.
    CONSIDERATIONS 11 Multi-Tenancy Vendor Limitations Testing Deploy /Package / Version Monitoring & Debugging Code Fragmentation / Granularity Vendor Dep. / Lock-In Security Touchpoints Custom Optimizations Server State
  • 12.
    SERVERLESS IS “NOT ONESIZE FITS ALL”! 12 Mobile Backend Static Websites Event / Data Processing Scheduled Tasks Microservices!
  • 13.
    “Serverless will EatContainers in the Microservices world.” 13 “What's Better Than Microservices? Serverless Microservices!”
  • 14.
    DEMO AWS LAMBDA withASP.NET CORE MVC (WEB API) 14 /api/test1 /api/test2 /api/test3 API Gateway Proxy Function API GATEWAY PROXY +ANY GET /API/TEST1 JSON PAYLOAD AWS SAM CLOUD FORMATION YOUR CODE
  • 15.
    RESOURCES 15 • Serverless Architectures:https://martinfowler.com/articles/serverless.html • AWS VS Toolkit: https://aws.amazon.com/visualstudio/ • aws-lambda-dotnet: https://github.com/aws/aws-lambda-dotnet • Meetup Weather API: https://github.com/travisgosselin/meetup-weather-api travisgosselin.com @travisjgosselin