Virtual Machine

circle-info

These examples assume that linked resources (Network, Subnetwork, Address) already exist in the same environment.

circle-info

Regional resources referenced without the regions/<region>/ prefix will use the region selected in the Stateless IaC UI.

Creating an instance

defaults:
  zone: us-central1-a

resources:
  - type: compute.v1.instance
    name: vm1
    props:
      machine_type: machineTypes/e2-micro
      disks:
        - boot: true
          auto_delete: true
          initialize_params:
            # Set to 30GB to maximize the Free Tier limit
            disk_size_gb: 30
            # Set to pd-standard (Standard Persistent Disk) for Free Tier eligibility
            disk_type: diskTypes/pd-standard
            source_image: projects/ubuntu-os-cloud/global/images/ubuntu-minimal-2404-noble-amd64-v20260219

      network_interfaces:
        - subnetwork: subnetworks/subnet1
          access_configs:
            - type: ONE_TO_ONE_NAT
              nat_ip: addresses/vm1-ip.address
              network_tier: STANDARD

Example plan output

Creating an instance with ephemeral public IP

Example plan output

Last updated