{"id":24013908,"url":"https://github.com/aidansteele/demo-serverless-aspnetcore","last_synced_at":"2025-04-15T09:43:26.546Z","repository":{"id":47572117,"uuid":"252619391","full_name":"aidansteele/demo-serverless-aspnetcore","owner":"aidansteele","description":"ASP.Net Core 3.1 on AWS Lambda demo","archived":false,"fork":false,"pushed_at":"2023-08-27T01:21:09.000Z","size":27,"stargazers_count":24,"open_issues_count":8,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T18:54:08.032Z","etag":null,"topics":["api-gateway","aspnetcore","aws","aws-lambda","serverless"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aidansteele.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-03T03:01:54.000Z","updated_at":"2024-03-05T20:27:41.000Z","dependencies_parsed_at":"2022-09-06T15:50:39.457Z","dependency_job_id":null,"html_url":"https://github.com/aidansteele/demo-serverless-aspnetcore","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidansteele%2Fdemo-serverless-aspnetcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidansteele%2Fdemo-serverless-aspnetcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidansteele%2Fdemo-serverless-aspnetcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aidansteele%2Fdemo-serverless-aspnetcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aidansteele","download_url":"https://codeload.github.com/aidansteele/demo-serverless-aspnetcore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249047311,"owners_count":21204229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-gateway","aspnetcore","aws","aws-lambda","serverless"],"created_at":"2025-01-08T06:57:59.735Z","updated_at":"2025-04-15T09:43:26.524Z","avatar_url":"https://github.com/aidansteele.png","language":"C#","readme":"# ASP.Net Core 3.1 on AWS Lambda demo\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"logo\" src=\"https://user-images.githubusercontent.com/369053/78321254-2f39bf00-75b7-11ea-9d6f-5962c7cf4dd8.png\"\u003e\n\u003c/p\u003e\n\nAs of the end of March 2020, AWS Lambda [supports ASP.Net Core 3.1][lambda-support].\nAs of mid-March 2020, API Gateway [HTTP APIs become generally available][http-api-ga].\nThe combination of these two releases means that the best way (in my opinion!) of \nwriting, deploying and running serverless web apps in the cloud is now even better.\n\nMy favourite pattern for architecting a serverless .Net website is to put a regular\nASP.Net Core website into a Lambda function wholesale. This means that developers \ncan do local development, unit tests, integration tests the exact same way they\nknow and love **and** take advantage of serverless infrastructure.\n\nThis repo contains everything you need to take the standard ASP.Net Core \"web API\"\ntemplate and continuously deploy it to AWS Lambda. Here's what's been added:\n\n## Additions to standard template\n\n* [`.github/workflows/ci.yml`](.github/workflows/ci.yml): This is the [GitHub Actions][actions]\n  pipeline for building and deploying this project to AWS Lambda. The steps are:\n  \n  * Setting up .Net SDK and AWS Lambda CLI\n  * Run unit and integration tests\n  * Run [ReSharper checks][resharper-action] and reports on PRs\n  * Build and package app into a zip file suitable for upload to AWS\n  * Log into AWS (this requires you to [configure AWS creds in GitHub][aws-action])\n  * Use CloudFormation to deploy the Lambda function and HTTP API\n  \n* [`src/HelloWorld/Program.cs`](src/HelloWorld/Program.cs): This file has been\n  refactored to support the slightly different way that an ASP.Net Core app is\n  started in Lambda. You shouldn't need to touch this file at all, except for\n  changing logging.\n  \n* [`src/HelloWorld/Startup.cs`](src/HelloWorld/Startup.cs): The only change to\n  this file is to add a (trivial) dependency-injected `IValuesService` to demonstrate\n  integration testing in the test project.\n  \n* [`test/HelloWorld.Tests/TestValuesController.cs`](test/HelloWorld.Tests/TestValuesController.cs): \n  This file demonstrates [ASP.Net Core integration tests][anc-tests] in the style\n  made possible by `Microsoft.AspNetCore.Mvc.Testing`. A mock `IValuesService` \n  is injected. This shows that tests don't have to be written any differently \n  just because the app is hosted in Lambda.\n  \n* [`serverless.yml`](serverless.yml): This file contains the entirety of the\n  serverless infrastructure needed to host the website. The key to the file's\n  conciseness is the [`AWS::Serverless::Function`][sam-function] that can magic up\n  an API.\n\n## So what should I do?\n\nFirst, you'll want to create your own copy of this template repo by clicking \nthis button on the top right of this page:\n\n\u003cimg width=\"132\" alt=\"Use this template\" src=\"https://user-images.githubusercontent.com/369053/78318746-483f7180-75b1-11ea-95b9-6c97f7677125.png\"\u003e\n\nOnce your repo has been created, the first run in GitHub Actions will unfortunately \nfail because you haven't yet setup secrets. You'll want to follow [this AWS guide][aws-action]\nto setup your secrets in GitHub. You'll know it's done correctly when your secrets \nlook like this:\n\n\u003cimg width=\"264\" alt=\"Example of well-configured secrets\" src=\"https://user-images.githubusercontent.com/369053/78318752-4bd2f880-75b1-11ea-9acf-587757961f45.png\"\u003e\n\nFinally, once your secrets are configured correctly your pipeline will run \nsuccessfully. PRs have will run unit tests and building, but only the `master` \nbranch will get deployed. To access your website, go to your Action's logs,\nclick the arrow next to the _Deploy_ step and look for the `ApiUrl` output. It\nshould look something like this:\n\n\u003cimg width=\"589\" alt=\"Example output\" src=\"https://user-images.githubusercontent.com/369053/78318925-b3894380-75b1-11ea-978a-640cf915bf8d.png\"\u003e\n\nYou can then navigate to that URL in your browser - and add `/api/values` onto \nthe end of the URL to see the fruits of your labour!\n\n[lambda-support]: https://aws.amazon.com/blogs/compute/announcing-aws-lambda-supports-for-net-core-3-1/\n[http-api-ga]: https://aws.amazon.com/blogs/compute/building-better-apis-http-apis-now-generally-available/\n[actions]: https://github.com/features/actions\n[aws-action]: https://github.com/aws-actions/configure-aws-credentials\n[anc-tests]: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests?view=aspnetcore-3.1\n[sam-function]: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html\n[resharper-action]: https://github.com/glassechidna/resharper-action\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidansteele%2Fdemo-serverless-aspnetcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faidansteele%2Fdemo-serverless-aspnetcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faidansteele%2Fdemo-serverless-aspnetcore/lists"}