I’m launching compute instances programmatically using a custom image I created from an existing VM.BM.Standard2.52 instance. The API launch request fails with ‘Invalid shape’ error when I try to use VM.Standard2.4 shape with this custom image.
Launch request:
POST /20160918/instances
{
"compartmentId": "ocid1.compartment.oc1..aaa...",
"availabilityDomain": "Kfyv:PHX-AD-1",
"shape": "VM.Standard2.4",
"imageId": "ocid1.image.oc1.phx.aaa..."
}
The same shape works fine with platform images. Is there a compatibility issue between custom images and certain shapes? This is blocking our instance automation workflow.
Use the ListShapes API to verify shape availability in your AD and check compatibility with your image. Some shapes aren’t available in all ADs, and the error message defaults to ‘Invalid shape’ even when it’s actually an availability issue. Include the imageId parameter in your ListShapes call to filter for compatible shapes only.
Custom images inherit architecture constraints from the source instance. If your source was a bare metal shape and you’re trying to launch on a VM shape, there might be compatibility issues with the boot volume or image metadata.
Bare metal to VM shape conversion with custom images can be tricky. The image might have hardware-specific drivers or configurations that don’t translate to VM shapes. Try using a VM-based source instance for creating custom images intended for VM deployments. Also check if your custom image has the right boot volume size - some shapes have minimum boot volume requirements.