Google Cloud Professional Cloud Security Engineer — Question 46

You have an application where the frontend is deployed on a managed instance group in subnet A and the data layer is stored on a mysql Compute Engine virtual machine (VM) in subnet B on the same VPC. Subnet A and Subnet B hold several other Compute Engine VMs. You only want to allow the application frontend to access the data in the application's mysql instance on port 3306.
What should you do?

Answer options

Correct answer: B

Explanation

The correct answer is B because it allows specific access based on the unique service accounts, ensuring security and control over which instances can communicate. Option A is incorrect as it relies on IP ranges rather than service accounts, which is less secure. Option C is not suitable because it establishes an egress rule instead of an ingress rule, and option D allows broader access than intended by permitting any VM with the 'fe-tag' to reach the MySQL instance.