# 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
datacc_client = oci.datacc.BaseinfraClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_vm_instance_response = datacc_client.create_vm_instance(
create_vm_instance_details=oci.datacc.models.CreateVmInstanceDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
infrastructure_id="ocid1.test.oc1..<unique_ID>EXAMPLE-infrastructureId-Value",
cpus_enabled=918,
ssh_public_keys=["EXAMPLE--Value"],
display_name="EXAMPLE-displayName-Value",
description="EXAMPLE-description-Value",
memory_size_in_gbs=2374.1125,
boot_storage_size_in_gbs=1457.5321,
data_storage_size_in_gbs=2419.3877,
image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
server_id="ocid1.test.oc1..<unique_ID>EXAMPLE-serverId-Value",
domain_name="EXAMPLE-domainName-Value",
time_zone="EXAMPLE-timeZone-Value",
dns_servers=["EXAMPLE--Value"],
ntp_servers=["EXAMPLE--Value"],
hostname="EXAMPLE-hostname-Value",
ip_address="EXAMPLE-ipAddress-Value",
netmask="EXAMPLE-netmask-Value",
gateway="EXAMPLE-gateway-Value",
vlan_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value",
userdata="EXAMPLE-userdata-Value",
metadata={
'EXAMPLE_KEY_iscrk': 'EXAMPLE_VALUE_T3QO0zsZfhjqbgmYb6yX'},
vm_network_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vmNetworkId-Value",
defined_tags={
'EXAMPLE_KEY_GTPXn': {
'EXAMPLE_KEY_OPZu1': 'EXAMPLE--Value'}},
freeform_tags={
'EXAMPLE_KEY_WiqJv': 'EXAMPLE_VALUE_oeiFeMuDMV9EmODcixR2'},
system_tags={
'EXAMPLE_KEY_HrSGd': {
'EXAMPLE_KEY_g2UeQ': 'EXAMPLE--Value'}}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="NPIZLMI7KYITBVLEMZEO<unique_ID>")
# Get the data from response
print(create_vm_instance_response.data)