How to Give Access to a Single Compute Instance on GCP to a User

Ashish Sakunde
Google Cloud - Community
3 min readJul 11, 2024

Introduction:

Managing access control is a crucial aspect of maintaining the security and integrity of your Google Cloud Platform (GCP) environment. In this guide, we will walk you through the steps to grant a specific user access to a single Compute Instance on GCP. This involves assigning the necessary roles to ensure they have the required permissions without exposing your entire project.

Step 1: Grant Required IAM Roles

To start, you need to assign the user some roles that will allow them to view and interact with Compute Engine resources and establish secure connections.

Navigate to the IAM Page

  1. Open your browser and go to the IAM page on GCP.

Grant the User Required Roles

  1. Locate the user you want to grant access to.
  2. Click on the “Edit” button next to the user’s email.
  3. In the “Add another role” dropdown, add the following roles:
  • Compute Viewer: This role allows the user to view Compute Engine resources.
  • Service Account User: This role permits the user to access and run operations as service accounts.
  • IAP-secured tunnel user: This role allows the user to establish an Identity-Aware Proxy (IAP) tunnel to access instances securely.

Save the Changes

  1. After assigning the roles, click “Save” to apply the changes.

Step 2: Grant Compute Instance Admin Role to Specific VM(s)

Next, you will provide the user with administrative permissions for the specific VM(s) they need to manage.

Navigate to the VM Instances Page

  1. Open your browser and go to the VM instances page on GCP.

Select the VM(s)

  1. Select the specific VM(s) you want to grant access to.

Grant the “Compute Instance Admin (v1)” Role

  1. Click on the “Permissions” tab for the selected VM(s).
  2. Click on the “Add Member” button.
  3. Enter the user’s email address.
  4. In the “Select a role” dropdown, choose the Compute Instance Admin (v1) role. This role enables the user to manage VM instances, including starting and stopping instances, and modifying instance configurations.

Save the Changes

  1. Click “Save” to apply the changes.

Step 3: Verify Access

After assigning the roles, you need to ensure that the user can access and manage the specified VM(s).

Login with the User’s Account

  1. Have the user log in to the Google Cloud Console with their account.

Access the VM

  1. The user should now be able to view the VM instances and perform administrative tasks as per the roles assigned.

Conclusion:

By following these steps, you can securely grant a user access to a specific Compute Instance on GCP. This ensures that the user has the necessary permissions to manage the VM instance while maintaining the security and integrity of your GCP project. Managing access control in this detailed manner helps in preventing unauthorized access and maintaining a secure cloud environment.

This structured approach not only provides the necessary permissions but also ensures that your cloud resources are accessed and managed securely.

--

--