Organization setup

Organization administrators setting up Google Cloud Workstations for an engineering team have three ways to provision developer environments:

  • Share the prebuilt Android 17 snapshot directly (recommended, under 10 minutes): Reuse sdv-android17-home-snapshot and sdv-android17-config from Cloud development so every developer gets a fresh 1,000 GB home disk hydrated from the prebuilt Android 17 image without running a multi-hour source build.
  • Customize the base snapshot from AOSP source (about 2 to 4 hours depending on targets built): Launch an admin workstation from the prebuilt snapshot, modify AOSP repositories or preconfigure IDE projects, capture a sanitized disk snapshot (aaos-sdv-dev-snapshot), and point a team workstation configuration at that custom snapshot.
  • Build a workstation environment from scratch (about 4 to 6 hours): Build your own container image in Artifact Registry and initialize a blank 1,000 GB persistent home disk (--pd-disk-size=1000) without pulling artifacts from aaos-artifacts. For step-by-step instructions, see Build a workstation environment from scratch.

Share the prebuilt Android 17 configuration

After you create sdv-cluster and sdv-android17-config in Cloud development, you can provision dedicated workstations for developers on your team and grant each developer access through Identity and Access Management (IAM):

  1. In Cloud Shell, set your project, region (us-central1 or europe-west4 to match sdv-cluster), and the developer's email address and workstation ID:

    export PROJECT_ID=YOUR_GCP_PROJECT_ID
    export REGION=us-central1
    export DEV_WORKSTATION=sdv-ws-alice
    export DEV_EMAIL=alice@example.com
    
    gcloud config set project "${PROJECT_ID}"
    
  2. Create the developer's workstation from sdv-android17-config and grant project-level roles/workstations.operationViewer so the developer can monitor start and stop operations:

    gcloud workstations create "${DEV_WORKSTATION}" \
      --cluster="sdv-cluster" \
      --config="sdv-android17-config" \
      --region="${REGION}"
    
    gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
      --member="user:${DEV_EMAIL}" \
      --role="roles/workstations.operationViewer"
    
  3. In the Google Cloud console, open Cloud Workstations > Workstations, locate the developer's workstation, click More > Add users, enter the developer's email address (roles/workstations.user), and click Save.

To let developers create their own workstations from sdv-android17-config, open Cloud Workstations > Workstation configurations in the Google Cloud console and grant roles/workstations.workstationCreator on sdv-android17-config (along with project-level roles/workstations.operationViewer). For more information, see Access control with IAM.

Customize the base snapshot from AOSP source

If your organization patches AOSP repositories, preinstalls internal tools, or prebuilds custom lunch targets beyond the public Android 17 image, create a custom snapshot from an admin workstation.

Create an admin workstation

Follow Launch the workstation to start and open a single admin workstation (sdv-workstation). This workstation serves as your customization staging instance.

Build custom targets

Inside the admin workstation, sync or modify the AOSP tree at ~/Workspace/aaos-26q2 and compile any additional targets you want baked into every developer's home disk. Access your repositories as described in Code location, and then build your targets as described in Download, build, and run. Skip the Cuttlefish launch steps until after you capture the clean snapshot.

(Optional) Set up an ASfP project

Android Studio for Platform (ASfP) is preinstalled in the prebuilt workstation container. If your developers work on the same subsystem, you can configure an ASfP project in the disk snapshot or export a shareable .asfp-project template (lunch target, scoped directories, and other_languages: [rust]) alongside your team's AGENTS.md files. Follow Set up an IDE for SDV development and Shareable project templates (export and import).

Create a disk snapshot

