Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sethbr11/dotnet-serverless-example

A project demonstrating serverless deployment in AWS Fargate for a .NET application using multi-stage terraform deployment and database integration.
https://github.com/sethbr11/dotnet-serverless-example

docker dockerfile dotnet terraform terraform-module

Last synced: 16 days ago
JSON representation

A project demonstrating serverless deployment in AWS Fargate for a .NET application using multi-stage terraform deployment and database integration.

Awesome Lists containing this project

README

        

# .NET Application Serverless w/ AWS Fargate

To run the project, enter the main folder and run `docker build -t proj2 .` followed by `docker run -dit -p 80:80 proj2`. To run the Terraform code, run `terraform init`, `terraform plan`, `terraform validate`, and `terraform apply`, then `terraform destroy` to delete your created resources. Automatic deployment can be done by running `./deployinfrastructure.sh` (with custom flags `-sql` to run the SQL code to initialize the database and `-skip-docker` to skip the docker image creation and upload) and subsequent destruction of those created resources is done with `./destroyinfrastructure.sh` (with the `-c` flag to only run the ECR cleanup). Some setup may be needed with installing docker, AWS CLI, terraform, etc, including IAM role creation. You may need to download the latest amazonlinux docker image, which can be done with `docker pull amazonlinux:latest`.

## Setup

Before running the code in this project, you will need Docker and AWS CLI installed and configured. The only thing you will need to do within the project itself is rename the `terraform/variables.tf.base` file to just `terraform/variables.tf` and put in your AWS credentials. These credentials should be configured for an IAM user you've created in AWS for terraform to do its thing. It should be set up with roughly the following permissions: AmazonEC2ContainerRegistryFullAccess, AmazonEC2ContainerRegistryPowerUser, AmazonEC2ContainerServiceRole, AmazonEC2FullAccess, AmazonECS_FullAccess, AmazonRDSFullAccess, CloudWatchLogsFullAccess, IAMFullAccess.

Lastly, the Dockerfile is configured to clone a sample .NET app found [here](https://github.com/sethbr11/pdcdonuts). This should be reconfigured to point to your app, whether you use git clone or whether you use Dockerfile's COPY command.