Score:0

Accept network traffic in one Instance from other Instances in a managed instance group in Google Cloud

uz flag

I am stuck with this. I have a Managed Instance Group (MIG) hosting a single application (autoscaled) and I have another single instance which hosts the Database. I am trying to set a firewall rule that allows Database connections only from the MIG.

First, I created an ingress Firewall Rule that allows Database Traffic to the Database Instance on port 5432 with a specified Target Tag of allow-db-connections. I placed the tag into the Instance settings and it is able to receive database connections from that port. I am now trying to figure out what to put in the Source Filter so that it only accepts connections from instances in the MIG.

I would appreciate any ideas. Thank you!

Score:1
cn flag

STEP 1:

VPC networks have a default rule default-allow-internal. This allows all traffic within a VPC. Click on that rule, scroll to the bottom and see which instances it applies to. That rule has a target of All instances in the network. Either disable or modify the rule.

STEP 2:

  1. Assign a tag to the VM instance template. For example DBClient.
  2. Assign a tag to the database server. For example DBServer.
  3. Create a firewall rule with the name allow-db-connections.
  4. Specify the Targets to be Specified target tags.
  5. Specify the target tags with the value DBServer.
  6. Specify the Source filter to be Source tags.
  7. Specify the Source tags with the value DBClient.
  8. Specify the other fields as you require.

This VPC rule will only allow traffic from the VM instances tagged DBClient to the VM instance tagged DBServer.

realnsleo avatar
uz flag
Thanks a bunch @john. That worked like a charm.
John Hanley avatar
cn flag
@realnsleo - happy to help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.