You can call CreateClusterTemplate operation to create a E-MapReduce cluster template, which can be used for data development to initialize new clusters.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. You can use OpenAPI Explorer to search for API operations, call API operations, and dynamically generate SDK sample code.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateClusterTemplate

The operation that you want to perform. This parameter is required for API requests that you create by piecing together HTTP or HTTPS URLs. Set the value to CreateClusterTemplate.

ClusterType String Yes HADOOP

The type of ACK cluster. Valid values:

TemplateName String Yes templateName2

The name of the template.

ZoneId String Yes cn-hangzhou-b

The region ID.

BootstrapAction.N.Name String Yes action_name

The name of bootstrap action N.

BootstrapAction.N.Path String Yes oss://bucket/path

The path where the script of bootstrap action N is stored.

Config.N.ConfigKey String Yes fs.trash.interval

The key of custom configuration item N.

Config.N.ConfigValue String Yes 60

The value of custom configuration item N.

Config.N.FileName String Yes yarn-site

The name of the file that contains custom configuration item N.

Config.N.ServiceName String Yes YARN

The name of the service for which custom configuration item N is configured. Specify the entire name in uppercase.

HostGroup.N.DiskCapacity Integer Yes 80

The data disk capacity of host group N.

HostGroup.N.DiskCount Integer Yes 1

The number of data disks in host group N.

HostGroup.N.DiskType String Yes CLOUD_EFFICIENCY

System disk type:

  • CLOUD: basic CLOUD disk
  • CLOUD_EFFICIENCY: Ultra disk
  • CLOUD_SSD: Cloud SSD
HostGroup.N.HostGroupName String Yes master_group

The name of the host group you want to query.

HostGroup.N.HostGroupType String Yes MASTER

The type of the machine group to be queried:

  • MASTER: MASTER instance Group
  • CORE: CORE instance Group
  • TASK: compute instance Group
HostGroup.N.InstanceType String Yes ecs.g5.xlarge

Machine Group instances.

HostGroup.N.NodeCount Integer Yes 2

The number of nodes in host group N.

HostGroup.N.SysDiskCapacity Integer Yes 80

The system disk capacity of host group N.

HostGroup.N.SysDiskType String Yes CLOUD_SSD

The category of the system disk. Valid values:

  • CLOUD: basic CLOUD disk
  • CLOUD_EFFICIENCY: Ultra disk
  • CLOUD_SSD: Cloud SSD
EmrVer String Yes EMR-3.15.0

The version of the cluster.

RegionId String Yes cn-hangzhou

The region ID of the instance.

KeyPairName String No test_pair

The key pair.

MetaStoreType String No LOCAL

Metadata type:

  • LOCAL: internal metadata of the cluster
  • UNIFIED: UNIFIED metadata
  • USER_RDS: User-created RDS
MetaStoreConf String No N/A

A JSON field that contains dbUrl, dbUserName, and dbPassword to represent the connection string, username, and password of the RDS. Take the library name with dbUrl.

BootstrapAction.N.ExecutionTarget String No core_group

The scope of script execution. Values are as follows:

  • For the entire cluster, you can pass in a null value.
  • The name of the machine group.
BootstrapAction.N.ExecutionMoment String No BEFORE_INSTALL

The script execution time. Values are as follows:

  • BEFORE_INSTALL: run before the service is installed.
  • AFTER_STARTED: The task is executed after the service is started.
BootstrapAction.N.ExecutionFailStrategy String No FAILED_BLOCKED

The execution policy for failed scripts. The values are as follows:

  • FAILED_BLOCKED: the workflow is turned to manual for processing after a failure occurs.
  • FAILED_CONTINUE: continue after failure
Tag.N.Key String No DevDept

The tag key used for exact search of EMR clusters. Valid values of a tag key: 1 to 128. Valid values of N: 1 to 20. Tag.N is used for exact match of EMR clusters that are bound with specified tags. It consists of one key-value pair.

  • If you specify only Tag.N.Key, all clusters that are associated with this tag key are returned.
  • If you specify only Tag.N.Value, the MissingParameter.TagKey error code is returned.
  • When you specify multiple tag key-value pairs at the same time, only EMR clusters that match all tag key-value pairs can be found.
Tag.N.Value String No DevNianmin

The tag value used for exact search of EMR clusters. Valid values of the tag value: 1 to 128. Valid values of N: 1 to 20.

ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which the snapshot belongs.

Configurations String No [{"classification": "core-site","properties": {"fs.trash.interval": "61"}},{"classification": "hadoop-log4j","properties": {"hadoop.log.file": "hadoop1.log","hadoop.root.logger": "INFO","a.b.c": "ABC"}}]

The custom configuration items for software. You can use a JSON file to modify the software configurations before you start a cluster.

EasEnable Boolean No true

Whether to enable high security:

  • true: high availability is enabled.
  • false: high availability is not enabled.
HighAvailabilityEnable Boolean No true

Indicates whether high availability is enabled. Valid values:

  • true: high availability is enabled.
  • false: high availability is not enabled.
InitCustomHiveMetaDb Boolean No false