After your build completes, sanitize personal credentials and capture a snapshot of the admin workstation's persistent home disk:

  1. Inside the admin workstation, close any other open terminals, remove personal credential and shell history files, and clear your active shell's in-memory history before closing the terminal so they aren't copied to team workstations:

    rm -f ~/.gitcookies ~/.git-credentials ~/.netrc \
      ~/.bash_history ~/.zsh_history
    

    Inspect ~/.gitconfig, ~/.ssh/, ~/.config/gcloud/, ~/.config/gh/, and ~/.android/adbkey* to remove any personal keys or tokens, and close all open workstation terminals before stopping the instance.

  2. In Cloud Shell, set your project and region (matching the region of sdv-cluster) and stop the admin workstation (sdv-workstation) so all file system writes flush cleanly before snapshotting:

    export PROJECT_ID=YOUR_GCP_PROJECT_ID
    export REGION=us-central1
    
    gcloud config set project "${PROJECT_ID}"
    gcloud workstations stop sdv-workstation \
      --cluster="sdv-cluster" \
      --config="sdv-android17-config" \
      --region="${REGION}"
    
  3. In the Google Cloud console, open Compute Engine > Disks and filter for the 1,000 GB regional persistent SSD disk backing sdv-workstation (or run gcloud compute disks list --filter="labels.workstation_id=sdv-workstation" in Cloud Shell).

  4. Select the 1,000 GB home disk, click Create snapshot, enter aaos-sdv-dev-snapshot as the snapshot name, select Regional storage in ${REGION}, and click Create (if creating the snapshot from the CLI, pass --source-disk-region="${REGION}" and --storage-location="${REGION}" so the snapshot is stored regionally alongside sdv-cluster).

Create the user workstation configuration

Create a team workstation configuration in Cloud Shell that initializes each new developer's home directory from aaos-sdv-dev-snapshot across two NVIDIA T4-capable zones in ${REGION} (if you built a private container image in Artifact Registry instead of using aaos-artifacts, grant roles/artifactregistry.reader to sdv-ws-runner and replace --container-custom-image with your image URI). For more information about supported GPU zones, see GPU availability by region and zone:

export REPLICA_ZONES=us-central1-a,us-central1-b

gcloud workstations configs create user-workstation-config \
  --cluster="sdv-cluster" \
  --region="${REGION}" \
  --replica-zones="${REPLICA_ZONES}" \
  --machine-type="n1-standard-32" \
  --accelerator-type="nvidia-tesla-t4" \
  --accelerator-count=1 \
  --enable-nested-virtualization \
  --pool-size=0 \
  --idle-timeout=7200 \
  --running-timeout=43200 \
  --service-account="sdv-ws-runner@${PROJECT_ID}.iam.gserviceaccount.com" \
  --container-custom-image="${REGION}-docker.pkg.dev/aaos-artifacts/sdv-images/sdv-asfp-public:20261105-094632" \
  --pd-disk-type="pd-ssd" \
  --pd-source-snapshot="projects/${PROJECT_ID}/global/snapshots/aaos-sdv-dev-snapshot"

Create a user workstation

  1. In the Google Cloud console, navigate to Cloud Workstations > Workstations.
  2. Click Create workstation in the toolbar.
  3. Enter a workstation ID (for example, sdv-ws-user1) and select user-workstation-config as the Configuration.
  4. Click Create, and then click Start and Launch under Quick actions to verify that the home directory contains the files from your custom snapshot.

For more information about managing team permissions on Cloud Workstations, see Access control with IAM. When retiring a team environment, delete all user workstations, user-workstation-config, aaos-sdv-dev-snapshot, and sdv-cluster (plus sdv-staging-config, the sdv-images Artifact Registry repository, and any ${PROJECT_ID}_cloudbuild staging bucket if you built from scratch) to stop storage and cluster control plane charges. For teardown commands, see Stop or delete resources.

Build a workstation environment from scratch

