Dieser Inhalt ist in der ausgewählten Sprache nicht verfügbar
Wir arbeiten ständig daran, Inhalte in der ausgewählten Sprache bereitzustellen. Vielen Dank für deine Geduld.
How do I set up dynamic port mapping for Amazon ECS?
Lesedauer: 3 Minute
0
I want to set up dynamic port mapping for my container instance in Amazon Elastic Container Service (Amazon ECS).
Short description
The Classic Load Balancer doesn't allow you to run multiple copies of a task on the same instance. Instead, when using the Classic Load Balancer, you must statically map port numbers on a container instance. However, an Application Load Balancer uses dynamic port mapping, so you can run multiple tasks from a single service on the same container instance.
To set up dynamic port mapping, follow these steps:
Create an Application Load Balancer and a target group. Important: To route health check traffic correctly when you create a target group, expand Advanced health check settings. For Port, select traffic port.
Open the Amazon ECS console, and then configure your service to use the Application Load Balancer that you created. Important: You can add a load balancer only during the creation of the service. After service creation, you can't change the target group's Amazon Resource Name (ARN), container name, or the container port specified in the service definition. You can't add, remove, or change the load balancer configuration of an existing service. If you update the service task definition, then the container name and container port specified at service creation must remain in the task definition. For more information, see Service load balancing.
Open the Amazon Elastic Compute Cloud (Amazon EC2) console, and then choose Target Groups from the navigation pane. Choose the hyperlinked name for your target group. From the Targets tab, you can see what port is used for the task in the service that you created.
If dynamic port mapping is set up correctly, then you see the registered targets in the target group and the assigned port for the task. You also see the task in the registered targets for the following ephemeral port ranges: 49153–65535 and 32768–61000.