Google Professional Cloud Developer Question 401
Select 3Google Cloud PlatformYou are developing a Node.js application running on Google Cloud Run that needs to connect to a Cloud SQL database. To ensure secure and efficient connection management, which of the following steps should you take?
- A
Use the Cloud SQL Auth proxy to manage secure authentication to the database.
- B
Set the database credentials as environment variables in your Cloud Run service.
- C
Use connection pooling to reduce the overhead of establishing new database connections.
- D
Allow public IP access to the Cloud SQL instance for easier connectivity.
- E
Configure the Cloud SQL instance to use private IP and connect it to the same VPC as Cloud Run.
Show answer and explanation
Correct answers: A, C, E
Explanation
To securely and efficiently manage connections to Cloud SQL from Cloud Run, you should use the Cloud SQL Auth proxy for secure authentication, implement connection pooling to handle connection scalability, and configure private IP connectivity to ensure the database is not exposed to the public internet. These practices align with Google Cloud's best practices for security and performance.
- A. Correct.
Using the Cloud SQL Auth proxy ensures secure and managed authentication to the database. It simplifies access by automatically handling IAM and encryption.
- B. Incorrect.
While setting database credentials as environment variables is possible, it is not recommended as it may expose sensitive information without proper management tools like Secret Manager.
- C. Correct.
Connection pooling is essential for efficient database connection management, especially in serverless environments like Cloud Run, where instances can scale rapidly.
- D. Incorrect.
Allowing public IP access to the Cloud SQL instance may expose it to security risks and is not recommended unless absolutely necessary.
- E. Correct.
Configuring the Cloud SQL instance to use private IP and connecting it to the same VPC as Cloud Run ensures secure and efficient network communication.