You are using the latest stable version of Python 3 to develop an API that stores data in a Cloud SQL database. You need to perform CRUD operations on the production database securely and reliably with minimal effort. What should you do?
A.
1. Use Cloud Composer to manage the connection to the Cloud SQL database from your Python application. 2. Grant an IAM role to the service account that includes the composer.worker permission.
B.
1. Use the Cloud SQL API to connect to the Cloud SQL database from your Python application. 2. Grant an IAM role to the service account that includes the cloudsql.instances.login permission.
C.
1. Use the Cloud SQL connector library for Python to connect to the Cloud SQL database through a Cloud SQL Auth Proxy. 2. Grant an IAM role to the service account that includes the cloudsql.instances.connect permission.
D.
1. Use the Cloud SQL emulator to connect to the Cloud SQL database from Cloud Shell 2. Grant an IAM role to the user that includes the cloudsql.instances.login permission.
• Cloud SQL Connector Library:
The Cloud SQL connector library for Python simplifies connecting to your Cloud SQL database securely. It leverages the Cloud SQL Auth Proxy functionality to handle secure connections without manual setup, which reduces operational overhead.
• IAM Permissions:
By granting the service account the cloudsql.instances.connect permission, you ensure that only authorized services can connect to your Cloud SQL instance. This approach aligns with best practices for secure and reliable database connectivity.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Sandesh24
2 months ago