It's mentioned in the AWS docs that a Classic Load Balancer is required to connect an ECS Service to multiple ports: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html
But when using ECS with Fargate, I get the error message that the Classic Load Balancer doesn't support the network mode awsvpc
:
Is there no way to Load Balance multiple ports for an ECS Service using Fargate?
The documentation states that it is not possible to use Classic Load Balancer with the Fargate launch type.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html
Services with tasks that use the awsvpc network mode (for example, those with the Fargate launch type) only support Application Load Balancers and Network Load Balancers; Classic Load Balancers are not supported. Also, when you create any target groups for these services, you must choose ip as the target type, not instance. This is because tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#network_mode
If using the Fargate launch type, the awsvpc network mode is required
. If using the EC2 launch type, any network mode can be used. If the network mode is set to none, you can't specify port mappings in your container definitions, and the task's containers do not have external connectivity. The host and awsvpc network modes offer the highest networking performance for containers because they use the Amazon EC2 network stack instead of the virtualized network stack provided by the bridge mode.
Following blog post might help you find the right approach for your case.
AWS Blog - Task Networking in AWS Fargate
https://aws.amazon.com/blogs/compute/task-networking-in-aws-fargate/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With