# 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",
        shape="EXAMPLE-shape-Value",
        create_vnic_details=oci.core.models.CreateVnicDetails(
            assign_public_ip=True,
            defined_tags={
                'EXAMPLE_KEY_9LygG': {
                    'EXAMPLE_KEY_7OrZ2': 'EXAMPLE--Value'}},
            display_name="EXAMPLE-displayName-Value",
            freeform_tags={
                'EXAMPLE_KEY_kluMn': 'EXAMPLE_VALUE_2Hbf1e83tazbYavsMcQI'},
            hostname_label="EXAMPLE-hostnameLabel-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_1CHWK': {
                'EXAMPLE_KEY_NBR6D': 'EXAMPLE--Value'}},
        display_name="EXAMPLE-displayName-Value",
        extended_metadata={
            'EXAMPLE_KEY_Ib1II': 'EXAMPLE--Value'},
        fault_domain="EXAMPLE-faultDomain-Value",
        freeform_tags={
            'EXAMPLE_KEY_iF6PZ': 'EXAMPLE_VALUE_ol6yJU5yXmECZgt7SMjW'},
        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="PARAVIRTUALIZED",
            firmware="UEFI_64",
            network_type="E1000",
            remote_data_volume_type="PARAVIRTUALIZED",
            is_pv_encryption_in_transit_enabled=False,
            is_consistent_volume_naming_enabled=False),
        instance_options=oci.core.models.InstanceOptions(
            are_legacy_imds_endpoints_disabled=False),
        availability_config=oci.core.models.LaunchInstanceAvailabilityConfigDetails(
            recovery_action="RESTORE_INSTANCE"),
        metadata={
            'EXAMPLE_KEY_PSp9v': 'EXAMPLE_VALUE_MbRqec2NHq6xjbbA1C52'},
        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_config=oci.core.models.LaunchInstanceShapeConfigDetails(
            ocpus=2887.8599,
            memory_in_gbs=3745.3955),
        source_details=oci.core.models.InstanceSourceViaImageDetails(
            source_type="image",
            image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
            boot_volume_size_in_gbs=122,
            kms_key_id="ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value"),
        subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
        is_pv_encryption_in_transit_enabled=False,
        platform_config=oci.core.models.AmdMilanBmLaunchInstancePlatformConfig(
            type="AMD_MILAN_BM",
            numa_nodes_per_socket="NPS1")),
    opc_retry_token="EXAMPLE-opcRetryToken-Value")

# Get the data from response
print(launch_instance_response.data)