Call the CreateClusterTemplate operation to create a E-MapReduce cluster template.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateClusterTemplate

The operation that you want to perform. Set the value to CreateClusterTemplate.

ClusterType String Yes HADOOP

The type of the cluster. Valid values:

TemplateName String Yes ETLClusterTemplate

The name of the template.

ZoneId String Yes cn-hangzhou-b

The ID of the zone. You can call the DescribeZones to view zones in an Alibaba Cloud region.

BootstrapAction.N.Name String Yes init_script

The name of the bootstrap action.

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

The OSS storage path of the boot action script.

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

The data disk type of the machine group. Valid values:

  • CLOUD_EFFICIENCY: ultra disks
  • LOCAL_DISK: This value can only be specified for the local disk ECS instance type.
  • CLOUD: basic cloud disks (not recommended)
HostGroup.N.HostGroupName String Yes master_group

The name of the machine group.

HostGroup.N.HostGroupType String Yes MASTER

The type of the machine group. Valid values:

  • MASTER: primary instance group
  • CORE: core instance group
  • TASK: compute instance group
Note Only one group can be set for MASTER and CORE.
HostGroup.N.InstanceType String Yes ecs.g5.xlarge

The type of the ECS instance in the machine group.

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 type of the system disk. Valid values:

  • CLOUD_EFFICIENCY: ultra disks
  • CLOUD: basic cloud disks (not recommended)
EmrVer String Yes EMR-3.35.0

The EMR version. Tip: You can view the list of EMR versions when you create a cluster in the console.

RegionId String Yes cn-hangzhou

The region ID of the VNode. You can call the DescribeRegions operation to query the most recent region list.

KeyPairName String No test_pair

Log on to the ECS key pair without password.

MetaStoreType String No user_rds

The type of the Hive metadata service. Valid values:

  • local: The internal MySQL service of the cluster. A single node of MySQL does not guarantee high availability.
  • user_rds: user-created RDS service
  • dlf:DLF metadata service
MetaStoreConf String No {"dbUrl":"jdbc:mysql://","dbUserName":"xxxxxxx","dbPassword":"xxxxxx"}

The configuration information of the unified metadata service.

If the MetaStoreType parameter is set to local or dlf, this parameter is not specified. When MetaStoreType is set to user_rds, the value example: {"dbUrl":"jdbc:mysql://","dbUserName":"xxxxxxx","dbPassword":"xxxxxx"}

HostGroup.N.PrivatePoolOptionsMatchCriteria String No Target

The type of the private pool. A private pool is generated after an elasticity assurance or a capacity reservation takes effect. You can select the private pool when you start an instance. Valid values:

  • Open: open private pool. The system selects a matching private pool to create the instance. If no matching open private pools are found, resources in the public pool are used. There is no need to set the HostGroup.N.PrivatePoolOptionsId parameter in this mode.
  • Target: specified private pool. The capacity in a specified private pool is used. If the specified private pool is unavailable, the instance cannot be created. In this mode, you must specify the private pool ID, that is, the HostGroup.N.PrivatePoolOptionsId parameter is required
  • None: no private pool. Instance launch will not use private pool capacity
HostGroup.N.PrivatePoolOptionsId String No crp-bp1e4wcvoucrish****

The ID of the private pool. The ID of a private pool is the same as that of the elasticity assurance or capacity reservation for which the private pool is generated.

BootstrapAction.N.ExecutionTarget String No core_group

The execution scope of the script. Valid values:

  • For the entire cluster, specify a null value.
  • Set the name of the machine group.
BootstrapAction.N.ExecutionMoment String No BEFORE_INSTALL

The execution timing of the script. Valid values:

  • BEFORE_INSTALL: Execution before service installation
  • AFTER_STARTED: Executed after the service is started.
BootstrapAction.N.ExecutionFailStrategy String No FAILED_BLOCKED

The script failure execution policy. Valid values:

  • FAILED_BLOCKED: The workflow is manually processed after a failure.
  • FAILED_CONTINUE: Continue execution after failure
Tag.N.Key String No Dept

The tag key of the EMR cluster. Valid values of N: 1 to 20. The tag key cannot be an empty string. The value of the tag key ranges from 1 to 128. It cannot start with acs: or aliyun. It cannot contain http:// or https://.

Tag.N.Value String No DevIT

The tag value of the EMR cluster. Valid values of N: 1 to 20. The tag value can be an empty string. Valid values: 1 to 128. It cannot start with acs: and cannot contain http:// or https://.

ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group.

ClientToken String No 123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests.

