A cloud engineer needs to configure least-privilege access by creating a custom IAM role for specific virtual machine operations and assigning it to an operator in a Google Cloud project using the gcloud CLI. Place the following operational steps in the correct sequential order from start to finish.
- 1Create a local YAML configuration file specifying the custom role metadata, title, and fine-grained permissions (such as compute.instances.start and compute.instances.stop).
- 2Execute the command 'gcloud iam roles create customVmOperator --project=prod-project-123 --config-file=role-definition.yaml' to instantiate the role.
- 3Execute the command 'gcloud projects add-iam-policy-binding prod-project-123 --member="user:[email protected]" --role="projects/prod-project-123/roles/customVmOperator"' to grant access.
- 4Execute the command 'gcloud projects get-iam-policy prod-project-123' to audit and confirm the newly established policy binding.
Answer
The correct sequence of operations is: first, create the local YAML role definition file specifying the required permissions; second, run 'gcloud iam roles create' to instantiate the custom role in the project; third, run 'gcloud projects add-iam-policy-binding' to bind the custom role to the user; and fourth, run 'gcloud projects get-iam-policy' to audit and confirm the binding.
The workflow follows standard Google Cloud IAM administration procedures: defining role permissions in a configuration file, creating the custom role resource in the target project, binding the created role to the desired user identity, and verifying the policy change via policy retrieval commands.
Step-by-Step Solution
Key Concept
Custom IAM Role Creation and Policy Binding Lifecycle via gcloud CLI
Estimated Time:1m 30s