當.Net Core遇到AWS Lambda
Jamis Liao
http://mvc.tw
 Jamis Liao
 微軟最有價值專家
 Tag
 ASP.Net
 MVC
 C#
 DevOps
 軟體開發流程
 系統架構
 Cloud Architecture
 Blog
 天橋下的說書人
About Me
2
http://mvc.tw
什麼是Serverless
3
Source: https://goo.gl/kMecqi
http://mvc.tw
 架構模式
 無伺服器的維護,AutoScaling的負擔
什麼是Serverless
4
http://mvc.tw
Different for IaaS PaaS
5
Source: https://goo.gl/kMecqi
http://mvc.tw
 Functions as a Service / FaaS
 AWS Lambda
 Azure Function
 Cloud Function
Funtion as a Service
6
http://mvc.tw
Funtion as a Service
7
http://mvc.tw
Serverless的好處
8
Source: https://goo.gl/kMecqi
http://mvc.tw
 AWS在2014年推出的Lambda無伺服器運算服務
 2017年開始支援.NET Core
AWS Lambda
9
http://mvc.tw
到底是少維護了什麼…………
10
伺服器
作業系統
容量佈建
自動擴展
安全性修補程式部署
監控和記錄程式碼
http://mvc.tw 11
以上通通不用你管
http://mvc.tw
到底是少維護了什麼…………
12
伺服器
作業系統
容量佈建
自動擴展
安全性修補程式部署
監控和記錄程式碼
http://mvc.tw
 Event-driven
 容易整合AWS自家其他服務
 S3
 CloudWatch
 DynamoDB
AWS Lambda
13
http://mvc.tw
 CloudWatch
 Schedule
 API Gateway
今天會用到
14
http://mvc.tw
 AWS Lambda對.NET Core的版本支援如下
 .NET Core: 1.0.5
 .NET standard: 1.6
 EF Core : 1.0.3
講講Lambda support的.NET Core
15
http://mvc.tw
 最新的套件不一定能用,就算是有支援.NET Core
不講你會Try到死的事
16
開始講講跟開發Lambda有關的事吧…………
17
你必須先安裝幫你產專案的工具
18
http://mvc.tw
 Lambda template CLI Tool
 dotnet new -i Amazon.Lambda.Templates::*
 dotnet new -all
Lambda template安裝
19
http://mvc.tw
 Yeoman
 npm install –g yo generator-aws-lambda-dotnet
 yo aws-lambda-dotnet
你還可以這樣產Lambda project
20
https://github.com/aws/aws-lambda-dotnet
http://mvc.tw
 AWS Toolkit for Visual Studio 2017
 https://goo.gl/U5xrer
其實還有一個更簡單的方法
21
http://mvc.tw
 .NET Core 1.1
 .csproj
 .NET Core 1.1
 Project.json
麻煩的.csproj
22
http://mvc.tw
 Lambda template CLI Tool
 Yeoman
但是……………產出來專案都是Project.json
23
http://mvc.tw
migration
24
http://mvc.tw
 AWS Toolkit for Visual Studio 2017
所以建議使用
25
http://mvc.tw
專案結構長這樣
26
http://mvc.tw
產出來的程式碼長這樣
27
http://mvc.tw
 指定Target framework
 netstandard 1.6
 netcoreapp 1.0
 看懂csproj的Tag
 PackageReference
 DotNetCliToolReference
 ProjectReference
開發你必須要注意的
28
http://mvc.tw
 指定Target framework
 netstandard 1.6
 netcoreapp 1.0
 看懂csproj的Tag
 PackageReference
 DotNetCliToolReference
 ProjectReference
開發你必須要注意的
29
http://mvc.tw
 序列化套件的問題
 不要自己裝Json.net
30
http://mvc.tw
 序列化套件的問題
 不要自己裝Json.net
31
http://mvc.tw
 變成Console程式
 OutputType: Exe
 一樣可以使用Multi project
開發 & Debug小技巧
32
http://mvc.tw
 profile
 region
 function-memory-size
 function-timeout
 function-handler
 {DLL Name}::{Class namespace}:{Method name}
aws-lambda-tools-defaults.json
33
34
AWS Lambda
http://mvc.tw
 Lambda Tool
 lambda deploy-function
 lambda invoke-function
 lambda delete-function
 lambda update-function
 package + web
 Lambda help
How to deploy
35
http://mvc.tw
 invoke-function
 --pyload from file
Deploy完了………那要怎麼用呢?
36
37
Lambda tool
http://mvc.tw
 Schedule
 Event觸發
 AutoScaling
 S3
 …………
 定時觸發
 可自行定義輸入參數
CloudWatch
38
http://mvc.tw
 Event
Trigger
39
http://mvc.tw
 Event
Trigger
40
http://mvc.tw 41
http://mvc.tw
 Fixed
 Cron
Schedule
42
http://mvc.tw
 Fixed
 Cron
