Dynamic Port Mapping and Load Balancing for Amazon ECS | Exam DVA-C01 | Amazon Developer Certification

Setting up Dynamic Port Mapping and Load Balancing for Amazon ECS | DVA-C01 Exam Prep

Prev Question Next Question

Question

You are a developer who is supporting a containerized application.

You are told to set up dynamic port mapping for Amazon ECS and load balancing.

What statement is true in this case?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Correct Answer: D.

This is just the clear result of having set up dynamic port mapping correctly since you can see the registered targets in the target group used to route requests and the assigned port for the task.

Incorrect Answers:

Option A is incorrect because Classic Load Balancer actually doesn't allow you to run multiple copies of a task on the same instance.

Option B is incorrect because Application Load Balancer uses dynamic port mapping.

So you can run multiple tasks from a single service on the same container instance.

Option C is incorrect because you can add a load balancer only during the creation of the service.

You can't add, remove, or change the load balancer configuration of an existing service.

References:

https://go.aws/2Ztw5GW

The correct answer is C. After creating an Amazon ECS service, you add the load balancer configuration.

Explanation:

Dynamic port mapping is a feature of Amazon ECS that allows the application to use any available port when it starts up. This feature is useful when running multiple copies of the same task on a single container instance, as it ensures that each copy of the task gets a unique port.

Load balancing is used to distribute traffic evenly among the tasks that are running in the service. Amazon ECS supports two types of load balancers: Classic Load Balancer and Application Load Balancer.

Option A, Classic Load Balancer, is incorrect because it does not allow you to run multiple copies of a task on the same instance. Classic Load Balancer distributes traffic to registered instances based on the IP address of the instance, so each task would need to run on a separate instance.

Option B, Application Load Balancer, is incorrect because it uses dynamic port mapping, not static port mapping. When you create a task definition for a service that uses an Application Load Balancer, you specify the container port and the protocol (HTTP or HTTPS) to use for the container. The Application Load Balancer then dynamically maps the container port to a port on the container instance.

Option D is incorrect because it is not a statement about load balancing. However, if dynamic port mapping is set up correctly, then you should see the registered targets and the assigned port for the task in the Amazon ECS console.

Therefore, the correct answer is C. After creating an Amazon ECS service, you add the load balancer configuration. After you create a service in Amazon ECS, you can add a load balancer to distribute traffic to the tasks in the service. To do this, you specify the load balancer type (Classic Load Balancer or Application Load Balancer), the target group, and the listener port.