please help me deploy docker image ECS Fargate with HTTPS


I want to create a Docker image using an SSL certificate, and this image is deployed on ECR. I am using the dotnet code.

asked 6 months ago424 views
1 Answer

Hi Mahesh -

While you can add a certificate (a *.pfx file) to your ASP.NET Core project and configure the application to use HTTPS (and redirection from HTTP) by following Microsoft's guidance on setting up a cert with Kestrel for ASP.NET Core, that is not what I recommend.

For the vast majority of use cases for containerized applications, your application may need to scale out to multiple containers, or you may want to have different containerized applications handling different paths (e.g., "", "" would be handled by different apps). To handle this, you can run your containers in ECS behind an application load balancer (ALB).

Then, you can upload your SSL/TLS certificate to the load balancer which terminates HTTPS from users' browsers, and the ALB can communicate with your containers that are running ASP.NET Core over either port 80 (HTTP) or using a self-signed cert over HTTPS (443), or really any other port that you like. This way, a single certificate in ALB can handle all the requests to your application, regardless of where the back-end application is running (in containers, on EC2, or even in AWS Lambda). Also, AWS Certificate Manager (ACM) lets you create the certificate, and is integrated with ALB.

profile pictureAWS
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions