This topic provides answers to frequently asked questions about Elastic Compute Service (ECS) API operations.

What is an ECS API operation?

ECS API operations are open source remote procedure call (RPC) API operations that provide API services for Alibaba Cloud users. You can use ECS API operations to manage and use ECS instances. The following figure shows the path along which a request is forwarded to call an API operation. For more information about how to call an ECS API operation, see Quick start. What is an ECS API operation?

What do I do if the InvalidDataDiskCategory.NotSupported error code is returned when I create an ECS instance?

  • Problem description: When you call the RunInstances operation to create an ECS instance, the following error is returned:
    {
        "Code": "InvalidDataDiskCategory.NotSupported",
        "Message": "Specified disk category is not supported."
    }
  • Cause: The error occurred because disks of the specified category cannot be created in the specified zone.
  • Solution: We recommend that you call the DescribeAvailableResource operation to query the resources available in the zone where you want to create the ECS instance and make sure that resources in the zone are sufficient. You can also change the value of ZoneId and try again.
    aliyun ecs RunInstances --ImageId win2008_64_ent_r2_cn_40G_alibase_20150429.vhd --InstanceType ecs.g5.large --SecurityGroupId <TheSecuriytyGroupId> --SystemDiskCategory cloud_efficiency --ZoneId cn-hangzhou-c

How do I set sequential instance names or hostnames when I create multiple ECS instances?

We recommend that you call the RunInstances operation to create multiple ECS instances. RunInstances contains the InstanceName and HostName parameters. You can set the instance name and the hostname that comply with the naming conventions.

Use the following methods to set sequential instance names or hostnames for multiple ECS instances:

  • Add the sequential suffix specified by the UniqueSuffix parameter to the instance name specified by the InstanceName parameter or the hostname specified by the HostName parameter. A sequential suffix can be in the range from 001 to 999.A Examples: LocalHost001 and LocalHost002, and MyInstance001 and MyInstance002.
  • Specify the instance names or hostnames for multiple ECS instances in the name_prefix[begin_number,digits]name_suffix format. For example, if you set the InstanceName parameter to k8s-node-[1,4]-alibabacloud, the name of the first ECS instance is k8s-node-0001-alibabacloud. A maximum of 999,999 ECS instances can share the same prefix and suffix.
    • name_prefix: the prefix of the instance name or hostname. A prefix is required when you specify sequential names. Otherwise, the names are regarded as common names.
    • [begin_number,digits]: the starting value of the number in the instance name or hostname. Numbers in instance names or hostnames are incremental. These numbers identify different ECS instance names or hostnames of different instances. The [begin_number,digits] segment cannot contain spaces.
      • begin_number: the number from which the instance name starts. Valid values: 0 to 999999. Default value: 0.
      • digits: the number of digits in the instance name. Valid values: 1 to 6. Default value: 6.
      • If you specify [] or [,], begin_number starts from 0 and digits is set to 6.
      • If you specify [99] or [99,], begin_number starts from 99 and digits is set to 6.
      • If the number of the digits specified by begin_number is greater than the value of digits, the digit of begin_number takes precedence. For example, digits is set to 1 in [1234,1], and the value of begin_number is set to 1234. digits is set to 6.
      • If the sum of the begin_number value and the number of ECS instances exceeds the maximum value of 999999, all ECS instances whose names that contain numbers greater than the maximum value use 999999.
    • name_suffix: the suffix of an instance name or hostname.
Note If you do not add suffixes to the instance names or hostnames by specifying name_suffix, but use the name_prefix[begin_number,digits] format, the UniqueSuffix parameter is invalid. For example, when InstanceName is set to instance-[99,3], and UniqueSuffix is set to true, the instance name is instance099 instead of instance099001.

How can I create an ECS instance that is assigned a public IP address?

  • Method 1: Call the RunInstances operation and set InternetMaxBandwidthOut to a value greater than 0 to create an ECS instance. The ECS instance is automatically assigned a public IP address.
  • Method 2: Call the CreateInstance operation to create an ECS instance. Then, call the AllocatePublicIpAddress operation to assign a public IP address to the instance.

What do I do if the public IP address of an ECS instance cannot be pinged after I create the instance by calling an ECS API operation?

  • Problem description: The ECS instance that you created by calling an ECS API operation cannot connect to the Internet, and the public IP address of the instance cannot be pinged.
  • Cause: The security group to which the instance belongs does not have a rule to allow Internet access.
  • Solution: Call the AuthorizeSecurityGroup operation to add an inbound rule to the security group to allow Internet access. For example, you can send the following request where IpProtocol is set to ICMP to call the AuthorizeSecurityGroup operation and add an inbound rule that allows the public IP address of this instance to be pinged from all IP addresses:
    https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroup
    &SecurityGroupId=sg-bp15ed6xe1yxeycg7***
    &SourceCidrIp=0.0.0.0/0
    &IpProtocol=ICMP
    &PortRange=-1/-1
    &<Common request parameters>

What do I do if the "The specified IP is already in use." error message is returned when I call an ECS API operation to assign a public IP address to an ECS instance?

  • Problem description: When you call the AllocatePublicIpAddress operation to assign a public IP address specified by IpAddress to an ECS instance, the following error is returned:
    {
        "Code": "IpInUse",
        "Message": "The specified IP is already in use."
    }
  • Cause: The specified IP address is already in use.
  • Solution: Check whether the IP address is already in use. If yes, try another IP address.

When I modify the public bandwidth configurations of an instance by calling an ECS API operation, Can I specify an effective period for the new bandwidth configurations ?

You can call the ModifyInstanceNetworkSpec operation to modify the public bandwidth configurations of an ECS instance. The new bandwidth configurations take effect on the instance immediately after the modification. If you want to temporarily modify the bandwidth configurations of your instance, set StartTime and EndTime to specify an effective period.

If you are using an elastic IP address (EIP), you can call the ModifyEipAddressAttribute operation to make the modification but you cannot specify an effective period.

What do I do if only specific security group rules are displayed when I call an API operation or use ECS SDKs to query the rules of a security group?

Security group rules can be distinguished by the network interface controller (NIC) type of the security group. Public NIC (internet), and private NIC (intranet) are supported. When you call the DescribeSecurityGroupAttribute operation to query the rules of a security group, the NIC parameter is not required. However, if this parameter is not specified, the default value of internet is used. Therefore, when you run the following CLI command to call the DescribeSecurityGroupAttribute operation, only the public security group rules but not all security group rules in the queried security group are displayed:
aliyun ecs DescribeSecurityGroupAttribute --SecurityGroupId <TheSecurityGroupId> --RegionId <TheRegionId>
If you want to query the internal security group rules in a security group, such as internal security group rules that allow access across internal networks or are configured for the VPN firewall of Finance Cloud, run the following command where NicType is set to intranet:
aliyun ecs DescribeSecurityGroupAttribute --SecurityGroupId <TheSecurityGroupId> --RegionId <TheRegionId> --NicType intranet

Why are only 10 entries returned for a request made by using an ECS API operation, an ECS SDK, or an Alibaba Cloud CLI command?

For more information about this issue, see Why only ten entries are returned for query request by using APIs or SDK.