åã¾ã§ã¯ AWS Lambda ã®ã³ã¼ãã GitHub ã§ç®¡çããæ¹æ³ã«æ©ãã§ãããã§ãããC# 対å¿ã§ .NET Core ã®ãã¼ã«ãç¨æãããã®ã§ CircleCI ãªã©ã§ãã«ããã¦ãããã¤ãããã¨ãç°¡åã«ãªãã¾ããã
C# ãµãã¼ãã«ã¤ãã¦çºè¡¨ãããããã°ã§ããä¸ã®æ¹ã« dotnet CLI ã便å©ã«ä½¿ãããã£ã¦æ¸ãã¦ã¾ããã
The Amazon.Lambda.Tools NuGet package adds commands to the new dotnet CLI that allow you to deploy your Lambda functions and serverless applications to AWS, no matter what platform you're on. Even if you are developing in Visual Studio on Windows, the AWS Lambda tools in the dotnet CLI are helpful for setting up a CI/CD pipeline for your application.
Announcing C# Support for AWS Lambda | AWS Compute Blog
dotnet lambda ã¨ãããµãã³ãã³ãã¯è¯ã使ãæ¹ã ã¨æãã¾ãã
æ¯å Visual Studio ã使ã£ã¦ãããã¤ããã®ã¯æéãªã®ã§ããã®éæ¸ãã SendGrid ã® Event Webhook ãåãåããµã³ãã«ã使ã£ã¦ãCircleCI ããã®ãããã¤ã試ãã¾ããã
Lambda ã«ä½æããé¢æ°ããããã¤ããã«ã¯ lambda deploy-function ãå®è¡ããã°ããã¿ããã§ããããã«ããè¦ãã¨ãã©ã¡ã¼ã¿ãçµæ§å¤ãã§ãã
æ¯åæå®ããã®ã¯æéãªã®ã§ããã㯠aws-lambda-tools-defaults.json ãç¨æãã¦ããã¾ãã
{ "Information" : [ "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", "dotnet lambda help", "All the command line options for the Lambda command can be specified in this file." ], "profile": "default", "region" : "ap-northeast-1", "configuration" : "Release", "framework" : "netcoreapp1.0", "function-runtime":"dotnetcore1.0", "function-memory-size" : 256, "function-timeout" : 30, "function-handler" : "AWSLambda1::AWSLambda1.Function::FunctionHandler" }
Visual Studio ã§æ°ãã AWS Lambda ã®ããã¸ã§ã¯ããä½æããã¨åæã«ä½æããã¦ããã¯ãã§ããprofile 㨠region ã空ã£ã½ãªã®ã§ profile 㯠default ã«ãregion ã¯ä½¿ããªã¼ã¸ã§ã³ã®ååãå ¥ãã¾ãã
profile ã default ã«ãã¦ããã¨ãCircleCI ã§è¨å®ããèªè¨¼æ å ±ã使ããã¾ãã
æå¾ã« circle.yml ã«ãã«ãã¨ãããã¤ã®ããã®ã³ãã³ããæ¸ãã¦ããã¾ãããã£ã¦ããã¨ã¯ã·ã³ãã«ã§ãã
ä¸å¿èª¬æãã¦ããã¨ãæåã« .NET Core ã®ã¤ã³ã¹ãã¼ã«ã¨ NuGet ããã±ã¼ã¸ã®å¾©å ãè¡ã£ã¦ããããã«ããéããã確èªãæå¾ã« Lambda ã¸ã®ãããã¤ã³ãã³ããå®è¡ãã¦ãã¾ãã
dependencies: pre: - sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 - sudo apt-get update - sudo apt-get install dotnet-dev-1.0.0-preview2-003131 override: - dotnet restore test: override: - cd AWSLambda1 && dotnet build deployment: master: branch: master commands: - cd AWSLambda1 && dotnet lambda deploy-function event-callback-function
CircleCI 㯠Ubuntu ã使ããã¦ããã®ã§ .NET Core ã Ubuntu ç¨ãã¤ã³ã¹ãã¼ã«ãã¦ãã¾ãã
å®éã«ãã«ããã㨠Lambda ã¸ã®ãããã¤ãè¡ããã¦ãããã¨ã CircleCI ã®ãã°ãã確èªã§ãã¾ãã
AWS CLI ã使ããã¨ãªã .NET Core ã®ãã¼ã«ãã§ã¼ã³ã ãã§å®çµãã¦ãã¾ãã®ã¯ããªã便å©ã§ããã
æ¢ã« Node.js ã§æ¸ãã¦ãã Lambda ã®ã³ã¼ãã C# ã§æ¸ãç´ã㦠CI/CD ã«ä¹ããããã¨æã£ã¦ãã¾ããããCircleCI ããç°¡åã«ãããã¤ãåºæ¥ãã¨åãã£ãã®ã§æºè¶³ã§ãã