# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).
import oci
# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()
# Initialize service client with default config file
core_client = oci.core.ComputeClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
launch_instance_response = core_client.launch_instance(
launch_instance_details=oci.core.models.LaunchInstanceDetails(
availability_domain="EXAMPLE-availabilityDomain-Value",
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
capacity_reservation_id="ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
create_vnic_details=oci.core.models.CreateVnicDetails(
assign_ipv6_ip=False,
assign_public_ip=False,
assign_private_dns_record=False,
defined_tags={
'EXAMPLE_KEY_lykzQ': {
'EXAMPLE_KEY_H9sBk': 'EXAMPLE--Value'}},
display_name="EXAMPLE-displayName-Value",
freeform_tags={
'EXAMPLE_KEY_HUa0o': 'EXAMPLE_VALUE_C2msj230cKzpVjCczOBA'},
security_attributes={
'EXAMPLE_KEY_ZTkt5': {
'EXAMPLE_KEY_Z8unV': 'EXAMPLE--Value'}},
hostname_label="EXAMPLE-hostnameLabel-Value",
ipv6_address_ipv6_subnet_cidr_pair_details=[
oci.core.models.Ipv6AddressIpv6SubnetCidrPairDetails(
ipv6_subnet_cidr="EXAMPLE-ipv6SubnetCidr-Value",
ipv6_address="EXAMPLE-ipv6Address-Value")],
nsg_ids=["EXAMPLE--Value"],
private_ip="EXAMPLE-privateIp-Value",
skip_source_dest_check=False,
subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
vlan_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value"),
dedicated_vm_host_id="ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value",
defined_tags={
'EXAMPLE_KEY_VpkDS': {
'EXAMPLE_KEY_thM1C': 'EXAMPLE--Value'}},
security_attributes={
'EXAMPLE_KEY_VX38u': {
'EXAMPLE_KEY_G6JFX': 'EXAMPLE--Value'}},
display_name="EXAMPLE-displayName-Value",
extended_metadata={
'EXAMPLE_KEY_cgQYe': 'EXAMPLE--Value'},
fault_domain="EXAMPLE-faultDomain-Value",
cluster_placement_group_id="ocid1.test.oc1..<unique_ID>EXAMPLE-clusterPlacementGroupId-Value",
freeform_tags={
'EXAMPLE_KEY_gKwlx': 'EXAMPLE_VALUE_UwnRCzi3A3xmsIu0BXBu'},
compute_cluster_id="ocid1.test.oc1..<unique_ID>EXAMPLE-computeClusterId-Value",
hostname_label="EXAMPLE-hostnameLabel-Value",
image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
ipxe_script="EXAMPLE-ipxeScript-Value",
launch_options=oci.core.models.LaunchOptions(
boot_volume_type="SCSI",
firmware="UEFI_64",
network_type="VFIO",
remote_data_volume_type="ISCSI",
is_pv_encryption_in_transit_enabled=False,
is_consistent_volume_naming_enabled=False),
instance_options=oci.core.models.InstanceOptions(
are_legacy_imds_endpoints_disabled=True),
availability_config=oci.core.models.LaunchInstanceAvailabilityConfigDetails(
is_live_migration_preferred=True,
recovery_action="STOP_INSTANCE"),
preemptible_instance_config=oci.core.models.PreemptibleInstanceConfigDetails(
preemption_action=oci.core.models.TerminatePreemptionAction(
type="TERMINATE",
preserve_boot_volume=False)),
metadata={
'EXAMPLE_KEY_fQ5ME': 'EXAMPLE_VALUE_5cgroxLDnBEs2JEfloNA'},
agent_config=oci.core.models.LaunchInstanceAgentConfigDetails(
is_monitoring_disabled=False,
is_management_disabled=True,
are_all_plugins_disabled=False,
plugins_config=[
oci.core.models.InstanceAgentPluginConfigDetails(
name="EXAMPLE-name-Value",
desired_state="ENABLED")]),
shape="EXAMPLE-shape-Value",
shape_config=oci.core.models.LaunchInstanceShapeConfigDetails(
ocpus=1696.6694,
vcpus=264,
memory_in_gbs=1574.9282,
baseline_ocpu_utilization="BASELINE_1_2",
nvmes=4),
source_details=oci.core.models.InstanceSourceViaImageDetails(
source_type="image",
boot_volume_size_in_gbs=832,
image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
kms_key_id="ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
boot_volume_vpus_per_gb=110,
instance_source_image_filter_details=oci.core.models.InstanceSourceImageFilterDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
defined_tags_filter={
'EXAMPLE_KEY_G0xky': {
'EXAMPLE_KEY_yjpu6': 'EXAMPLE--Value'}},
operating_system="EXAMPLE-operatingSystem-Value",
operating_system_version="EXAMPLE-operatingSystemVersion-Value")),
subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
launch_volume_attachments=[
oci.core.models.LaunchAttachParavirtualizedVolumeDetails(
type="paravirtualized",
device="EXAMPLE-device-Value",
display_name="EXAMPLE-displayName-Value",
is_read_only=True,
is_shareable=True,
volume_id="ocid1.test.oc1..<unique_ID>EXAMPLE-volumeId-Value",
launch_create_volume_details=oci.core.models.LaunchCreateVolumeFromAttributes(
volume_creation_type="ATTRIBUTES",
size_in_gbs=437,
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
display_name="EXAMPLE-displayName-Value",
kms_key_id="ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
vpus_per_gb=583),
is_pv_encryption_in_transit_enabled=True)],
is_pv_encryption_in_transit_enabled=True,
platform_config=oci.core.models.GenericBmLaunchInstancePlatformConfig(
type="GENERIC_BM",
is_secure_boot_enabled=False,
is_trusted_platform_module_enabled=False,
is_measured_boot_enabled=True,
is_memory_encryption_enabled=True,
numa_nodes_per_socket="NPS4",
is_symmetric_multi_threading_enabled=True,
is_access_control_service_enabled=True,
are_virtual_instructions_enabled=True,
is_input_output_memory_management_unit_enabled=False,
percentage_of_cores_enabled=98,
config_map={
'EXAMPLE_KEY_NmD0R': 'EXAMPLE_VALUE_5b6Q9fQIjGpzui80GXbt'}),
instance_configuration_id="ocid1.test.oc1..<unique_ID>EXAMPLE-instanceConfigurationId-Value",
licensing_configs=[
oci.core.models.LaunchInstanceWindowsLicensingConfig(
type="WINDOWS",
license_type="OCI_PROVIDED")]),
opc_retry_token="EXAMPLE-opcRetryToken-Value")
# Get the data from response
print(launch_instance_response.data)