Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a Fargate Service to Inbound Security Rules?

I have a Fargate Service running in AWS. I use it to run multiple tasks. Some of the tasks connect to an RDS database to query the database.

How can I add the Fargate Service to my inboard rules of a Security Group for the RDS database? - Is there a way to associate an Elastic IP with the Fargate Cluster?

like image 645
fuzzi Avatar asked Sep 24 '18 21:09

fuzzi


2 Answers

Might have misunderstood something here... But the ECS allows you specify a security group at the service level.

Go to https://docs.aws.amazon.com/cli/latest/reference/ecs/create-service.html And search for the --network-configuration parameter

So surely you just need to set the source on your inbound rule of the RDS security group to be that security group ID?

like image 150
GreenyMcDuff Avatar answered Oct 23 '22 18:10

GreenyMcDuff


Fargate doesn't support associating Elastic IPs with clusters. Clusters which runs in Fargate mode operate on instances which are not yours, it's the opposite of classic ECS stacks. That means you can't manage networking of host instances.

There is a way to associate IP with stack by having a Network Load Balancer in front of cluster. Then you could add a rule which allows connect your cluster through NLB.

like image 32
michail_w Avatar answered Oct 23 '22 18:10

michail_w