I decided to create a Python script for automating the creation process. The script basically tries to create an instance every minute. Everything is working fine except I cant find a way assign custom boot_volume_size_in_gbs. I went through the docs multiple times. Still can't find anything

I tried assigning boot_volume_size_in_gbs value inside launch_instance object

compute_client = oci.core.ComputeClient(config)
        instance = compute_client.launch_instance(
            oci.core.models.LaunchInstanceDetails(
                compartment_id=compartment_id,
                shape=shape,
                image_id=image_id,
                subnet_id=subnet_id,
                display_name=display_name,
                availability_domain=availability_domain,
                shape_config=oci.core.models.LaunchInstanceShapeConfigDetails(
                    memory_in_gbs=memory_in_gb,
                    ocpus=ocpus
                ),
                create_vnic_details=oci.core.models.CreateVnicDetails(
                    subnet_id=subnet_id,
                    assign_public_ip=assign_public_ip
                ),
                metadata={
                    "ssh_authorized_keys": public_key
                },

                boot_volume_size_in_gbs=boot_volume_size_in_gb
                
            )
        ).data

I expected it to work but instead got this error:

Unrecognized keyword arguments: boot_volume_size_in_gbs
1

There are 1 best solutions below

0
On

Can you please point out the API doc that lists the above parameter? AFAIK, that parameter is no longer supported. The parameter that is supported is memory_in_gbs . Can you try that and see?

Here is the API doc link: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/datatypes/LaunchInstanceShapeConfigDetails

And here is the Python SDK sample for the API operation: https://docs.oracle.com/en-us/iaas/api/#/en/iaas/20160918/Instance/LaunchInstance:~:text=Java%20SDK-,Python,-SDK