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

Debugging

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

ParameterTypeRequiredExampleDescription
ActionStringYesCreateClusterTemplate

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

ClusterTypeStringYesHADOOP

The type of the cluster. Valid values:

  • HADOOP
  • KAFKA
  • DATA SCIENCE
  • DRUID
  • FLINK
  • GATEWAY
  • CLICKHOUSE
  • SHUFFLE_SERVICE
  • EMR_STUDIO
TemplateNameStringYesETLClusterTemplate

The name of the template.

ZoneIdStringYescn-hangzhou-b

The zone ID of the cluster. You can call the DescribeZones operation to query the most recent zone list.

BootstrapAction.N.NameStringYesinit_script

The name of the bootstrap action.

BootstrapAction.N.PathStringYesoss://bucket/path

The OSS path in which you want to store the bootstrap action script.

Config.N.ConfigKeyStringYesfs.trash.interval

The key of custom configuration item N.

Config.N.ConfigValueStringYes60

The value of custom configuration item N.

Config.N.FileNameStringYesyarn-site

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

Config.N.ServiceNameStringYesYARN

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

HostGroup.N.DiskCapacityIntegerYes80

The data disk capacity of host group N.

HostGroup.N.DiskCountIntegerYes1

The number of data disks in host group N.

HostGroup.N.DiskTypeStringYesCLOUD_EFFICIENCY

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

  • CLOUD_EFFICIENCY: Ultra Disk
  • CLOUD_SSD:SSD
  • LOCAL_DISK: You can set this parameter only for ECS instance types with local disks.
  • CLOUD: basic disk (not recommended)
HostGroup.N.HostGroupNameStringYesmaster_group

The name of the machine group.

HostGroup.N.HostGroupTypeStringYesMASTER

The type of the machine group. Valid values:

  • MASTER: master instance group
  • CORE: core instance group
  • TASK: Compute Instance Group
Note Both MASTER and CORE support setting up only one group.
HostGroup.N.InstanceTypeStringYesecs.g5.xlarge

The ECS instance type in the machine group. For more information, see Overview of instance families or call the DescribeInstanceTypes operation to query the most recent instance type list.

HostGroup.N.NodeCountIntegerYes2

The number of nodes in host group N.

HostGroup.N.SysDiskCapacityIntegerYes80

The system disk capacity of host group N.

HostGroup.N.SysDiskTypeStringYesCLOUD_SSD

The type of the system disk. Valid values:

  • CLOUD_EFFICIENCY: Ultra Disk
  • CLOUD_SSD:SSD
  • CLOUD: basic disk (not recommended)
EmrVerStringYesEMR-3.35.0

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

RegionIdStringYescn-hangzhou

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

KeyPairNameStringNotest_pair

Password-free logon to the ECS key pair.

MetaStoreTypeStringNouser_rds

The type of the Hive metadata service. Valid values:

  • local: the MySQL service in the cluster. A single MySQL node does not guarantee high availability.
  • user_rds: user-created RDS service
  • dlf:DLF Metadata Service
MetaStoreConfStringNo{"dbUrl":"jdbc:mysql://rm-xxxxxxxxxx.mysql.rds.aliyuncs.com/hmsdata?createDatabaseIfNotExist=true&characterEncoding=UTF-8","dbUserName":"xxxxxxx","dbPassword":"xxxxxx"}

The configuration information of the unified metadata service.

If MetaStoreType is set to local or dlf, this parameter is not specified. If you set the MetaStoreType parameter to user_rds, you can set the value to {"dbUrl":"jdbc:mysql://rm-xxxxxxxxxx.mysql.rds.aliyuncs.com/hmsdata?createDatabaseIfNotExist=true&characterEncoding=UTF-8","dbUserName":"xxxxxxx","dbPassword":"xxxxxx"}.

HostGroup.N.PrivatePoolOptionsMatchCriteriaStringNoTarget

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

  • Open: open private pool. The system selects a matching open private pool to create the instance. If no matching private pools are found, resources in the public pool are used. In this mode, you do not need to set the HostGroup.N.PrivatePoolOptionsId parameter.
  • Target: specified private pool. The system uses the capacity in a specified private pool to create the instance. 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 startup will not use private pool capacity
HostGroup.N.PrivatePoolOptionsIdStringNocrp-bp1e4wcvoucrish****

The ID of the private pool to use to create the instance. 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.ExecutionTargetStringNocore_group

The scope of the script. Valid values:

  • For the entire cluster, specify a null value.
  • Set the name of the machine group.
BootstrapAction.N.ExecutionMomentStringNoBEFORE_INSTALL

The timing of the script. Valid values:

  • BEFORE_INSTALL: Before the service is installed
  • AFTER_STARTED: The service is executed after the service is started.
BootstrapAction.N.ExecutionFailStrategyStringNoFAILED_BLOCKED

The execution policy for script failures. Valid values:

  • FAILED_BLOCKED: The workflow is manually processed after a failure.
  • FAILED_CONTINUE: Continue after failure
Tag.N.KeyStringNoDept

