# 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
cloud_migrations_client = oci.cloud_migrations.MigrationClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_target_asset_response = cloud_migrations_client.create_target_asset(
create_target_asset_details=oci.cloud_migrations.models.CreateVmTargetAssetDetails(
type="INSTANCE",
migration_plan_id="ocid1.test.oc1..<unique_ID>EXAMPLE-migrationPlanId-Value",
is_excluded_from_execution=True,
preferred_shape_type="VM_AMD",
user_spec=oci.cloud_migrations.models.LaunchInstanceDetails(
availability_domain="EXAMPLE-availabilityDomain-Value",
capacity_reservation_id="ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
create_vnic_details=oci.cloud_migrations.models.CreateVnicDetails(
assign_public_ip=True,
assign_private_dns_record=True,
defined_tags={
'EXAMPLE_KEY_vKjmQ': {
'EXAMPLE_KEY_zzqx7': 'EXAMPLE--Value'}},
display_name="EXAMPLE-displayName-Value",
freeform_tags={
'EXAMPLE_KEY_4pwEx': 'EXAMPLE_VALUE_NmK6t5v8wVvLo7OrJlz0'},
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_lR9qF': {
'EXAMPLE_KEY_Ea1Nn': 'EXAMPLE--Value'}},
display_name="EXAMPLE-displayName-Value",
fault_domain="EXAMPLE-faultDomain-Value",
freeform_tags={
'EXAMPLE_KEY_NY7bE': 'EXAMPLE_VALUE_IqsKstgc6gQHvlsu8DdN'},
hostname_label="EXAMPLE-hostnameLabel-Value",
ipxe_script="EXAMPLE-ipxeScript-Value",
instance_options=oci.cloud_migrations.models.InstanceOptions(
are_legacy_imds_endpoints_disabled=True),
preemptible_instance_config=oci.cloud_migrations.models.PreemptibleInstanceConfigDetails(
preemption_action=oci.cloud_migrations.models.TerminatePreemptionAction(
type="TERMINATE",
preserve_boot_volume=False)),
agent_config=oci.cloud_migrations.models.LaunchInstanceAgentConfigDetails(
is_monitoring_disabled=True,
is_management_disabled=True,
are_all_plugins_disabled=True,
plugins_config=[
oci.cloud_migrations.models.InstanceAgentPluginConfigDetails(
name="EXAMPLE-name-Value",
desired_state="DISABLED")]),
shape="EXAMPLE-shape-Value",
shape_config=oci.cloud_migrations.models.LaunchInstanceShapeConfigDetails(
ocpus=9081.549,
memory_in_gbs=1464.7418,
baseline_ocpu_utilization="BASELINE_1_1"),
source_details=oci.cloud_migrations.models.InstanceSourceViaImageDetails(
source_type="image",
image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
boot_volume_size_in_gbs=448,
kms_key_id="ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value",
boot_volume_vpus_per_gb=986),
is_pv_encryption_in_transit_enabled=True),
block_volumes_performance=435,
ms_license="EXAMPLE-msLicense-Value"),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="FYB4BWN1JF3UZPYFHQYI<unique_ID>")
# Get the data from response
print(create_target_asset_response.data)