A reserved parameter.

InstanceGeneration String No ecs-3

The generation of ECS instances.

IoOptimized Boolean No true

Whether I/O optimization:

  • true: Optimized
  • false: Do not optimize
IsOpenPublicIp Boolean No true

Whether to open public network IP:

  • true: an open public IP address
  • false: no public IP addresses are opened.
LogPath String No oss://bucket/path

The path of logs that are stored in OSS buckets.

MachineType String No ECS

The type of instances. The default and only valid value is ECS.

MasterPwd String No pwd

The password for the master node.

NetType String No vpc

The type of the network.

OptionSoftWareList.N RepeatList No ["HBASE","FLINK"]

The list of optional services.

Period Integer No 36

The validity period of the subscription cluster.

SecurityGroupId String No sg-bp1id7ajv83kmqwq****

The ID of the security group.

SecurityGroupName String No sg-name

The name of the security group.

SshEnable Boolean No true

Indicates whether to enable the SSH service for the machines in the cluster. Valid values:

  • true: The SSH service is enabled.
  • false: The SSH service is disabled.
UseCustomHiveMetaDb Boolean No false

Indicates whether unified Hive metadata is used. Valid values:

  • true: Unified Hive metadata is used.
  • false: Unified Hive metadata is not used.
UseLocalMetaDb Boolean No false

Indicates whether to use the local Hive Metadatabase. Valid values:

  • true
  • false
UserDefinedEmrEcsRole String No AliyunEmrEcsDefaultRole

The RAM role that is assigned to EMR to access ECS resources.

VpcId String No vpc-bp1l4urd87xlh7i4b****

The ID of the VPC.

VSwitchId String No vsw-bp10tvjyc77psy0z5****

The ID of the vSwitch.

BootstrapAction.N.Arg String No --a

The argument that you pass into bootstrap action N.

Config.N.Encrypt String No 0

A reserved parameter. You do not need to specify this parameter.

Config.N.Replace String No 0

A reserved parameter. You do not need to specify this parameter.

HostGroup.N.AutoRenew Boolean No false

Automatic Scale-out:

  • true: Automatic Scale-out
  • false: does not perform automatic scale-out.
HostGroup.N.ChargeType String No PostPaid

The billing method of the instance. Default value: Postpaid. Valid values:

  • PostPaid: pay-as-you-go clusters
  • PrePaid: subscription cluster
HostGroup.N.ClusterId String No 0

A reserved parameter. You do not need to specify this parameter.

HostGroup.N.Comment String No header

The comment for host group N.

HostGroup.N.CreateType String No ON-DEMAND

Machine Group creation type:

  • ON-DEMAND: Create ON DEMAND
  • MANUAL: manually created
HostGroup.N.HostGroupId String No 0

A reserved parameter. You do not need to specify this parameter.

HostGroup.N.MultiInstanceTypes String No ["ecs.c5.xlarge","ecs.sn1ne.xlarge","ecs.hfc5.xlarge"]

A JSON field that consists of the supported instance types.

HostGroup.N.Period Integer No 30

The validity period of host group N.

HostGroup.N.VSwitchId String No vsw-bp10tvjyc77psy0z5****

The ID of the VSwitch.

AutoRenew Boolean No false

Specifies whether to automatically renew the subscription.

DepositType String No HALF_MANAGED

The hosting type of the cluster. Valid values:

  • HALF_MANAGED: Semi-managed
  • MANAGED: fully MANAGED

Response parameters

Parameter Type Example Description
ClusterTemplateId String CT-35498C56B3F12002

The ID of the cluster template.

RequestId String 8CA40D40-2092-4A09-9F07-2F9C1399FB11

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateClusterTemplate
&ClusterType=HADOOP
&TemplateName=templateName2
&BootstrapAction.1.1ame=action_name
&BootstrapAction.1.Path=oss://bucket/path
&Config.1.ConfigKey=fs.trash.interval
&Config.1.ConfigValue=60
&Config.1.FileName=yarn-site
&Config.1.ServiceName=YARN
&HostGroup.1.HostGroupType=MASTER
&HostGroup.1.InstanceType=ecs.g5.xlarge
&HostGroup.1.1odeCount=2
&EmrVer=EMR-3.15.0
&RegionId=cn-hangzhou
&<common request parameters>

Sample responses

XML format

<CreateClusterTemplateResponse>
      <code>200</code>
      <data>
            <RequestId>8CA40D40-2092-4A09-9F07-2F9C1399FB11</RequestId>
            <ClusterTemplateId>CT-35498C56B3F1****</ClusterTemplateId>
      </data>
      <requestId>8CA40D40-2092-4A09-9F07-2F9C1399FB11</requestId>
      <successResponse>true</successResponse>
</CreateClusterTemplateResponse>

JSON Syntax

{
    "code": "200",
    "data": {
        "RequestId": "8CA40D40-2092-4A09-9F07-2F9C1399FB11",
        "ClusterTemplateId": "CT-35498C56B3F1****"
    },
    "requestId": "8CA40D40-2092-4A09-9F07-2F9C1399FB11",
    "successResponse": true
}