Hello! I am currently using an ECS service to run ...
# ask-community
f
Hello! I am currently using an ECS service to run a prefect agent. When defining the service, I set a security group shared with an RDS instance. However, my flows launched from that agent are unable to connect to the RDS. Is there a way to define a security group for the task that the agent executes?
k
I think it would so in the task definition that goes along with your flow. I don’t have this specific example, but I do have an example of using a yaml if that helps here
f
Thanks! Do you know if its possible to set a security group in a task definition? I’ve been looking around AWS docs and haven’t seen that as an option. I’ve only seen setting the security group in the service set up. I’ve also seen the option to set a security group when you select ‘Run Task’ from ECS.
k
I think it’s under
networkConfiguration
but will double check in a bit
f
Thank you! I did specify the network configuration when I created the service: https://docs.prefect.io/orchestration/agents/ecs.html#running-ecs-agent-in-production But after looking again still haven’t had any luck finding how to pass the security group to the task run itself.
Looking into this more, do you think I would be able to pass the network configuration into the run_task_kwargs in the ECSRun? The aws docs linked in that section are related to the run_task method which is basically exactly what I’m after
These are the docs I’m referring to: https://docs.prefect.io/api/latest/run_configs.html#ecsrun
k
Just got out of a call, yes you can do it through
run_task_kwargs
f
Awesome, appreciate your help
k
For task run, you can add it to the yaml I provided also if you add a complete
networkConfiguration
Yes of course!