All Projects → aidansteele → demo-serverless-aspnetcore

aidansteele / demo-serverless-aspnetcore

Licence: other
ASP.Net Core 3.1 on AWS Lambda demo

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to demo-serverless-aspnetcore

Serverless Next.js
⚡ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+13431.82%)
Mutual labels:  aws-lambda, api-gateway
Yoyo
A dead simple comment engine built on top of AWS lambda and React, alternative comment service to Disqus.
Stars: ✭ 210 (+854.55%)
Mutual labels:  aws-lambda, api-gateway
Zappa
Serverless Python
Stars: ✭ 11,859 (+53804.55%)
Mutual labels:  aws-lambda, api-gateway
Hello Lambda
🔥 An example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform.
Stars: ✭ 114 (+418.18%)
Mutual labels:  aws-lambda, api-gateway
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (+36.36%)
Mutual labels:  aws-lambda, api-gateway
Aws Lambda Blog
AWS Lambda serverless blogging platform
Stars: ✭ 119 (+440.91%)
Mutual labels:  aws-lambda, api-gateway
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (+786.36%)
Mutual labels:  aws-lambda, api-gateway
Scandium
🚀 Easily deploy any Node.js web server to AWS Lambda
Stars: ✭ 61 (+177.27%)
Mutual labels:  aws-lambda, api-gateway
shim
HTTP Handler shim for Go projects running on AWS Lambda
Stars: ✭ 64 (+190.91%)
Mutual labels:  aws-lambda, api-gateway
GatewayService
GatewayService (Ocelot).
Stars: ✭ 19 (-13.64%)
Mutual labels:  aspnetcore, api-gateway
Serverless Sharp
Serverless image optimizer for S3, Lambda, and Cloudfront
Stars: ✭ 102 (+363.64%)
Mutual labels:  aws-lambda, api-gateway
mangum-cli
CLI tools for use with Mangum
Stars: ✭ 14 (-36.36%)
Mutual labels:  aws-lambda, api-gateway
Jrestless
Run JAX-RS applications on AWS Lambda using Jersey. Supports Spring 4.x. The serverless framework can be used for deployment.
Stars: ✭ 93 (+322.73%)
Mutual labels:  aws-lambda, api-gateway
Serverless Architectures Aws
The code repository for the Serverless Architectures on AWS book
Stars: ✭ 120 (+445.45%)
Mutual labels:  aws-lambda, api-gateway
React Apig Lambda
Render React.js on-demand with CDN caching
Stars: ✭ 93 (+322.73%)
Mutual labels:  aws-lambda, api-gateway
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: ✭ 171 (+677.27%)
Mutual labels:  aws-lambda, api-gateway
Aws Power Tuner Ui
AWS Lambda Power Tuner UI is an open source project creating a deployable easy to use website built on a layered technology stack allowing you to optimize your Lambda functions for cost and/or performance in a data-driven way via an easy to use UI.
Stars: ✭ 52 (+136.36%)
Mutual labels:  aws-lambda, api-gateway
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+38259.09%)
Mutual labels:  aws-lambda, api-gateway
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+881.82%)
Mutual labels:  aws-lambda, api-gateway
nestjs-graphql-serverless
Boilerplate for using NestJS with GraphQL (Code-First) on serverless environment (AWS Lambda)
Stars: ✭ 64 (+190.91%)
Mutual labels:  aws-lambda, api-gateway

ASP.Net Core 3.1 on AWS Lambda demo

logo

As of the end of March 2020, AWS Lambda supports ASP.Net Core 3.1. As of mid-March 2020, API Gateway HTTP APIs become generally available. The combination of these two releases means that the best way (in my opinion!) of writing, deploying and running serverless web apps in the cloud is now even better.

My favourite pattern for architecting a serverless .Net website is to put a regular ASP.Net Core website into a Lambda function wholesale. This means that developers can do local development, unit tests, integration tests the exact same way they know and love and take advantage of serverless infrastructure.

This repo contains everything you need to take the standard ASP.Net Core "web API" template and continuously deploy it to AWS Lambda. Here's what's been added:

Additions to standard template

  • .github/workflows/ci.yml: This is the GitHub Actions pipeline for building and deploying this project to AWS Lambda. The steps are:

    • Setting up .Net SDK and AWS Lambda CLI
    • Run unit and integration tests
    • Run ReSharper checks and reports on PRs
    • Build and package app into a zip file suitable for upload to AWS
    • Log into AWS (this requires you to configure AWS creds in GitHub)
    • Use CloudFormation to deploy the Lambda function and HTTP API
  • src/HelloWorld/Program.cs: This file has been refactored to support the slightly different way that an ASP.Net Core app is started in Lambda. You shouldn't need to touch this file at all, except for changing logging.

  • src/HelloWorld/Startup.cs: The only change to this file is to add a (trivial) dependency-injected IValuesService to demonstrate integration testing in the test project.

  • test/HelloWorld.Tests/TestValuesController.cs: This file demonstrates ASP.Net Core integration tests in the style made possible by Microsoft.AspNetCore.Mvc.Testing. A mock IValuesService is injected. This shows that tests don't have to be written any differently just because the app is hosted in Lambda.

  • serverless.yml: This file contains the entirety of the serverless infrastructure needed to host the website. The key to the file's conciseness is the AWS::Serverless::Function that can magic up an API.

So what should I do?

First, you'll want to create your own copy of this template repo by clicking this button on the top right of this page:

Use this template

Once your repo has been created, the first run in GitHub Actions will unfortunately fail because you haven't yet setup secrets. You'll want to follow this AWS guide to setup your secrets in GitHub. You'll know it's done correctly when your secrets look like this:

Example of well-configured secrets

Finally, once your secrets are configured correctly your pipeline will run successfully. PRs have will run unit tests and building, but only the master branch will get deployed. To access your website, go to your Action's logs, click the arrow next to the Deploy step and look for the ApiUrl output. It should look something like this:

Example output

You can then navigate to that URL in your browser - and add /api/values onto the end of the URL to see the fruits of your labour!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].