If your organization's security policy prohibits running prebuilt container or disk images from another organization's Google Cloud project, follow this section instead of Cloud development to build the workstation container image, the Cuttlefish host packages, and the base home snapshot inside your own project:

  1. In Cloud Shell, inside a project where you have permissions to enable APIs, manage IAM service accounts, and create Compute Engine and Cloud Workstations resources (with regional quota for 32 N1 vCPUs, 2,000 GB of regional SSD persistent disk, and one optional NVIDIA T4 GPU), choose a Cloud Workstations region and two zones in that region that offer n1-standard-32 machines and NVIDIA T4 GPUs, enable the required APIs, create a Docker repository in Artifact Registry, and create sdv-ws-runner with roles/artifactregistry.reader alongside logging and monitoring write roles. In organization projects created after May 2024, also verify that the default Cloud Build service account (gcloud builds get-default-service-account) has roles/cloudbuild.builds.builder (or roles/artifactregistry.writer, roles/storage.objectUser, and roles/logging.logWriter) so Cloud Build can push images. For more information about supported GPU zones, see GPU availability by region and zone:

    export PROJECT_ID=YOUR_GCP_PROJECT_ID
    export REGION=us-central1
    export REPLICA_ZONES=us-central1-a,us-central1-b
    export CUSTOM_IMAGE="${REGION}-docker.pkg.dev/${PROJECT_ID}/sdv-images/sdv-workstation:latest"
    
    gcloud config set project "${PROJECT_ID}"
    gcloud services enable artifactregistry.googleapis.com \
      cloudbuild.googleapis.com compute.googleapis.com iam.googleapis.com \
      workstations.googleapis.com
    
    gcloud artifacts repositories create sdv-images \
      --repository-format="docker" \
      --location="${REGION}"
    
    gcloud iam service-accounts create sdv-ws-runner \
      --display-name="AAOS SDV Workstation Runner"
    
    for ROLE in roles/logging.logWriter roles/monitoring.metricWriter \
      roles/artifactregistry.reader; do
      gcloud projects add-iam-policy-binding "${PROJECT_ID}" \
        --member="serviceAccount:sdv-ws-runner@${PROJECT_ID}.iam.gserviceaccount.com" \
        --role="${ROLE}"
    done
    
  2. Build a custom workstation container image from ubuntu:24.04 (or replace ubuntu:24.04 with your organization's approved Ubuntu 24.04 base image). Because Cloud Workstations persists only /home across stops and snapshots, bake the Ubuntu AOSP build packages, repo, openssh-server, and the Cuttlefish host packages (cuttlefish-base and cuttlefish-user, built from source below) directly into the container image, and configure a startup entrypoint that creates the user account (UID 1000 in groups sudo,users,kvm,cvdnetwork,render), starts the Cuttlefish host services, and runs sshd on port 22. To also add a browser remote desktop on port 80, Android Studio for Platform, or CARLA helper scripts, see docker/ in aaos-sdv-demos, Get started, and Customize container images:

    mkdir -p ~/sdv-ws-image
    
    cat << 'EOF' > ~/sdv-ws-image/workstation-entrypoint.sh
    #!/bin/bash
    set -euo pipefail
    userdel "$(id -nu 1000 2>/dev/null)" 2>/dev/null || true
    for grp in kvm cvdnetwork render; do
      getent group "${grp}" >/dev/null || groupadd -f "${grp}"
    done
    useradd -m user -u 1000 -G sudo,users,kvm,cvdnetwork,render --shell /bin/bash
    passwd -d user >/dev/null
    echo "%sudo ALL=NOPASSWD: ALL" > /etc/sudoers.d/workstation-user
    /etc/init.d/cuttlefish-host-resources start || true
    /etc/init.d/cuttlefish-operator start || true
    ssh-keygen -A
    mkdir -p /run/sshd
    exec /usr/sbin/sshd -D -e
    EOF
    
    cat << 'EOF' > ~/sdv-ws-image/Dockerfile
    FROM ubuntu:24.04
    RUN export DEBIAN_FRONTEND=noninteractive && \
        apt-get update && \
        apt-get install -y --no-install-recommends \
          bc bison build-essential ca-certificates config-package-dev curl \
          debhelper-compat devscripts equivs flex fontconfig git-core gnupg \
          golang libc6-dev-i386 lib32z1-dev libelf-dev libgl1-mesa-dev \
          libssl-dev libx11-dev libxml2-utils lzop openssh-server python3 \
          rsync sudo unzip x11proto-core-dev xsltproc zip zlib1g-dev && \
        curl -fsSL https://storage.googleapis.com/git-repo-downloads/repo \
          -o /usr/local/bin/repo && chmod a+rx /usr/local/bin/repo && \
        git clone --depth=1 https://github.com/google/android-cuttlefish \
          /tmp/android-cuttlefish && \
        cd /tmp/android-cuttlefish && \
        tools/buildutils/build_packages.sh && \
        apt-get install -y --no-install-recommends \
          ./cuttlefish-base_*_*64.deb ./cuttlefish-user_*_*64.deb && \
        rm -rf /tmp/android-cuttlefish /etc/ssh/sshd_config.d/*.conf \
          /etc/ssh/ssh_host_* /var/lib/apt/lists/* && \
        printf '%s\n' \
          'PasswordAuthentication yes' \
          'PermitEmptyPasswords yes' \
          'PubkeyAuthentication no' \
          'Subsystem sftp /usr/lib/openssh/sftp-server' \
          'UsePAM yes' >> /etc/ssh/sshd_config
    COPY workstation-entrypoint.sh /usr/local/bin/workstation-entrypoint.sh
    RUN chmod +x /usr/local/bin/workstation-entrypoint.sh
    ENTRYPOINT ["/usr/local/bin/workstation-entrypoint.sh"]
    EOF
    
    gcloud builds submit ~/sdv-ws-image \
      --region="${REGION}" \
      --machine-type="e2-highcpu-8" \
      --timeout="1h" \
      --tag="${CUSTOM_IMAGE}"
    
  3. Create sdv-cluster, create a temporary staging configuration (sdv-staging-config) that mounts a blank 1,000 GB regional pd-ssd disk using --pd-disk-size=1000 and sets --idle-timeout=43200 so an unattended multi-hour build doesn't shut down early (omit the two --accelerator-* flags if you don't need GPU-accelerated 3D simulation), and create the staging admin workstation (sdv-workstation):

    gcloud workstations clusters create sdv-cluster \
      --region="${REGION}"
    
    gcloud workstations configs create sdv-staging-config \
      --cluster="sdv-cluster" \
      --region="${REGION}" \
      --replica-zones="${REPLICA_ZONES}" \
      --machine-type="n1-standard-32" \
      --accelerator-type="nvidia-tesla-t4" \
      --accelerator-count=1 \
      --enable-nested-virtualization \
      --pool-size=0 \
      --idle-timeout=43200 \
      --running-timeout=43200 \
      --service-account="sdv-ws-runner@${PROJECT_ID}.iam.gserviceaccount.com" \
      --container-custom-image="${CUSTOM_IMAGE}" \
      --pd-disk-size=1000 \
      --pd-disk-type="pd-ssd"
    
    gcloud workstations create sdv-workstation \
      --cluster="sdv-cluster" \
      --config="sdv-staging-config" \
      --region="${REGION}"
    
  4. Start and connect to sdv-workstation over SSH (unless you added a web IDE or remote desktop on port 80, connect with gcloud workstations ssh rather than the console Launch button):

    gcloud workstations ssh sdv-workstation \
      --cluster="sdv-cluster" \
      --config="sdv-staging-config" \
      --region="${REGION}" \
      --start-workstation
    

    Inside the workstation SSH session, sync your organization's internal Android 17 manifest mirror or an Android 17 AOSP manifest branch into ~/Workspace/aaos-android17, and compile the dual-VM targets into separate output directories (a default AOSP checkout builds DriverUIStubApp on sdv_ivi_cf_ds unless you stage DriverUIPrebuilt first; for more information, see Build SDV IVI target with DriverUI, Code location, and Download, build, and run):

    mkdir -p ~/Workspace/aaos-android17 && cd ~/Workspace/aaos-android17
    repo init -u https://android.googlesource.com/platform/manifest \
      -b android-latest-release -c --depth=1
    repo sync -c -j16 --no-tags
    
    source build/envsetup.sh
    lunch sdv_media_har_cf-aosp_current-userdebug
    m
    
    export OUT_DIR=out-ivi
    source build/envsetup.sh
    lunch sdv_ivi_cf_ds-aosp_current-userdebug
    m
    
    rm -f ~/.gitcookies ~/.git-credentials ~/.netrc \
      ~/.bash_history ~/.zsh_history
    

    Inspect ~/.gitconfig, ~/.ssh/, ~/.config/gcloud/, ~/.config/gh/, and ~/.android/adbkey* to remove any personal keys or tokens, and clear your active shell's in-memory history before exiting the SSH session so it isn't flushed back to ~/.bash_history.

  5. In Cloud Shell, re-export your environment variables if your session reconnected, stop sdv-workstation so file system writes flush cleanly, and capture aaos-sdv-dev-snapshot from its 1,000 GB regional persistent disk:

    export PROJECT_ID=YOUR_GCP_PROJECT_ID
    export REGION=us-central1
    export REPLICA_ZONES=us-central1-a,us-central1-b
    export CUSTOM_IMAGE="${REGION}-docker.pkg.dev/${PROJECT_ID}/sdv-images/sdv-workstation:latest"
    
    gcloud config set project "${PROJECT_ID}"
    gcloud workstations stop sdv-workstation \
      --cluster="sdv-cluster" \
      --config="sdv-staging-config" \
      --region="${REGION}"
    
    STAGE_DISK="$(gcloud compute disks list \
      --filter="labels.workstation_id=sdv-workstation" \
      --regions="${REGION}" \
      --format="value(name)")"
    
    gcloud compute snapshots create aaos-sdv-dev-snapshot \
      --source-disk="${STAGE_DISK}" \
      --source-disk-region="${REGION}" \
      --storage-location="${REGION}"
    
  6. Create the team configuration (user-workstation-config) using your custom image and aaos-sdv-dev-snapshot (omitting the two --accelerator-* flags if you omitted them in sdv-staging-config), delete the temporary staging workstation and configuration, and create developer workstations:

    gcloud workstations configs create user-workstation-config \
      --cluster="sdv-cluster" \
      --region="${REGION}" \
      --replica-zones="${REPLICA_ZONES}" \
      --machine-type="n1-standard-32" \
      --accelerator-type="nvidia-tesla-t4" \
      --accelerator-count=1 \
      --enable-nested-virtualization \
      --pool-size=0 \
      --idle-timeout=7200 \
      --running-timeout=43200 \
      --service-account="sdv-ws-runner@${PROJECT_ID}.iam.gserviceaccount.com" \
      --container-custom-image="${CUSTOM_IMAGE}" \
      --pd-disk-type="pd-ssd" \
      --pd-source-snapshot="projects/${PROJECT_ID}/global/snapshots/aaos-sdv-dev-snapshot"
    
    gcloud workstations delete sdv-workstation \
      --cluster="sdv-cluster" \
      --config="sdv-staging-config" \
      --region="${REGION}" \
      --quiet
    
    gcloud workstations configs delete sdv-staging-config \
      --cluster="sdv-cluster" \
      --region="${REGION}" \
      --quiet
    

    To onboard each developer in ${REGION}, create a workstation from user-workstation-config (gcloud workstations create "${DEV_WORKSTATION}" --cluster="sdv-cluster" --config="user-workstation-config" --region="${REGION}"), grant project-level roles/workstations.operationViewer to the developer, and grant roles/workstations.user on that workstation under Cloud Workstations > Workstations > More > Add users in the Google Cloud console. Developers connect over SSH and tunnel port 8443 to view the Cuttlefish WebRTC displays at https://localhost:8443 (instead of running the aaos-sdv-demos desktop wrapper scripts from Cloud development):

    # On the developer's machine (forwards Cuttlefish WebRTC port 8443):
    gcloud workstations ssh "${DEV_WORKSTATION}" \
      --cluster="sdv-cluster" \
      --config="user-workstation-config" \
      --region="${REGION}" \
      --start-workstation \
      --ssh-flag="-L 8443:localhost:8443"
    
    # Inside workstation Terminal 1 (SDV Media + HAR, serial 0.0.0.0:6520):
    cd ~/Workspace/aaos-android17 && source build/envsetup.sh
    lunch sdv_media_har_cf-aosp_current-userdebug
    cvd create --extra_bootconfig_args="androidboot.sdv.boot_mode=unlocked androidboot.sdv.instance_name=instance1 androidboot.virt.address=3"
    
    # Inside workstation Terminal 2 (SDV IVI + Display Safety, serial 0.0.0.0:6521):
    cd ~/Workspace/aaos-android17 && export OUT_DIR=out-ivi && source build/envsetup.sh
    lunch sdv_ivi_cf_ds-aosp_current-userdebug
    cvd create --extra_bootconfig_args="androidboot.sdv.boot_mode=unlocked androidboot.sdv.instance_name=instance2 androidboot.virt.address=4" \
      --display1=width=1920,height=720
    

    When retiring a from-scratch deployment, also delete the sdv-images Artifact Registry repository (gcloud artifacts repositories delete sdv-images --location="${REGION}" --quiet) and any ${PROJECT_ID}_cloudbuild Cloud Storage bucket alongside the resources in Stop or delete resources.