0
votes

I have an ECS-Fargate cluster created inside VPC. If I want to access above mentioned AWS services from fargate task, what needs to be done? I see following options from different documentations I read:

  1. Create private link to each AWS service
  2. Create NAT gateway

Not sure which one is correct and recommended option?

1

1 Answers

0
votes

To be clear, an ECS cluster is an abstracted entity and does not dictate where you connect the workloads you are running within it. If we stick to the Fargate launch type this means that tasks could be launched either on a private subnet or on a public subnet:

  • If you launch them in a public subnet (and you assign a public IP to the tasks) then these tasks can reach the public endpoints of the services you mentioned and nothing else (from a networking routing perspective) is required.

  • If you launch them in a private subnet you have two options that are those you called out in your question.

I don't think there is a golden rule for what's best. The decision is multi-dimensional (cost, ease of setup, features, observability and control, etc). I'd argue the NAT GW route is easier to setup regardless of the number of services you need to add but you may lose a bit of visibility and all your traffic will go outside of the VPC (for some customers this is ok, for others it's not). Private Links will give you tighter control but they may be more work to setup (especially if you need to reach many services).