cloud · IBM Cloud · PowerVS

IBM Cloud: importing a boot image in a Power VS service

# ibmcloud login

    APY_KEY=

    if [ -z "$APY_KEY" ]; then
        echo "API KEY was not set."
        exit 1
    fi
    ibmcloud login --no-region --apikey "$APY_KEY"

# get the CRN for the target Power VS service

	VAR=($(ibmcloud pi service-list --json | jq -r '.[] | "\(.CRN),\(.Name)"'))

	echo
	echo "--------------------------"
	for i in "${VAR[@]}"
	do
		NAME=$(echo $i | awk -F ',' '{print $2}')
		CRN=$(echo $i | awk -F ',' '{print $1}')
		GUID=$(echo $CRN | awk -F ':' '{print $8}')

		echo "PowerVS:"
		echo "	Name: $NAME"
		echo "	GUID: $GUID"
		echo "	CRN : $CRN"
		echo "----------"
	done

# set the target PowerVS as active

    CRN=
    if [ -z "$CRN" ]; then
        echo "CRN was not set."
        exit 1
    fi
    ibmcloud pi st "$CRN"

# ensure you have the secret key and access key for the object storage bucket where your .ova image is located

IMAGE_NAME=
IMAGE_FILE_NAME=
OSTYPE=
DISKTYPE=tier1
ACCESS_KEY=
SECRET_KEY=
OBJ_BUCKET=
OBJ_BUCKET_REGION=

ibmcloud pi image-import "$IMAGE_NAME" --os-type "$OSTYPE" --disk-type "$DISKTYPE" --bucket-access private --access-key "$ACCESS_KEY" --secret-key "$SECRET_KEY" --image-file-name "$IMAGE_FILE_NAME" --bucket "$OBJ_BUCKET" --region "$OBJ_BUCKET_REGION" --job


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s