All Products
Search
Document Center

CreateInstance

Last Updated: Mar 04, 2021

This topic shows you how to call the CreateInstance operation to create a Global Traffic Manager (GTM) instance.

Usage notes

You can call the CreateInstance operation of the Transactions and Bills Management (BSS) API to create and renew GTM instances.

CreateInstance operation

For more information, seeCreateInstance.

SDK

  • Maven dependencies

<dependencies>
    <dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>aliyun-java-sdk-bssopenapi</artifactId>
        <version>1.6.6</version>
    </dependency>

    <dependency>
        <groupId>com.aliyun</groupId>
        <artifactId>aliyun-java-sdk-core</artifactId>
        <version>4.4.6</version>
    </dependency>
</dependencies>

For more information about the SDKs for other languages, seeList of SDKs.

Notice

You must set the RegionId parameter to ap-southeast-1.

Create a GTM instance

Description: creates a GTM instance.

Operation name: CreateInstance.

References: For more information, seeCreateInstance.

Parameter description:

GTM is available on both the International site (alibabacloud.com) and China site (aliyun.com). The following part describes the request parameters used by the two sites.

  • China site (aliyun.com)

The following figure shows some of the parameters that are used when you purchase a GTM instance in the GTM console.

1

Parameter

Type

Required

Description

Valid value

ProductCode

String

Yes

The service code.

dns

ProductType

String

Yes

The service type.

dns_gtm_public_cn

SubscriptionType

String

Yes

The billing method of the instance.

Subscription

Period

Integer

Yes

The subscription period of the instance.

This parameter is required when you create a subscription instance. Unit: months. If you want to create a yearly subscription instance, specify an integral multiple of 12.

Parameter.1.Code

String

Yes

The name of the parameter that specifies the version of the resource plan.

PackageEdition

Parameter.1.Value

String

Yes

The version of the resource plan.

standard and ultimate

Parameter.2.Code

String

Yes

The name of the parameter that specifies the quota of detection tasks.

HealthcheckTaskCount

Parameter.2.Value

String

Yes

The quota of detection tasks.

Default value: 0.

Minimum value: 0.

Step size: 100.

Maximum value: 100000.

Parameter.3.Code

String

Yes

The name of the parameter that specifies the quota of SMS notifications.

SmsNotificationCount

Parameter.3.Value

String

Yes

The quota of SMS notifications.

Default value: 0.

Minimum value: 0.

Step size: 1000.

Maximum value: 100000.

RenewPeriod

Integer

No

The auto-renewal period. Unit: months.

This parameter is required when the RenewalStatus parameter is set to AutoRenewal.

RenewalStatus

String

No

The auto-renewal status of the instance.

AutoRenewal: The instance is automatically renewed. ManualRenewal: The instance is manually renewed.

Default value: ManualRenewal.

  • International site (alibabacloud.com)

The following figure shows some of the parameters that are used when you purchase a GTM instance in the GTM console.

22

Parameter

Type

Required

Description

Valid value

ProductCode

String

Yes

The service code.

dns

ProductType

String

Yes

The service type.

dns_gtm_public_intl

SubscriptionType

String

Yes

The billing method of the instance.

Subscription

Period

Integer

Yes

The subscription period of the instance.

This parameter is required when you create a subscription instance. Unit: months. If you want to create a yearly subscription instance, specify an integral multiple of 12.

Parameter.1.Code

String

Yes

The name of the parameter that specifies the version of the resource plan.

PackageEdition

Parameter.1.Value

String

Yes

The version of the resource plan.

standard and ultimate

Parameter.2.Code

String

Yes

The name of the parameter that specifies the quota of detection tasks.

HealthcheckTaskCount

Parameter.2.Value

String

Yes

The quota of detection tasks.

Default value: 0.

Minimum value: 0.

Step size: 100.

Maximum value: 100000.

Sample request for the China site (aliyun.com)

https://business.aliyuncs.com/? Action=CreateInstance
&Parameter.1.Code=PackageEdition
&Parameter.1.Value=standard
&Parameter.2.Code=HealthcheckTaskCount
&Parameter.2.Value=0
&Parameter.3.Code=SmsNotificationCount
&Parameter.3.Value=0
&Period=1
&ProductCode=dns
&ProductType=dns_gtm_public_cn
&SubscriptionType=Subscription

API call demo

package AlidnsTest.DomainManager;

import com.alibaba.fastjson.JSON;
import com.aliyuncs.bssopenapi.model.v20171214.CreateInstanceRequest;
import com.aliyuncs.bssopenapi.model.v20171214.CreateInstanceResponse;
import com.aliyuncs.exceptions.ClientException;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
import utils.AlidnsTestBase;

public class InstanceCreate extends AlidnsTestBase {

    @Test
    public void createInstanceTest() {
        CreateInstanceRequest request = new CreateInstanceRequest();
        request.setProductCode("dns");
        request.setProductType("dns_gtm_public_cn");
        request.setSubscriptionType("Subscription");
        request.setPeriod(1);
        CreateInstanceRequest.Parameter parameters1 = new CreateInstanceRequest.Parameter();
        parameters1.setCode("PackageEdition");
        parameters1.setValue("standard");

        CreateInstanceRequest.Parameter parameters2 = new CreateInstanceRequest.Parameter();
        parameters2.setCode("HealthcheckTaskCount");
        parameters2.setValue("0");

        CreateInstanceRequest.Parameter parameters3 = new CreateInstanceRequest.Parameter();
        parameters3.setCode("SmsNotificationCount");
        parameters3.setValue("0");

        request.setParameters(Lists.newArrayList(parameters1,parameters2,parameters3));
        try {
            CreateInstanceResponse response = client.getAcsResponse(request);
            System.out.println(JSON.toJSON(response));
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }
}