Grant Access for Users to View and Edit Table Data on Cloud Spanner | Ace: Associate Cloud Engineer Exam Answer

Granting Access for Users to View and Edit Table Data on Cloud Spanner

Question

You need to grant access for three users so that they can view and edit table data on a Cloud Spanner instance.

What should you do?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

To grant access for three users to view and edit table data on a Cloud Spanner instance, you need to assign the appropriate role to them. The Cloud Spanner instance uses IAM (Identity and Access Management) roles to control access to resources.

Option A suggests running the gcloud iam roles describe command to get the details of the roles/spanner.databaseUser role and then adding the users to this role. The roles/spanner.databaseUser role allows users to read and write data in a Cloud Spanner database. This option would grant the required access to the users, and it is the correct answer to the question.

Option B suggests creating a new group, adding the users to the group, and then adding the group to the roles/spanner.databaseUser role. While this option would also grant the required access, it involves an unnecessary additional step of creating a group.

Option C suggests using the roles/spanner.viewer role instead of the roles/spanner.databaseUser role. The roles/spanner.viewer role only allows users to view, not edit, data in a Cloud Spanner database. Therefore, this option is not the correct answer to the question.

Option D is similar to option B, but it suggests using the roles/spanner.viewer role instead of the roles/spanner.databaseUser role. As mentioned above, the roles/spanner.viewer role does not allow users to edit data, so this option is also not the correct answer to the question.

In summary, to grant access for three users to view and edit table data on a Cloud Spanner instance, you should run the gcloud iam roles describe roles/spanner.databaseUser command and then add the users to the roles/spanner.databaseUser role.