# 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).
from datetime import datetime
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
update_instance_response = core_client.update_instance(
instance_id="ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
update_instance_details=oci.core.models.UpdateInstanceDetails(
capacity_reservation_id="ocid1.test.oc1..<unique_ID>EXAMPLE-capacityReservationId-Value",
defined_tags={
'EXAMPLE_KEY_PaSOz': {
'EXAMPLE_KEY_6M38l': 'EXAMPLE--Value'}},
security_attributes={
'EXAMPLE_KEY_ycfMg': {
'EXAMPLE_KEY_4duHg': 'EXAMPLE--Value'}},
display_name="EXAMPLE-displayName-Value",
freeform_tags={
'EXAMPLE_KEY_8MKI7': 'EXAMPLE_VALUE_QvipF0qPRgSLd99PGcxK'},
agent_config=oci.core.models.UpdateInstanceAgentConfigDetails(
is_monitoring_disabled=False,
is_management_disabled=True,
are_all_plugins_disabled=True,
plugins_config=[
oci.core.models.InstanceAgentPluginConfigDetails(
name="EXAMPLE-name-Value",
desired_state="ENABLED")]),
metadata={
'EXAMPLE_KEY_RwAx6': 'EXAMPLE_VALUE_M2CdiBmCpgeWc333VAY7'},
extended_metadata={
'EXAMPLE_KEY_zZApv': 'EXAMPLE--Value'},
shape="EXAMPLE-shape-Value",
shape_config=oci.core.models.UpdateInstanceShapeConfigDetails(
ocpus=8828.734,
vcpus=518,
memory_in_gbs=5922.532,
baseline_ocpu_utilization="BASELINE_1_1",
nvmes=1),
source_details=oci.core.models.UpdateInstanceSourceViaBootVolumeDetails(
source_type="bootVolume",
boot_volume_id="ocid1.test.oc1..<unique_ID>EXAMPLE-bootVolumeId-Value",
is_preserve_boot_volume_enabled=True),
update_operation_constraint="ALLOW_DOWNTIME",
instance_options=oci.core.models.InstanceOptions(
are_legacy_imds_endpoints_disabled=True),
fault_domain="EXAMPLE-faultDomain-Value",
launch_options=oci.core.models.UpdateLaunchOptions(
boot_volume_type="ISCSI",
network_type="VFIO",
is_pv_encryption_in_transit_enabled=False),
availability_config=oci.core.models.UpdateInstanceAvailabilityConfigDetails(
is_live_migration_preferred=False,
recovery_action="STOP_INSTANCE"),
time_maintenance_reboot_due=datetime.strptime(
"2027-04-25T19:15:03.197Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
dedicated_vm_host_id="ocid1.test.oc1..<unique_ID>EXAMPLE-dedicatedVmHostId-Value",
platform_config=oci.core.models.AmdVmUpdateInstancePlatformConfig(
type="AMD_VM",
is_symmetric_multi_threading_enabled=True),
licensing_configs=[
oci.core.models.UpdateInstanceWindowsLicensingConfig(
type="WINDOWS",
license_type="BRING_YOUR_OWN_LICENSE")]),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
if_match="EXAMPLE-ifMatch-Value")
# Get the data from response
print(update_instance_response.data)