Skip to main content
You can create custom boot disk images based on existing images by using Packer and the Nebius Packer plug-in. The Nebius Packer plug-in creates a temporary virtual machine (VM) from a base image, connects to it over SSH, runs provisioners and then creates a new boot disk image. Use this workflow to:
  • Pre-install packages and system dependencies
  • Prepare versioned images for repeated VM creation
  • Standardize environments across teams or workloads

Before you start

  1. Install Packer.
  2. Make sure your project has sufficient quotas for image creation:
    • Number of images
    • Total storage capacity of all images
  3. Set up authentication by using one of the following methods.
    • Service account
      1. Create a service account and generate a key pair. The key pair is saved to a JSON file, for example, ~/.nebius/<service_account_ID>_credentials.json.
      2. Open the file and copy the value of the private_key field.
      3. Save the key to the private.pem file.
      4. Use the values from the JSON file in your Packer configuration.
    • Access token Generate an access token:
      An access token is valid for 12 hours. After it expires, create a new one.

Steps

Install the Nebius Packer plug-in

  1. Create the config.pkr.hcl file and add the Nebius plug-in configuration:
  2. Initialize the plug-in in the directory that contains your Packer configuration files:

Build the disk image

The Nebius image builder creates a VM from a base image, provisions it over SSH, and publishes a new image.
  1. Create the build.pkr.hcl file and add the nebius-image source to it:
    The nebius-image source has the following parameters: General parameters
    • communicator (optional): Specifies how Packer connects to the VM. Supported value: ssh (default).
    • parent_id: ID of the project where the resulting image will be created.
    • ssh_username: Username used to connect to the VM.
    Authentication
    • service_account.private_key_file: Path to the private key file.
    • service_account.public_key_id: ID of the public key.
    • service_account.account_id: Service account ID.
    • token: Access token used for authentication. Use this as an alternative to service_account.
    Disk configuration
    • disk.size_gibibytes: Size of the disk in GiB.
    Base image
    • base_image.family: Image family name.
    • base_image.id: Specific image ID.
    Network
    • network.subnet_id (optional): ID of an existing subnet that will be used to create a VM. If not provided, the plug-in attempts to find the project’s default network.
    • network.associate_public_ip_address (optional): Assigns a public IP address. Use a public IP if your build environment connects directly via SSH.
    VM configuration
    • instance.platform: VM platform.
    • instance.preset: VM platform preset (number of GPUs and vCPUs, RAM size).
    Output image configuration
    • image.name: Image name.
    • image.version (optional): Image version.
    • image.image_family (optional): Image family identifier.
    • image.image_family_human_readable (optional): Display name for the image family.
    • image.cpu_architecture (optional): CPU architecture.
  2. Add the build block to the build.pkr.hcl file:
  3. From the directory with the configuration files, run:

Check the image

  1. In the web console, go to  Storage → Disks.
  2. Go to the Images tab and locate your image.