Google Cloud Professional Cloud Architect — Question 195
A Cloud Run service running your serverless application is unable to connect to an AlloyDB database created with default configurations. You need to troubleshoot and resolve the issue as quickly as possible. What should you do?
Answer options
- A. Verify that the Cloud Run service and AlloyDB instance are in the same region.
- B. Enable Direct VPC egress for the Cloud Run service, and send traffic directly to a VPC.
- C. Disable the default public IP address of the AlloyDB instance, and use the private IP address in the connection string.
- D. Create a Cloud SQL instance, and migrate the AlloyDB database to PostgreSQL on Cloud SQL.
Correct answer: B
Explanation
The correct answer is B because enabling Direct VPC egress allows the Cloud Run service to connect directly to the AlloyDB instance over the VPC, which is crucial for connectivity. Option A is incorrect as being in the same region alone does not guarantee connectivity without proper network configurations. Option C is also incorrect because while using a private IP can be beneficial, it does not resolve the underlying connectivity issue if VPC egress is not enabled. Option D is unnecessary as migrating to Cloud SQL is not required for solving the connectivity problem.