# 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
load_balancer_client = oci.load_balancer.LoadBalancerClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_load_balancer_response = load_balancer_client.create_load_balancer(
create_load_balancer_details=oci.load_balancer.models.CreateLoadBalancerDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
display_name="EXAMPLE-displayName-Value",
shape_name="EXAMPLE-shapeName-Value",
subnet_ids=["EXAMPLE--Value"],
shape_details=oci.load_balancer.models.ShapeDetails(
minimum_bandwidth_in_mbps=6999,
maximum_bandwidth_in_mbps=6773),
is_private=True,
is_delete_protection_enabled=True,
ip_mode="IPV6",
is_request_id_enabled=False,
request_id_header="EXAMPLE-requestIdHeader-Value",
reserved_ips=[
oci.load_balancer.models.ReservedIP(
id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value")],
listeners={
'EXAMPLE_KEY_NiGSK': {
'defaultBackendSetName': 'EXAMPLE-defaultBackendSetName-Value',
'port': 39668,
'protocol': 'EXAMPLE-protocol-Value',
'hostnameNames': ['EXAMPLE--Value'],
'pathRouteSetName': 'EXAMPLE-pathRouteSetName-Value',
'sslConfiguration': {
'verifyDepth': 589,
'verifyPeerCertificate': False,
'hasSessionResumption': True,
'trustedCertificateAuthorityIds': ['EXAMPLE--Value'],
'certificateIds': ['EXAMPLE--Value'],
'certificateName': 'EXAMPLE-certificateName-Value',
'protocols': ['EXAMPLE--Value'],
'cipherSuiteName': 'EXAMPLE-cipherSuiteName-Value',
'serverOrderPreference': 'DISABLED'},
'connectionConfiguration': {
'idleTimeout': 595,
'backendTcpProxyProtocolVersion': 1,
'backendTcpProxyProtocolOptions': ['PP2_TYPE_AUTHORITY']},
'routingPolicyName': 'EXAMPLE-routingPolicyName-Value',
'ruleSetNames': ['EXAMPLE--Value']}},
hostnames={
'EXAMPLE_KEY_xb4II': {
'name': 'EXAMPLE-name-Value',
'hostname': 'EXAMPLE-hostname-Value'}},
backend_sets={
'EXAMPLE_KEY_KoX7E': {
'policy': 'EXAMPLE-policy-Value',
'healthChecker': {
'protocol': 'EXAMPLE-protocol-Value',
'urlPath': 'EXAMPLE-urlPath-Value',
'port': 44237,
'returnCode': 887,
'retries': 807,
'timeoutInMillis': 509825,
'intervalInMillis': 1037820,
'responseBodyRegex': 'EXAMPLE-responseBodyRegex-Value',
'isForcePlainText': False},
'backends': [
{
'ipAddress': 'EXAMPLE-ipAddress-Value',
'port': 55035,
'weight': 457,
'maxConnections': 54292,
'backup': False,
'drain': True,
'offline': True}],
'backendMaxConnections': 17273,
'sslConfiguration': {
'verifyDepth': 668,
'verifyPeerCertificate': False,
'hasSessionResumption': True,
'trustedCertificateAuthorityIds': ['EXAMPLE--Value'],
'certificateIds': ['EXAMPLE--Value'],
'certificateName': 'EXAMPLE-certificateName-Value',
'protocols': ['EXAMPLE--Value'],
'cipherSuiteName': 'EXAMPLE-cipherSuiteName-Value',
'serverOrderPreference': 'DISABLED'},
'sessionPersistenceConfiguration': {
'cookieName': 'EXAMPLE-cookieName-Value',
'disableFallback': False},
'lbCookieSessionPersistenceConfiguration': {
'cookieName': 'EXAMPLE-cookieName-Value',
'disableFallback': True,
'domain': 'EXAMPLE-domain-Value',
'path': 'EXAMPLE-path-Value',
'maxAgeInSeconds': 549,
'isSecure': True,
'isHttpOnly': False}}},
network_security_group_ids=["EXAMPLE--Value"],
certificates={
'EXAMPLE_KEY_1LPEO': {
'certificateName': 'EXAMPLE-certificateName-Value',
'passphrase': 'EXAMPLE-passphrase-Value',
'privateKey': 'EXAMPLE-privateKey-Value',
'publicCertificate': 'EXAMPLE-publicCertificate-Value',
'caCertificate': 'EXAMPLE-caCertificate-Value'}},
ssl_cipher_suites={
'EXAMPLE_KEY_JI1Ls': {
'name': 'EXAMPLE-name-Value',
'ciphers': ['EXAMPLE--Value']}},
path_route_sets={
'EXAMPLE_KEY_l7xZn': {
'pathRoutes': [
{
'path': 'EXAMPLE-path-Value',
'pathMatchType': {
'matchType': 'SUFFIX_MATCH'},
'backendSetName': 'EXAMPLE-backendSetName-Value'}]}},
freeform_tags={
'EXAMPLE_KEY_trwIL': 'EXAMPLE_VALUE_x6SESeHdoaZY6PAidZO1'},
defined_tags={
'EXAMPLE_KEY_LODSK': {
'EXAMPLE_KEY_GwSM7': 'EXAMPLE--Value'}},
zpr_tags={
'EXAMPLE_KEY_78t3s': {
'EXAMPLE_KEY_OIfl0': 'EXAMPLE--Value'}},
rule_sets={
'EXAMPLE_KEY_HPuQV': {
'items': [
{
'action': 'ALLOW',
'conditions': [
{
'attributeName': 'SOURCE_IP_ADDRESS',
'attributeValue': 'EXAMPLE-attributeValue-Value'}],
'description': 'EXAMPLE-description-Value'}]}}),
opc_request_id="SDACYYB4NHNJFIHJCNCO<unique_ID>",
opc_retry_token="EXAMPLE-opcRetryToken-Value")
# Get the data from response
print(create_load_balancer_response.headers)