DataDiskEncrypted Boolean No false

A reserved parameter.

DataDiskKMSKeyId String No false

A reserved parameter.

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

Specifies whether to enable high security for the cluster. Valid values:

  • true: high-security clusters.
  • false: The cluster is not a high-security cluster.
HighAvailabilityEnable Boolean No true

Specifies whether to enable a high-availability cluster. Valid values:

  • true: enables a high-availability cluster. If high availability is enabled, at least two master nodes are required.
  • false: disables the high-availability cluster.

The high-availability cluster has at least two MASTER nodes. If the high-availability cluster is not enabled, the high reliability of the cluster cannot be guaranteed.

InitCustomHiveMetaDb Boolean No false

A reserved parameter.

InstanceGeneration String No ecs-3

The generation of ECS instances.

IoOptimized Boolean No true

Specifies whether to enable I/O optimization. Default value: true. This parameter is obsolete. Valid values:

  • true: optimized
  • false: not optimized
IsOpenPublicIp Boolean No true

Specifies whether to enable public IP addresses:

  • true: The public IP address is available.
  • false: disables public IP addresses.
LogPath String No oss://bucket/path

The path of the OSS log. This parameter is obsolete.

MachineType String No ECS

The resource type of the IaaS layer that is built on the cluster. Set the value to ECS.

MasterPwd String No pwd

The root password of the master node. The password must be 8 to 30 characters in length and contain any three characters (uppercase letters, lowercase letters, digits, and special character).

NetType String No VPC

The network type. Set the value to VPC.

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

The list of optional services. The service name is in uppercase letters, such as ZOOKEEPER,LIVY. Optional services can be obtained from the EMR console to create a cluster Step 1-Software Configuration-Optional Services View.

Period Integer No 36

The expiration time of the subscription cluster. Unit: months.

SecurityGroupId String No sg-bp1id7ajv83kmqwq****

The ID of the security group.

SecurityGroupName String No sg-name

The name of the security group to be created. If you do not specify SecurityGroupId, a security group is created with the value of this parameter as its name. After the cluster is created, you can view the ID of the security group in cluster details. This security group will have the default security group policy: all ports are opened in the outbound direction.

Parameter SecurityGroupId and SecurityGroupName requirements cannot be empty at the same time.

SshEnable Boolean No true

Specifies whether to modify the security group rules to allow public SSH logon. Default value: false. This parameter is obsolete. Valid values:

  • true: enables SSH.
  • false: disables SSH.
UseCustomHiveMetaDb Boolean No false

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

UseLocalMetaDb Boolean No false

Specifies whether to use the cluster's built-in MySQL as the Hive metadatabase. Valid values:

  • true: uses the local Hive metadatabase.
  • false: The local Hive metadatabase is not available.

The cluster has a built-in MySQL single node and cannot guarantee high reliability.

UserDefinedEmrEcsRole String No AliyunEmrEcsDefaultRole

The role that is authorized to ECS for internal access to other Alibaba Cloud services such as OSS.

  • AliyunECSInstanceForEMRRole :3.x series>= EMR-3.33.0, 4.x series>=EMR-4.6.0, 5.x series>=EMR-5.1.0
  • AliyunEmrEcsDefaultRole:3.x series < EMR-3.33.0, 4.x series <EMR-4.6.0, 5.x series <EMR-5.1.0
VpcId String No vpc-bp1l4urd87xlh7i4b****

The ID of the virtual private cloud (VPC) in which the database instance is deployed.

VSwitchId String No vsw-bp10tvjyc77psy0z5****

The ID of the vSwitch.

BootstrapAction.N.Arg String No --arg1

The argument that you pass into bootstrap action N.

Config.N.Encrypt String No 0

A reserved parameter.

Config.N.Replace String No 0

A reserved parameter.

HostGroup.N.AutoRenew Boolean No false

machine group whether the machine is auto-renewal. Valid values:

  • true: enables auto-renewal.
  • false: manual renewal
HostGroup.N.ChargeType String No PostPaid

The billing method of the instance. Valid values:

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

A reserved parameter.

HostGroup.N.Comment String No header

The comment for host group N.

HostGroup.N.CreateType String No ON-DEMAND

The type of the machine group creation. Valid values:

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

A reserved 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 managed type of the cluster. Valid values:

  • HALF_MANAGED: semi-managed
  • MANAGED: fully managed

Response parameters

Parameter Type Example Description
ClusterTemplateId String CT-35498C56B3F1****

The ID of the cluster template.

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

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format


JSON format

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