aws-samples / aws-cdk-build-package-publish-dotnet-lambda-function

This Repository contents sample source code that shows how to streamline building, packaging, and publishing .NET Lambda functions using AWS CDK with C#.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build, package, and publish .NET C# Lambda functions with the AWS CDK

This Repository contents sample source code that shows how to streamline building, packaging, and publishing .NET Lambda functions using AWS CDK with C#.

Implementation and Deployment

Prerequisites:

  1. Visual Studio Code (or your preferred IDE).
  2. AWS account.
  3. .NET 6 SDK
  4. AWS Cloud Development Kit (CDK) (https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html).
  5. GIT (https://git-scm.com/download).
  6. Docker

To learn how to implement CDK C# to build, package and publish lambda code follow the implementation on the file infra/src/Infra/InfraStack.cs.

Execute the following commands to deploy and test the solution

Deploy:

cd /infra
cdk deploy --profile <your AWS account profile alias>

Test:

Once the deployment is complete, copy the endpoint from the terminal output and make HTTP GET Request. The format of the endpoint should be similar to https://xxxyyyzzz.execute-api.us-east-1.amazonaws.com/prod/.

curl https://xxxyyyzzz.execute-api.us-west-2.amazonaws.com/prod/
curl https://xxxyyyzzz.execute-api.us-west-2.amazonaws.com/prod/functiontwo
curl https://xxxyyyzzz.execute-api.us-west-2.amazonaws.com/prod/functionthree                                                             

References

To learn more about the implementation read the blog post Build, package, and publish .NET C# Lambda functions with the AWS CDK

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

About

This Repository contents sample source code that shows how to streamline building, packaging, and publishing .NET Lambda functions using AWS CDK with C#.

License:MIT No Attribution


Languages

Language:C# 100.0%