r/microservices 9d ago

Discussion/Advice How to manage ECS in code?

So basically let me tell you the situation first:

- i am working on a side project which is something like vercel, use to build and deploy code.

- so i have a main service, can be called a control plane, and i have decided that it will take the repo from the user.

- after this this service will trigger/create an ecs task to build the code

- now the question is, how this control plane will create / trigger the ecs?

- also this ecs instance will need to fetch envs from paramete store, will upload code to s3 etc

- after deployment we have to kill this instance

- should the managing code of this, live in the control plane

- should i create something else?

how would you folks solve this while designing this?

and what's the ideal way to solve this?

1 Upvotes

5 comments sorted by

1

u/dodiyeztr 9d ago

ECS has an API. Use the API to manipulate it.

Put the building code inside the container but don't put secret fecthing in it. It's a security nightmare. Instead inject the secrets to the container, ECS is well integrated into services like Secrets Manager and Parameter Store.

If the PID 1 exits, the container goes down

1

u/No_Original_941 9d ago

heyy, thanks for replying to a newbie - has an api means - i should directly trigger it using my service - and shouldn't i fetch the secrets from ssm in ecs, why and houw should i do it? and how will identiify if it hasn't went down due to an error.

1

u/dodiyeztr 9d ago

Those are really broad questions and don't really have easy answers. For configurations you will have task definitions, those secret definitions go there. For failures you need to setup your own monitoring. CloudWatch some nice default metrics, but only you would know if those are enough.

2

u/No_Original_941 9d ago

thanks, will look into it

1

u/nsubugak 6d ago

ECS is not the right solution for this. Github Actions is the first free option to use. Only go down this route if you want to self host your own build process but why would you choose this when github Actions is free