0

enter image description here

As we can see in the picture above, I can select as many subnets as I want. Does it mean, the tasks in the service are created across these two subnets?

Suppose I have one task running, in which subnet will it run then? If there are multiple tasks in the service, how are they distributed between these subnets? Is it something handled by Fargate and we shouldn't worry about?

What if I select a public subnet and a private subnet, I'm guessing it would be a mess in that case.

Sorry if these are noob questions, I'm new to AWS.

2 Answers 2

2

No question is noob. I have been working on Fargate since inception and I don't even know the answer to all of your questions! Anyway, what you see there are subnets that are eligible to launch tasks (as part of your service). If you have one task, it will be deployed to one of them (picked randomly). If you have many tasks, we will (best effort) spread them across all those. You would usually either pick either all public subnets or private subnets (depending on your architecture). Assuming the service allows you to pick heterogeneous subnets (which I am not sure about) I'd treat it as a logical configuration error.

2

You are defining the subnets where your Fargate container can run. You can choose any subnets you like, but I would choose public / private based on the workload and whether it needs to access the internet. If it's a web server then you would usually choose public, if it's an application server that just talks to a database choose private.

Once set up Fargate will put the task in whichever subnet it chooses, you have no control, that's the benefit of a managed service.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .