dmunch / aws-fargate-dotnet-demo

A complete example, deploying a containerised .NET application through GitHub actions to a fresh AWS account, provisioned via Terraform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using .NET with AWS Fargate and Terraform

A complete example, deploying a containerised .NET application through GitHub actions to a fresh AWS account, provisioned via Terraform.

Live

The deployed application can be accessed under https://demo.munch.engineering - There's currently just one endpoint, which is accesible at https://demo.munch.engineering/weatherforecast

IAC

The IAC Terraform code has been taken from this blog post, and adapted to include Route53 resources, a TLS certificate, and a dedicated GitHub Action user role with the minimal amount of permissions to allow the GitHub Action runner to deploy the application.

The AWS Setup is a uses a private subnet for the containers, with a Load Balancer and a NAT Gateway in a public subnet for connectivity.

example (Source: https://aws.amazon.com/de/blogs/compute/task-networking-in-aws-fargate/)

Application

The Application in src/ is a basic .NET 7 (preview) minimal API. This demo uses a new .NET 7 feature feature which makes publishing of Docker containers much easier.

https://devblogs.microsoft.com/dotnet/announcing-builtin-container-support-for-the-dotnet-sdk/

GitHub Actions

The demo has a minimalistic CI/CD pipeline using GitHub Actions: .github/workflows/containerize.yml

Instead of using hard-coded credentials, this demo uses OpenID for GitHub Actions to authenticate with AWS

For the deployment steps, the following steps are used:

About

A complete example, deploying a containerised .NET application through GitHub actions to a fresh AWS account, provisioned via Terraform.


Languages

Language:HCL 96.1%Language:C# 3.9%