Schedule
43
http://mvc.tw
輸入參數
44
http://mvc.tw
 CloudWatch
Lambda Log
45
http://mvc.tw
 Lambda log
 CloudWatch
Log
46
http://mvc.tw
Log
47
48
CloudWatch setting
http://mvc.tw
 API Gateway
 API
幫Lambda加個URL吧
49
http://mvc.tw
 API Gateway
 API
 Resource
 Method
幫Lambda加個URL吧
50
http://mvc.tw 51
52
APIGateway setting
http://mvc.tw
Blog 是記錄知識的最佳平台
53
https://dotblogs.com.tw
http://mvc.tw
Jetbrains 重構必備工具
54
https://www.jetbrains.com/resharper/
http://mvc.tw
OzCode 偵錯的魔法師
55
http://www.oz-code.com/
http://mvc.tw
業界師資、實戰教學
56
https://skilltree.my
謝謝各位
• 本投影片所包含的商標與文字皆屬原著作者所有。
• 本投影片使用的圖片皆從網路搜尋。
• 本著作係採用姓名標示-非商業性-相同方式分享 3.0 台灣授權。閱讀本授權條款,請到
http://creativecommons.org/licenses/by-nc-sa/3.0/tw/,或寫信至Creative Commons, 444 Castro
Street, Suite 900, Mountain View, California, 94041, USA.
h t t p s : / / m v c . t w

More Related Content

PDF
twMVC#23 | 快速上手 Azure Functions
PDF
twMVC#21 | 以實例說明ASP.NET Web API 服務的開發與測試過程
PDF
twMVC#28 | visual studio 2017 新功能介紹
PDF
twMVC#22 | 一個微信專案從0到.000的效能調教之路
PDF
twMVC#19 | opserver監控服務的解決
PDF
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
PDF
twMVC#24 | 開發團隊的敏捷之路(未完成)
PDF
twMVC#21 | 你所不知道的 Visual Studio
twMVC#23 | 快速上手 Azure Functions
twMVC#21 | 以實例說明ASP.NET Web API 服務的開發與測試過程
twMVC#28 | visual studio 2017 新功能介紹
twMVC#22 | 一個微信專案從0到.000的效能調教之路
twMVC#19 | opserver監控服務的解決
twMVC#25 | ASP.NET MVC A/B Testing 的眉眉角角
twMVC#24 | 開發團隊的敏捷之路(未完成)
twMVC#21 | 你所不知道的 Visual Studio

What's hot (20)

PDF
twMVC#23 | 一個Mobile App開發、維護與改版的愛恨之路
PDF
twMVC#29 -Learning Machine Learning with Movie Recommendation
PDF
twMVC#20 | ASP.NET MVC View 開發技巧小錦囊
PDF
Angular js twmvc#17
PDF
twMVC#19 | 微信公眾平台申請與wechat api 開發血淚史
PDF
twMVC#26 | Redis資料型別與場景的連結
PDF
動手打造 application framework-twMVC#15
PDF
twMVC#22 | 什麼鬼的IOC與DI
PDF
專案分層架構 twMVC#18
PDF
一小時可以打造什麼服務Plus twMVC#18
PPTX
twMVC#31沒有 hdd 的網站重構 webform to mvc
PPTX
twMVC#31網站上線了然後呢
PDF
Asp.net mvc 從無到有 -twMVC#2
PDF
輕鬆上手Asp.net web api 2.1-twMVC#14
PDF
開發的效能與效率-twMVC#15
PDF
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
PPTX
MVC實戰分享 分頁與排序相關技巧-tw mvc#13
PDF
如何在實務上使用TDD來開發 twmvc#12
PDF
twMVC#33聊聊如何自建 Facebook {廣告} 服務 with API
PPTX
ASP.NET MVC 善用網路資源快速完打造網站
twMVC#23 | 一個Mobile App開發、維護與改版的愛恨之路
twMVC#29 -Learning Machine Learning with Movie Recommendation
twMVC#20 | ASP.NET MVC View 開發技巧小錦囊
Angular js twmvc#17
twMVC#19 | 微信公眾平台申請與wechat api 開發血淚史
twMVC#26 | Redis資料型別與場景的連結
動手打造 application framework-twMVC#15
twMVC#22 | 什麼鬼的IOC與DI
專案分層架構 twMVC#18
一小時可以打造什麼服務Plus twMVC#18
twMVC#31沒有 hdd 的網站重構 webform to mvc
twMVC#31網站上線了然後呢
Asp.net mvc 從無到有 -twMVC#2
輕鬆上手Asp.net web api 2.1-twMVC#14
開發的效能與效率-twMVC#15
twMVC#42 Azure DevOps Service Pipeline設計與非正常應用
MVC實戰分享 分頁與排序相關技巧-tw mvc#13
如何在實務上使用TDD來開發 twmvc#12
twMVC#33聊聊如何自建 Facebook {廣告} 服務 with API
ASP.NET MVC 善用網路資源快速完打造網站
Ad