The key of the EMR cluster tag. You can specify 1 to 20 tag keys. The tag value cannot be an empty string. The value of a tag key ranges from 1 to 128. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

Tag.N.ValueStringNoDevIT

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

ResourceGroupIdStringNorg-bp67acfmxazb4p****

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

ClientTokenStringNo123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request. You can use the client to generate a client token. Make sure that a unique client token is used for each request.

DataDiskEncryptedBooleanNofalse

A reserved parameter.

DataDiskKMSKeyIdStringNofalse

A reserved parameter.

ConfigurationsStringNo[{"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.

EasEnableBooleanNotrue

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

  • true: high-security clusters.
  • false: The cluster is not a high-security cluster.
HighAvailabilityEnableBooleanNotrue

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

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

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

InitCustomHiveMetaDbBooleanNofalse

A reserved parameter.

InstanceGenerationStringNoecs-3

The generation of ECS instances.

IoOptimizedBooleanNotrue

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

  • true: optimized
  • false: no optimization
IsOpenPublicIpBooleanNotrue

Specifies whether to enable public IP addresses. Valid values:

  • true: allows public IP addresses.
  • false: disables public IP addresses.
LogPathStringNooss://bucket/path

The OSS log path. This parameter is obsolete.

MachineTypeStringNoECS

The type of the IaaS-layer resource that is used to build the cluster. Set the value to ECS.

MasterPwdStringNopwd

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).

NetTypeStringNoVPC

Indicates the network type of the ApsaraDB RDS for MySQL instance. Set the value to VPC.

OptionSoftWareList.NRepeatListNo["HBASE","FLINK"]

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

PeriodIntegerNo36

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

SecurityGroupIdStringNosg-bp1id7ajv83kmqwq****

The ID of the security group.

SecurityGroupNameStringNosg-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: open all ports in the outbound direction.

Parameter SecurityGroupId and SecurityGroupName requirement cannot both be empty.

SshEnableBooleanNotrue

Specifies whether to modify the security group rule to allow SSH logon from the Internet. Default value: false. This parameter is deprecated. Valid values:

  • true: SSH is enabled.
  • false: does not enable SSH.
UseCustomHiveMetaDbBooleanNofalse

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

UseLocalMetaDbBooleanNofalse

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

  • true: The local Hive metadatabase is used.
  • false: The local Hive metadatabase is disabled.

A single MySQL node is built in a cluster and cannot guarantee high reliability.

UserDefinedEmrEcsRoleStringNoAliyunEmrEcsDefaultRole

The ECS application role that allows internal access from ECS to other Alibaba Cloud services, such as Object Storage Service (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
VpcIdStringNovpc-bp1l4urd87xlh7i4b****

The ID of the virtual private cloud (VPC) to which the instances belong.

VSwitchIdStringNovsw-bp10tvjyc77psy0z5****

The ID of the vSwitch to which you want to connect the instance.

BootstrapAction.N.ArgStringNo--arg1

The argument that you pass into bootstrap action N.

Config.N.EncryptStringNo0

A reserved parameter.

Config.N.ReplaceStringNo0

A reserved parameter.

HostGroup.N.AutoRenewBooleanNofalse

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

  • true: enables auto-renewal
  • false: manual renewal
HostGroup.N.ChargeTypeStringNoPostPaid

The billing method of the instance. Valid values:

  • PostPaid: pay-as-you-go
  • PrePaid: subscription
HostGroup.N.ClusterIdStringNo0

A reserved parameter.

HostGroup.N.CommentStringNoheader

The comment for host group N.

HostGroup.N.CreateTypeStringNoON-DEMAND

The type of the machine group. Valid values:

  • ON-DEMAND: Create as needed
  • MANUAL: manually created
HostGroup.N.HostGroupIdStringNo0

A reserved parameter.

HostGroup.N.MultiInstanceTypesStringNo["ecs.c5.xlarge","ecs.sn1ne.xlarge","ecs.hfc5.xlarge"]

A JSON field that consists of the supported instance types.

HostGroup.N.PeriodIntegerNo30

The validity period of host group N.

HostGroup.N.VSwitchIdStringNovsw-bp10tvjyc77psy0z5****

The ID of the VSwitch.

AutoRenewBooleanNofalse

Specifies whether to automatically renew the subscription.

DepositTypeStringNoHALF_MANAGED

The hosting type of the cluster. Valid values:

  • HALF_MANAGED: semi-hosted
  • MANAGED: fully managed

Response parameters

ParameterTypeExampleDescription
ClusterTemplateIdStringCT-35498C56B3F1****

The ID of the cluster template.

RequestIdString8CA40D40-2092-4A09-9F07-2F9C1399FB11

The request ID.

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 success responses

XML format

<RequestId>8CA40D40-2092-4A09-9F07-2F9C1399FB11</RequestId>
<ClusterTemplateId>CT-35498C56B3F1****</ClusterTemplateId>

JSON format

{  
  "RequestId": "8CA40D40-2092-4A09-9F07-2F9C1399FB11",
  "ClusterTemplateId": "CT-35498C56B3F1****"
}