Creating a Service Instance (old path)

You can create an Oracle Java Cloud Service instance using the REST API, as described in the following procedure.

Note:

  • The cURL commands and request parameters used in this use case are applicable only to Oracle Cloud Machine.

  • The cURL command examples use the URL structure https://rest_server_url/resource-path, where rest_server_url is the REST server to contact for your identity domain. See Send Requests.

You can add a Coherence data tier cluster and enable Oracle Traffic Director (OTD) as a local load balancer when you create the service instance.

To create an Oracle Java Cloud Service instance:

  1. Before creating an Oracle Java Cloud Service instance, review the service instances that currently exist to ensure the name of your new service instance is unique.
    curl -i -X GET -u username:userPassword1! -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (GET).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -H to define a custom header, X-ID-TENANT-NAME, to identify the identity domain ID.

    For more information, see View All Service Instances.

    The following shows an example of the response body. In this example, there are two service instances, My12cServer that is running 12c and My11gServer that is running 11g.

    {
        "uri":"https:\/\/rest_server_url/\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain",
        "service_type":"jaas",
        "implementation_version":"1.0",
        "services" : [
        {
            "service_name":"My12cServer",
            "version":"12cR3",
            "wlsVersion":"12.1.3.0.x",
            "status":"Running",
            "error_status_desc": "",
            "compliance_status": "",
            "compliance_status_desc": "",
            "auto_update": "true",
            "description":"WebLogicEnterprise",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time": "Fri Jan 23 22:18:26 UTC 2015",
            "last_modified_time": "Fri Jan 23 22:18:26 UTC 2015",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url/\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/My12cServer"
        },
        {
            "service_name":"My11gServer",
            "version":"11g",
            "wlsVersion":"10.3.6.0.xx",
            "status":"Running",
            "description":"",
            "identity_domain":"ExampleIdentityDomain",
            "creation_time": "Wed Jan 21 12:23:26 UTC 2015",
            "last_modified_time": ""Wed Jan 21 12:23:26 UTC 2015",
            "created_by":"username",
            "service_uri":"https:\/\/rest_server_url/\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/My11gServer"
        }]
    }
    
  2. Create a JSON document, create.json, that defines the details of the service instance.

    The following shows an example of the request document. In this example:

    • Service instance is named ExampleInstance.

    • Service level is PAAS.

    • Software installed is WebLogic Server Enterprise Edition (EE), version is 12.1.3.

    • Domain name is configured as ExampleDomain.

    • Cluster name is configured as ExampleCluster.

    • Two Managed Servers are configured within a cluster.

    • Oracle Traffic Director is enabled for load balancing.

    • Compute shape for the service instance and load balancer is configured with 1 OCPU and 7.5 GB memory (OC3).

    Note: If using WebLogic Server 12.2.1 and domain partitions, you must use the PAAS service level and either the EE or SUITE edition.

    {
        "serviceName" : "ExampleInstance",
        "level" : "PAAS",
        "subscriptionType" : "HOURLY",
        "enableAdminConsole": true,
        "description" : "Example, Inc product distribution center",
        "provisionOTD" : true,
        "cloudStorageContainer" : "Storage-ExampleIdentityDomain/JCSBackup",
        "cloudStorageUser" : "storageusername",
        "cloudStoragePassword" : "Mypassword2!",
        "createStorageContainerIfMissing" : true,
        "sampleAppDeploymentRequested" : true,
        "parameters" : [
        {
            "type" : "weblogic",
            "version" : "12.1.3",
            "edition" : "EE",
            "domainMode" : "PRODUCTION",
            "managedServerCount" : "2",
            "adminPort" : "7001",
            "deploymentChannelPort" : "9001",
            "securedAdminPort" : "7002",
            "contentPort" : "8001",
            "securedContentPort" : "8002",
            "domainName" : "ExampleDomain",
            "clusterName" : "ExampleCluster",
            "adminUserName" : "myadminuser",
            "adminPassword" : "Mypassword1!",
            "nodeManagerPort" : "5556",
            "nodeManagerUserName" : "nodeMangerAdmin",
            "nodeManagerPassword" : "Mypassword1!",
            "dbServiceName" : "myDBService",
            "dbaName" : "SYS",
            "dbaPassword" : "Mypassword3!",
            "shape" : "oc3",
            "domainVolumeSize" : "10G",
            "backupVolumeSize" : "50G",
            "VMsPublicKey" : "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEArHjWnvrmTQBRb5a/3d62HA8+sbX0c2MJcfAhH3ETF3nUYqrmur+ZYYT7bTEbXyRO+qkU0Ey3yHK5rSeiwuye15ZMQy6J0cGstNTJMiqLVsBWURUFSYG2Fs2EfM1fnOe1W60KgjSHKQDmmiwVtay2hgWSBq66t9u370a0BD2dwc= mypublickey"
        },
        {
            "type" : "OTD",
            "adminUserName" : "otdAdmin",
            "adminPassword" : "Mypassword1!",
            "listenerPortsEnabled" : true,
            "listenerPort" : "8080",
            "listenerType" : "http",
            "securedListenerPort" : "8081",
            "loadBalancingPolicy" : "least_connection_count",
            "adminPort" : "8989",
            "shape" : "oc3",
            "VMsPublicKey" : "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEArHjWnvrmTQBRb5a/3d62HA8+sbX0c2MJcfAhH3ETF3nUYqrmur+ZYYT7bTEbXyRO+qkU0Ey3yHK5rSeiwuye15ZMQy6J0cGstNTJMiqLVsBWURUFSYG2Fs2EfM1fnOe1W60KgjSHKQDmmiwVtay2hgWSBq66t9u370a0BD2dwc= mypublickey" 
        }]
    }
    

    If enabling Oracle Coherence for a service instance, you must use the SUITE edition and include the "type":"datagrid" option. Then specify attributes to use a default capacity unit or define your own configuration for a capacity unit. See Create a Service Instance. The "type":"datagrid" example that follows uses a default capacity unit.

        {
            "type" : "datagrid",
            "scalingUnitCount"  : "1",
            "clusterName"       : "ExampleDGCluster",
            "scalingUnitName"   : "SMALL"
        }  

    In the "type":"datagrid" example:

    • Name for the storage-enabled WebLogic Server cluster is ExampleDGCluster.

    • The SMALL default capacity unit is configured.

    • One count of the default capacity unit is configured.

    For other parameters, see Create a Service Instance. For example, you must use customPayload if you are creating a service instance with AppToCloud artifacts.

  3. Create the Oracle Java Cloud Service instance, passing the JSON document defined in step 2.
    curl -i -X POST -u username:userPassword1! -d @create.json -H "Content-Type:application/vnd.com.oracle.oracloud.provisioning.Service+json" -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (POST).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -d option to identify the request document, in JSON format, on the local machine (create.json).

    • -H to identify the content type as application/vnd.com.oracle.oracloud.provisioning.Service+json and define a custom header, X-ID-TENANT-NAME, to identify the identity domain

    The following shows an example of the response header.

    
    HTTP/1.1 100 Continue
    
    HTTP/1.1 202 Accepted
    Date: Thu, 14 Jul 2016 23:16:53 GMT
    Location: https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/status/create/job/8466
    Content-Length: 0
    Content-Type: application/vnd.com.oracle.oracloud.provisioning.Service+json
    Service-URI: https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/ExampleInstance
    Retry-After: 60
    
  4. Check the status of the service instance creation operation using the resource URI returned in the Location header. For more information, see View the Status of a Service Instance Lifecycle Operation.
    curl -i -X GET -u username:userPassword1! -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/status/create/job/8466
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (GET).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -H to define a custom header, X-ID-TENANT-NAME, to identify the identity domain

    The following shows an example of the response body in JSON format:

    {
        "service_name": "ExampleInstance",
        "version": "12cR3",
        "wlsVersion": "12.1.3.0.xxxxxx",
        "status": "In Progress",
        "error_status_desc": "",
        "compliance_status": "",
        "compliance_status_desc": "",
        "auto_update": "true",
        "description": "Example, Inc product distribution",
        "identity_domain": "ExampleIdentityDomain",
        "creation_time": "Thu Jul 14 23:16:58 UTC 2016",
        "last_modified_time": "Thu Jul 14 23:16:56 UTC 2016",
        "created_by": "username",
        "service_uri" : "https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/ExampleInstance",
        "message": [
          "Created Compute resources for WebLogic Server...",
          "Created security resources for the service...",
          "Started all Compute resources...",
          "Establishing SSH connectivity to WebLogic Administration Server ..."
      ]
    }
    
  5. Once the service instance is created and running, view the service instance details.
    curl -i -X GET -u username:userPassword1! -H "X-ID-TENANT-NAME:ExampleIdentityDomain" https://rest_server_url/paas/service/jcs/api/v1.1/instances/ExampleIdentityDomain/ExampleInstance
    

    Specify the following options on the cURL command line:

    • -i option to include the HTTP header in the output. This option is optional.

    • -X option to indicate the type of request (GET).

    • -u option to specify the user name and password for the Oracle Java Cloud Service account for authentication.

    • -H to define a custom header, X-ID-TENANT-NAME, to identify the identity domain

    For more information, see View a Service Instance.

    The following shows an example of the response output in JSON format. Your response output will differ depending on your Oracle Java Cloud Service release and environment, and the service instance configuration you created.

    {
        "service_name" : "ExampleInstance",
        "version" : "12cR3",
        "wlsVersion" : "12.1.3.0.xxxxxx",
        "status" : "Running",
        "error_status_desc": "",
        "compliance_status": "",
        "compliance_status_desc": "",
        "auto_update": "true",    
        "description" : "Example, Inc product distribution center",
        "identity_domain" : "ExampleIdentityDomain",
        "creation_time": "Thu Jul 14 23:16:58 UTC 2016",
        "last_modified_time": "Thu Jul 14 23:16:56 UTC 2016",
        "created_by" : "username",
        "service_uri" : "https:\/\/rest_server_url\/paas\/service\/jcs\/api\/v1.1\/instances\/ExampleIdentityDomain\/ExampleInstance",
        "domain_name" : "ExampleDomain",
        "domain_mode" : "PRODUCTION",
        "cluster_name" : "ExampleCluster",
        "num_nodes" : 3,
        "level" : "PAAS",
        "subscription_type" : "HOURLY",
        "edition" : "EE",
        "shape" : "oc3",
        "otd_provisioned" : "yes",
        "otd_shape": "oc3",
        "otd_storage_size": 41984, 
        "service_components": [
        {
            "type": "WLS",
            "version": "12.1.3.0.xxxxxx"
        },
        {
            "type": "JDK",
            "version": "1.7.0_xxx"
        },
        {
            "type": "OTD_JDK",
            "version": "1.7.0_xxx"
        },
        {
            "type": "OTD",
            "version": "11.1.1.9.x"
        }],
        "creation_job_id" : "8466",
        "deletion_job_id": 0,
        "db_info" : "myDBService:1521\/mydbserviceinfo",
        "db_service_name" : "myDBService", 
        "num_ip_reservations" : 3,
        "wls_admin_url" : "https:\/\/host:7002\/console",
        "fmw_control_url" : "https:\/\/host:7002\/em",
        "otd_admin_url" : "https:\/\/host:8989",
        "sample_app_url": "https:\/\/host\/sample-app\/",
        "secure_content_url" : "https:\/\/host",
        "content_url" : "http:\/\/host",
        "wls_deployment_channel_port": 9001,
        "psm_plugin_version": "16.x.x-xxx",
        "compute_site_name": "mycomputesite",
        "db_associations": [
        {
            "db_service_name": "myDBService",
            "db_infra": true,
            "db_connect_string": "myDBService:1521\/mydbserviceinfo",
            "pdb_service_name": "PDB1",
            "db_version": "12.1.0.2",
            "db_em_url": "https:\/\/host:5500\/em",
            "db_apex_url": "https:\/\/host\/apex\/pdb1\/",
            "db_monitor_url": "https:\/\/host\/dbaas_monitor",
            "db_service_level": "PAAS"
        }]
    }
    

    If you enabled Oracle Coherence by using a capacity unit, the datagrid option is included in the contents of the response body. For example:

      "options": [{
        "type": "datagrid",
        "clusters": [{
          "clusterName": "ExampleDGCluster",
          "scalingUnitCount": 1,
          "scalingUnitName": "SMALL",
          "shape": "oc3",
          "vmCount": 3,
          "jvmCount": 1,
          "heapSize": "4608M",
          "maxScalingUnit": 10,
          "heapIncrements": "13824M",
          "primaryIncrements": "4608M",
          "totalHeap": "13824M",
          "totalPrimary": "4608M",
          "maxHeap": "138240M",
          "maxPrimary": "46080M",
          "scalingUnitInstances": [{
            "servers": [
              {"name": "ExampleI_server_3_DG"},
              {"name": "ExampleI_server_4_DG"},
              {"name": "ExampleI_server_5_DG"}
            ],
            "scalingUnitInstanceId": 2,
            "status": "Ready"
          }]
        }]
      }]