Similar to twMVC#29 | 當.Net Core 遇到AWS Lambda (20)

PDF
Asp.net+mvc4框架揭秘
PDF
20130823微軟雲端平台開發者日
PDF
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
PDF
ASP.NET MVC Web API -twMVC#8
PDF
twMVC#08 | Web API
PDF
AWS雲端架構師 培訓&考試課程介紹
PPTX
基于AWS Lambda的无服务器架构在Strikingly中的应用
PDF
Ruby on rails部署
PDF
Global Azure Bootcamp 2015 at Study4
PDF
twMVC#02 | ASP.NET MVC 從無到有
PDF
簡化 JVM 上雲 - 透過 Azure Spring Cloud 提升開發、發佈及服務監控效率
PPSX
利用 ASP.NET MVC 提升您的 Web 應用程式
PDF
Real World ASP.NET MVC
PDF
Eucalyptus安装及实例映像制作
PDF
twMVC#14 | 輕鬆上手ASP.NET Web API 2
PDF
Aws容器服务详解
PPT
新浪云计算公开课第一期:Let’s run @ sae(丛磊)
PPT
Cloud Computing Introduction
PPT
IDC大会:新浪SAE架构与设计
PDF
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
Asp.net+mvc4框架揭秘
20130823微軟雲端平台開發者日
twMVC#05 |開發與移轉 ASP.NET MVC 4.0 應用程式到 Windows Azure Platform
ASP.NET MVC Web API -twMVC#8
twMVC#08 | Web API
AWS雲端架構師 培訓&考試課程介紹
基于AWS Lambda的无服务器架构在Strikingly中的应用
Ruby on rails部署
Global Azure Bootcamp 2015 at Study4
twMVC#02 | ASP.NET MVC 從無到有
簡化 JVM 上雲 - 透過 Azure Spring Cloud 提升開發、發佈及服務監控效率
利用 ASP.NET MVC 提升您的 Web 應用程式
Real World ASP.NET MVC
Eucalyptus安装及实例映像制作
twMVC#14 | 輕鬆上手ASP.NET Web API 2
Aws容器服务详解
新浪云计算公开课第一期:Let’s run @ sae(丛磊)
Cloud Computing Introduction
IDC大会:新浪SAE架构与设计
twMVC#04 | ASP.NET MVC 4 新功能介紹(快速上手)
Ad

More from twMVC (20)

PDF
twMVC#51 以平台工程重新思考系統設計 - 以 Batch System 為例封面
PDF
twMVC#51-GitHub Copilot 徹底改變開發模式,探索 AI 驅動的智慧程式碼協作
PDF
twMVC#50 微服務上線後的救贖
PDF
twMVC 47_Elastic APM 的兩三事
PDF
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
PDF
.NET 7 家族新成員: Microsoft Orleans v7
PDF
twMVC#46 一探 C# 11 與 .NET 7 的神奇
PDF
twMVC#44 如何測試與保護你的 web application with playwright
PDF
twMVC#44 讓我們用 k6 來進行壓測吧
PDF
twMVC#43 Visual Studio 2022 新功能拆解
PDF
twMVC#43 YARP
PDF
twMVC#43 C#10 新功能介紹
PDF
twMVC#42 Azure IoT Hub for Smart Factory
PDF
twMVC#42 Windows容器導入由0到1
PDF
twMVC#42 讓我們用一種方式來開發吧
PDF
twMVC#41 hololens2 MR
PPTX
twMVC#41 The journey of source generator
PDF
twMVC#38 How we migrate tfs to git(using azure dev ops)
PDF
twMVC#36C#的美麗與哀愁
PDF
twMVC#36.NetCore 3快速看一波
twMVC#51 以平台工程重新思考系統設計 - 以 Batch System 為例封面
twMVC#51-GitHub Copilot 徹底改變開發模式,探索 AI 驅動的智慧程式碼協作
twMVC#50 微服務上線後的救贖
twMVC 47_Elastic APM 的兩三事
twMVC#46_SQL Server 資料分析大躍進 Machine Learning Services
.NET 7 家族新成員: Microsoft Orleans v7
twMVC#46 一探 C# 11 與 .NET 7 的神奇
twMVC#44 如何測試與保護你的 web application with playwright
twMVC#44 讓我們用 k6 來進行壓測吧
twMVC#43 Visual Studio 2022 新功能拆解
twMVC#43 YARP
twMVC#43 C#10 新功能介紹
twMVC#42 Azure IoT Hub for Smart Factory
twMVC#42 Windows容器導入由0到1
twMVC#42 讓我們用一種方式來開發吧
twMVC#41 hololens2 MR
twMVC#41 The journey of source generator
twMVC#38 How we migrate tfs to git(using azure dev ops)
twMVC#36C#的美麗與哀愁
twMVC#36.NetCore 3快速看一波

twMVC#29 | 當.Net Core 遇到AWS Lambda