Search code examples
amazon-web-servicesaws-sdkload-balancingamazon-ecsaws-fargate

How do I create a Fargate Service without load balancer from AWS CDK?


The Context: I am trying to create a Fargate service using aws cdk. I do not require any load balancer in the Fargate service.

The Problem: While aws console allows creation of service without any load balancer like seen in the picture below, I cannot find any ecsPatterns to achieve the same through the cdk. The ecs patterns create the load balancer automatically if not specified.

How do I create a fargate service without load balancer from cdk ?

enter image description here


Solution

  • You can use the FargateService construct.