VM Creation Using the CLI

After you have an image and network, you can create a VM by running the pcloud compute instances create command. The following is an example of the output from using the -h flag for this command:

# pcloud compute instances create -h
Create a VM Instance in IBM Power Cloud.

 Most of the flags have default values, but you must enter the VM name to be created, and mandatory image and network names.
 You can list the images of your Cloud by running the "pcloud compute images list" command.
 You can list the available networks by running the "pcloud compute networks list" command.

 Creating a new VM instance can take a few minutes to fully complete. You can look at the state
 of the VM by using the "pcloud compute instances describe" subcommand.

Usage:
  pcloud compute instances create <InstanceName> --image <ImageName> --network <NetworkName[:IPAddress]> [flags]

Flags:
  -a, --affinityPolicy string   Affinity policy for replicants being created (must be one of {"affinity", "anti-affinity", "none"}) (default "none")
  -c, --cores float             Number of cores to allocate to the VM Instance (default 2)
  -h, --help                    help for create
  -i, --image string            Image to allocate to the VM Instance (note that 'ImageID' or 'ImageName' can be used) (required)
  -k, --keypair string          SSHKeyPair Name
  -m, --memory float            Memory size (in GB) to allocate to the VM Instance (default 4)
  -s, --namingScheme string     Replicants naming scheme (must be one of {"prefix", "suffix"}) (default "suffix")
  -n, --network strings         Networks to assign to the VM Instance, (values must follow the <NetworkName[:IPAddress]> form, note that 'NetworkID' can be provided instead of 'NetworkName', 'IPAddress' is optional, several --network allowed) (required)
  -P, --pinPolicy string        VM pinning policy (must be one of {"none", "soft", "hard"}) (default "none")
  -t, --proctype string         Dedicated, Shared or Capped Processing Type (must be one of {"dedicated", "shared", "capped"}) (default "dedicated")
  -r, --replicants float        Number of replicants (default 1)
  -T, --storagetype string      Storage type for VMInstance deployment (required only if image is a "stock" image - default value set).
                                Storage type depends on the region of your cloud and can only be set from a short list of available values.
                                You can list the available storage types and the default storage type for your cloud by running the "pcloud compute clouds describe" command.
  -u, --userdata string         Cloud-init user defined data file (optional, if necessary data are uuencoded before being sent)
  -v, --volume strings          Volumes to assign to the VM Instance (several --volume allowed, note that 'VolumeID' or 'VolumeName' can be used)

Global Flags:
  -F, --format string      Available formats: 'table', 'yaml', 'json', 'csv'.
                            Default is command specific.
                            Can be used with describe and list subcommands.
  -D, --log.dir string     Override Log file directory
  -L, --log.file string    Override Log file name
  -V, --verbosity string   Override Log verbosity

Some of the flags have default values, but you must enter several parameters. For example, you must enter the VM image name and the network ID.

You can list the available networks by running the pcloud compute networks list command. A cloud instance has at least one network that was created when it was initially provisioned. This network is what connects the cloud instance and its VMs to GCP.

If you run the command in the following example, you create a new AIX 7.2 VM with two entitled shared cores of compute and 8 GB of RAM.

pcloud compute instances create mytestvm -i 7200-03-03 -m 8 -c 2 -t shared -n gcp-network

Creating a new VM instance can take a few minutes to fully complete. You can look at the state of the VM by using the describe subcommand. In the following example, the VM is still booting up and initializing.

# pcloud compute instances describe test-vm10
instanceID: 4f99e4c5-b8e4-4751-80a8-dd02ccbb00d0
name: test-vm10
cloudID: 7f16fae4f3f54d8bb62f75645db56905
systemType: s922
cores: 2
procType: shared
memory: 24
pinPolicy: none
status: ACTIVE
health:
  status: OK
  lastUpdate: 2021-04-22T17:23:12.354988
  reason: '-'
fault:
  code: 0
  created: '-'
  details: '-'
  message: '-'
imageID: 91e656a6-a9a1-4a99-abb9-7bcb366c3546
networks:
- ipAddress: 192.168.0.17
  macAddress: fa:b8:ef:cf:4b:20
  networkName: gcp-network
  networkID: 8e72b5cc-9e50-4b06-bc56-eb4e1781eefe
volumes:
- name: test-vm10-4f99e4c5-00000ad1-boot-0
  ID: bc141301-85a2-461e-8c68-1f0bc67a35c4
  storageType: standard
  size: 20
  shareable: false
  bootable: true
  bootVolume: true
creationDate: "2021-04-22T17:09:37.000Z"
updateDate: "2021-04-22T17:09:37.000Z"
progress: 0

To initially access the new VM, you can use the console subcommand. This subcommand generates a url that can be used in your web browser to access the console of the VM. A recommended first task is to create a password for root using the passwd command so that ssh as root can be used with the VM.

pcloud compute instances console mytestvm


console: https://pforg.converge.cloud/console/index.html?token=<token>

Here is a screen capture of the console: