You can create a virtual machine (VM) instance on Compute Engine by using
images from your [Red Hat Cloud Access subscription](https://www.redhat.com/en/technologies/cloud-computing/cloud-access).

With this option, you pay Red Hat for license subscriptions and pay Google Cloud
only for infrastructure costs you incur. When you use OS images from your Red Hat
Cloud Access subscription on Google Cloud, you must request support
directly from Red Hat. To request support, log into your Red Hat Customer Portal
and open a support ticket.

When you create a VM that uses a RHEL OS image,
you can access the Red Hat Knowledgebase by using a single-sign-on (SSO) option
[available through the Google Cloud console](https://docs.cloud.google.com/compute/docs/images/premium/access-rhel-knowledgebase).

## Before you begin

- If you haven't already, set up [authentication](https://docs.cloud.google.com/compute/docs/authentication). Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:

  Select the tab for how you plan to use the samples on this page:

  ### Console


  When you use the Google Cloud console to access Google Cloud services and
  APIs, you don't need to set up authentication.

  ### gcloud

  1.
     [Install](https://docs.cloud.google.com/sdk/docs/install) the Google Cloud CLI.

     After installation,
     [initialize](https://docs.cloud.google.com/sdk/docs/initializing) the Google Cloud CLI by running the following command:

     ```bash
     gcloud init
     ```


     If you're using an external identity provider (IdP), you must first
     [sign in to the gcloud CLI with your federated identity](https://docs.cloud.google.com/iam/docs/workforce-log-in-gcloud).

     > [!NOTE]
     > **Note:** If you installed the gcloud CLI previously, make sure you have the latest version by running `gcloud components update`.

  2. [Set a default region and zone](https://docs.cloud.google.com/compute/docs/gcloud-compute#set_default_zone_and_region_in_your_local_client).

### Required roles


To get the permissions that
you need to create VMs,

ask your administrator to grant you the
[Compute Instance Admin (v1)](https://docs.cloud.google.com/iam/docs/roles-permissions/compute#compute.instanceAdmin.v1) (`roles/compute.instanceAdmin.v1`) IAM role on the project.


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access).


This predefined role contains

the permissions required to create VMs. To see the exact permissions that are
required, expand the **Required permissions** section:


#### Required permissions

The following permissions are required to create VMs:

- `compute.instances.create` on the project
- To use a custom image to create the VM: `compute.images.useReadOnly` on the image
- To use a snapshot to create the VM: `compute.snapshots.useReadOnly` on the snapshot
- To use an instance template to create the VM: `compute.instanceTemplates.useReadOnly` on the instance template
- To specify a subnet for your VM: `compute.subnetworks.use` on the project or on the chosen subnet
- To specify a static IP address for the VM: `compute.addresses.use` on the project
- To assign an external IP address to the VM when using a VPC network: `compute.subnetworks.useExternalIp` on the project or on the chosen subnet
- To assign a [legacy network](https://docs.cloud.google.com/vpc/docs/legacy) to the VM: `compute.networks.use` on the project
- To assign an external IP address to the VM when using a legacy network: `compute.networks.useExternalIp` on the project
- To set VM instance metadata for the VM: `compute.instances.setMetadata` on the project
- To set tags for the VM: `compute.instances.setTags` on the VM
- To set labels for the VM: `compute.instances.setLabels` on the VM
- To set a service account for the VM to use: `compute.instances.setServiceAccount` on the VM
- To create a new disk for the VM: `compute.disks.create` on the project
- To attach an existing disk in read-only or read-write mode: `compute.disks.use` on the disk
- To attach an existing disk in read-only mode: `compute.disks.useReadOnly` on the disk


You might also be able to get
these permissions
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview#predefined).

## Create a VM with a RHEL BYOS image

In summary, to use Red Hat Cloud Access subscription on Google Cloud, you need
to complete the following steps:

1. [Give Google Cloud access to the images](https://docs.cloud.google.com/compute/docs/instances/create-rhel-byos-vm#enable-access) in your Red Hat Cloud Access subscription.
2. [Use Google Cloud console or Google Cloud CLI](https://docs.cloud.google.com/compute/docs/instances/create-rhel-byos-vm#create-vm) to create the VM.

### Give your Google Group access to your RHEL subscription

To provide your Google Group with access to RHEL BYOS images, complete the
following steps:

1. Select an existing or create a [Google Group](https://support.google.com/groups/answer/2464926).
2. Add all users and service accounts that you want to use these BYOS images, to the Google Group. See [Add people to your group](https://support.google.com/groups/answer/2465464?ref_topic=2458761).
3. Log into the [Red Hat Customer Portal](https://access.redhat.com/) and complete the following steps:
   1. On the navigation menu, select **Cloud Access**.
   2. Click **Enable a new provider**.
   3. In the **Select a Red Hat Certified Cloud and Service Provider** menu, select **Google Compute Engine**.
   4. Enter your **Google Compute Engine ID** . This is the [email address](https://support.google.com/groups/answer/2464926#zippy=%2Csettings-reference) for the Google Group that you created in step one.
   5. Select the products that you want to enable.
   6. Click **Enable**.

It might take 3-4 hours for your Google Cloud account to be
linked to the Red Hat Customer Portal.

### Understanding RHEL BYOS projects

`rhel-byos-cloud` is a public Google Cloud project that contains a list of all
available RHEL BYOS images. You can reference this project to find the correct
image name or family that you will then use to create your own VM instance in
your project. The images are managed by Google Cloud, but they can
only be used if you have properly enabled your RHEL BYOS subscription.

### Create the VM

After you give your Google Group access to your RHEL subscription, your
RHEL BYOS images are available in the public Google Cloud `rhel-byos-cloud` project
on Compute Engine, but you will create your own VM in your own project.

### Console

The Google Cloud console simplifies this process by automatically presenting the
available RHEL BYOS images from the `rhel-byos-cloud` project.

1. In the Google Cloud console, go to the **Create an instance** page.

   [Go to Create an instance](https://console.cloud.google.com/compute/instancesAdd)
2. Specify a **Name** for your VM. For more information, see [Resource naming convention](https://docs.cloud.google.com/compute/docs/naming-resources#resource-name-format).

3. Optional: Change the **Zone** for this VM. If you select **Any**,
   Google automatically chooses a zone for you based on machine type
   and availability.

4. Select a **Machine configuration** for your VM.

5. In the **Boot disk** section, click **Change**.

6. In the **Public images** tab, complete the following steps:

   1. In the **Operating system** drop-down, select one of the following:
      - **Red Hat Enterprise Linux**
      - **Red Hat Enterprise Linux for SAP**
   2. In the **Version Type** drop-down, select the image that you want to use.
   3. In the **License type** section, select **Bring your own subscription or license (BYOS/BYOL)**.
   4. Specify boot disk type.
   5. Specify boot disk size.
   6. Optional: For advanced configuration options, click **Show advanced configuration**.
   7. To confirm your boot disk options, click **Select**.
7. Make additional VM customizations, as needed.

8. To create and start the VM, click **Create**.

### gcloud

Creating a VM with the Google Cloud CLI is a two-step process to make sure
you use the correct image from the `rhel-byos-cloud` project.

1. To find the RHEL BYOS image you want to use. Run the following command to list the available images in the `rhel-byos-cloud` project:

   ```
   gcloud compute images list \
    --project=rhel-byos-cloud \
    --filter="name ~ rhel-byos"
   ```

   From the command output, note the `name` of the image you want to use. For example, the name might be `rhel-9-byos` or `rhel-9-2-sap-byos`.
2. Create the VM with a BYOS image in your own project by referencing the image you found in the previous step by running the [`gcloud compute instances create` command](https://docs.cloud.google.com/sdk/gcloud/reference/compute/instances/create)
   with your <var translate="no">PROJECT_ID</var> and <var translate="no">IMAGE_NAME</var>.

   ```
    gcloud compute instances create VM_NAME \
    --project=PROJECT_ID \
    --image=IMAGE_NAME
   ```

   Replace the following:
   - `VM_NAME`: [name](https://docs.cloud.google.com/compute/docs/naming-resources#resource-name-format) of the new VM
   - `PROJECT_ID`: your project ID where you want to create the VM
   - `IMAGE_NAME`: the specific image name that you want to use

## What's next

- [Connect to Linux VMs](https://docs.cloud.google.com/compute/docs/instances/connecting-to-instance).
- [Connect to Windows VMs](https://docs.cloud.google.com/compute/docs/instances/connecting-to-windows).
- [Access Red Hat Knowledgebase](https://docs.cloud.google.com/compute/docs/images/premium/access-rhel-knowledgebase).