Mapping Load Balancer Ports in the ECS Service

0

please understand that I am not good at English.

Suppose the ECR has a repository called AAA and uses EXPOSE port 8080.

Create an ECS cluster and configure containers when defining tasks. Add port mapping information from the container, enter 8080. Enter container port mapping information 8080.

You are about to create a cluster service. If you add a task that you just created here and set the load balancer type to Application, it will automatically write AAA 8080:8080 in the select box of the container selection to load balance. But I want the host mapping to be 443 ports.

Is there any way I can set it to 8080:443?

1 Answer
2
Accepted Answer

By "8080:443", I'm assuming you want the LB to listen on port 433 and forward traffic to containers running on 8080. In which case you need to do the following:

  1. Create and configure a target group that is configured for port 8080.

  2. Create and configure your load balancer to listen on port 443 (including specifying the SSL cert to use) and forward traffic to target group created in step1

  3. When configuring the ECS service and specifically "Container to load balance" step, Select Add to Load balancer.

    Select production listener port as 443:HTTPS and for target group name you can select the TG you created.

Some reference documents:

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-application-load-balancer.html https://docs.aws.amazon.com/AmazonECS/latest/developerguide/create-service-console-v2.html

--Syd

profile picture
Syd
answered 2 years ago
profile pictureAWS
EXPERT
Toni_S
reviewed 2 years 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