tencent cloud

Feedback

CreateCluster

Last updated: 2024-01-09 10:47:35

    1. API Description

    Domain name for API request: emr.tencentcloudapi.com.

    This API is used to create an EMR cluster instance.

    A maximum of 20 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: CreateCluster.
    Version Yes String Common Params. The value used for this API: 2019-01-03.
    Region No String Common Params. This parameter is not required for this API.
    ProductVersion Yes String The EMR version, such as EMR-V2.3.0 that indicates the version 2.3.0 of EMR. You can query the EMR version here.
    EnableSupportHAFlag Yes Boolean Whether to enable high availability for nodes. Valid values:
  • true: Enable
  • false: Disable
  • InstanceName Yes String The instance name.
  • Length limit: 6–36 characters.
  • Can contain only Chinese characters, letters, digits, hyphens (-), and underscores (_).
  • InstanceChargeType Yes String The instance billing mode. Valid values:
  • POSTPAID_BY_HOUR: The postpaid mode by hour.
  • LoginSettings Yes LoginSettings The instance login setting. This parameter allows you to set a login password or key for your purchased node.
  • If a key is set, the password will be used for login to the native component WebUI only.
  • If no key is set, the password will be used for login to all purchased nodes and the native component WebUI.
  • SceneSoftwareConfig Yes SceneSoftwareConfig The configuration of cluster application scenario and supported components.
    InstanceChargePrepaid No InstanceChargePrepaid The details of the monthly subscription, including the instance period and auto-renewal. It is required if InstanceChargeType is PREPAID.
    SecurityGroupIds.N No Array of String The ID of the security group to which the instance belongs, in the format of sg-xxxxxxxx. You can call the DescribeSecurityGroups API and obtain this parameter from the SecurityGroupId field in the response.
    ScriptBootstrapActionConfig.N No Array of ScriptBootstrapActionConfig The Bootstrap action script settings.
    ClientToken No String A unique random token, which is valid for 5 minutes and needs to be specified by the caller to prevent the client from repeatedly creating resources. An example value is a9a90aa6-751a-41b6-aad6-fae360632808.
    NeedMasterWan No String Whether to enable public IP access for master nodes. Valid values:
  • NEED_MASTER_WAN: Enable public IP for master nodes.
  • NOT_NEED_MASTER_WAN: Disable.
  • The public IP is enabled for master nodes by default.
    EnableRemoteLoginFlag No Boolean Whether to enable remote login over the public network. It is invalid if SecurityGroupId is passed in. It is disabled by default. Valid values:
  • true: Enable
  • false: Disable
  • EnableKerberosFlag No Boolean Whether to enable Kerberos authentication. Valid values:
  • true: Enable
  • false (default): Disable
  • CustomConf No String Custom software configuration
    Tags.N No Array of Tag The tag description list. This parameter is used to bind a tag to a resource instance.
    DisasterRecoverGroupIds.N No Array of String The list of spread placement group IDs. Only one can be specified.
    You can call the DescribeDisasterRecoverGroups API and obtain this parameter from the DisasterRecoverGroupId field in the response.
    EnableCbsEncryptFlag No Boolean Whether to enable the cluster-level CBS encryption. Valid values:
  • true: Enable
  • false (default): Disable
  • MetaDBInfo No CustomMetaDBInfo The metadatabase information. If MetaType is EMR_NEW_META, MetaDataJdbcUrl, MetaDataUser, MetaDataPass, and UnifyMetaInstanceId are not required.
    If MetaType is EMR_EXIT_META, UnifyMetaInstanceId is required.
    If MetaType is USER_CUSTOM_META, MetaDataJdbcUrl, MetaDataUser, and MetaDataPass are required.
    DependService.N No Array of DependService The shared component information.
    ZoneResourceConfiguration.N No Array of ZoneResourceConfiguration The node resource specs. A spec is specified for each AZ, with the first spec for the primary AZ, the second for the backup AZ, and the third for the arbitrator AZ. If the multi-AZ mode is not enabled, only one spec is required.

    3. Output Parameters

    Parameter Name Type Description
    InstanceId String The instance ID.
    Note: This field may return null, indicating that no valid values can be obtained.
    RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

    4. Example

    Example1 Creating an EMR cluster instance

    Input Example

    POST / HTTP/1.1
    Host: emr.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: CreateCluster
    <Common request parameters>
    
    {
        "DisasterRecoverGroupIds": [
            "xx"
        ],
        "DependService": [
            {
                "InstanceId": "xx",
                "ServiceName": "xx"
            }
        ],
        "ZoneResourceConfiguration": [
            {
                "VirtualPrivateCloud": {
                    "SubnetId": "xx",
                    "VpcId": "xx"
                },
                "AllNodeResourceSpec": {
                    "CoreResourceSpec": {
                        "DataDisk": [
                            {
                                "Count": 0,
                                "DiskSize": 0,
                                "DiskType": "xx"
                            }
                        ],
                        "SystemDisk": [
                            {
                                "Count": 0,
                                "DiskSize": 0,
                                "DiskType": "xx"
                            }
                        ],
                        "LocalDataDisk": [
                            {
                                "Count": 0,
                                "DiskSize": 0,
                                "DiskType": "xx"
                            }
                        ],
                        "InstanceType": "xx",
                        "Tags": [
                            {
                                "TagKey": "xx",
                                "TagValue": "xx"
                            }
                        ]
                    },
                    "CoreCount": 0,
                    "MasterResourceSpec": {
                        "InstanceType": "xx",
                        "Tags": [
                            {
                                "TagKey": "xx",
                                "TagValue": "xx"
                            }
                        ]
                    },
                    "TaskCount": 0,
                    "TaskResourceSpec": {
                        "InstanceType": "xx"
                    },
                    "CommonCount": 0,
                    "MasterCount": 0
                },
                "Placement": {
                    "ProjectId": 0,
                    "Zone": "xx"
                },
                "ZoneTag": "xx"
            }
        ],
        "ScriptBootstrapActionConfig": [
            {
                "CosFileName": "xx",
                "Args": [
                    "xx"
                ],
                "CosFileURI": "xx",
                "ExecutionMoment": "xx"
            }
        ],
        "Tags": [
            {
                "TagKey": "xx",
                "TagValue": "xx"
            }
        ],
        "NeedMasterWan": "xx",
        "EnableCbsEncryptFlag": true,
        "MetaDBInfo": {
            "MetaDataPass": "xx",
            "MetaDataUser": "xx",
            "UnifyMetaInstanceId": "xx",
            "MetaDataJdbcUrl": "xx",
            "MetaType": "xx"
        },
        "LoginSettings": {
            "Password": "xx",
            "PublicKeyId": "xx"
        },
        "SecurityGroupIds": [
            "xx"
        ],
        "InstanceChargeType": "xx",
        "ProductVersion": "xx",
        "ClientToken": "xx",
        "SceneSoftwareConfig": {
            "SceneName": "xx",
            "Software": [
                "xx"
            ]
        },
        "EnableKerberosFlag": true,
        "CustomConf": "xx",
        "InstanceChargePrepaid": {
            "RenewFlag": true,
            "Period": 0
        },
        "InstanceName": "xx",
        "EnableRemoteLoginFlag": true,
        "EnableSupportHAFlag": true
    }
    

    Output Example

    {
        "Response": {
            "InstanceId": "xx",
            "RequestId": "xx"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    FailedOperation Operation failed.
    FailedOperation.GetCvmServerFailed Failed to call the CVM service.
    InternalError.CdbError An error occurred while calling another service API.
    InternalError.CvmError An error occurred while calling another service API.
    InternalError.TradeCgwError An error occurred while calling another service API.
    InvalidParameter.HALessMasterCount Parameter error.
    InvalidParameter.IncorrectMasterCount The number of master nodes is invalid.
    InvalidParameter.InvalidAllNodeResourceSpec Invalid AllNodeResourceSpec.
    InvalidParameter.InvalidComponent Invalid component.
    InvalidParameter.InvalidCoreCount The number of core nodes is invalid.
    InvalidParameter.InvalidCoreDiskType Parameter error.
    InvalidParameter.InvalidDependServiceAndEnableKerberosConflict Conflict betweenDependService and EnableKerberos.
    InvalidParameter.InvalidDiskNum Invalid number of disks.
    InvalidParameter.InvalidInstanceChargeType Invalid instance billing mode.
    InvalidParameter.InvalidInstanceType Invalid model.
    InvalidParameter.InvalidMasterDiskType Invalid parameter.
    InvalidParameter.InvalidMetaType Invalid metadata table type.
    InvalidParameter.InvalidPassword Invalid password.
    InvalidParameter.InvalidProductVersion Invalid product version.
    InvalidParameter.InvalidRenewFlag Invalid auto-renewal identifier.
    InvalidParameter.InvalidResourceSpec Invalid resource specification.
    InvalidParameter.InvalidScriptBootstrapActionConfig Invalid bootstrap script execution parameter.
    InvalidParameter.InvalidSoftInfo Invalid SoftInfo.
    InvalidParameter.InvalidZone Invalid AZ.
    InvalidParameter.KerberosSupport Invalid identifier for Kerberos support.
    ResourceInsufficient.InstanceInsufficient The node specification is unsupported or has been sold out.
    ResourceNotFound.SubnetNotFound No corresponding subnet found.
    ResourcesSoldOut.CvmSoldOut CVM instances have been sold out.
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support