All Products
Search
Document Center

Elastic Compute Service:API FAQ

Last Updated:Mar 29, 2024

This topic provides answers to some 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 forwarding path of a request when an API operation is called. For information about how to call an ECS API operation, see Quick start.什么是ECS API

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 occurs 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 the resources in the zone are sufficient. You can also call the RunInstances operation again with ZoneId set to a different value to create an ECS instance.

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 configure sequential instance names or hostnames when I create multiple ECS instances?

To create multiple ECS instances whose instance names or hostnames are sequentially configured, we recommend that you call the RunInstances operation. This operation contains the InstanceName and HostName parameters. You can specify values that comply with the naming conventions for the two parameters. For more information, see Batch configure sequential names or hostnames for multiple instances.

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

Method 1: Call the RunInstances operation with InternetMaxBandwidthOut set 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 that allows 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 with IpProtocol 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 the 10.0.0.0/8 CIDR block:

Important

For security purposes, we recommend that you configure security group rules based on your business requirements and the principle of least privilege. Exercise caution when you specify 0.0.0.0/0 or ::/0 in a request to allow access from all IPv4 or IPv6 addresses.

https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroup
&SecurityGroupId=sg-bp15ed6xe1yxeycg7***
&SourceCidrIp=10.0.0.0/8
&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 the IP address is available, reassign the IP address to the instance. If the IP address is already in use, assign a different IP address to the instance. You can also leave IpAddress empty to allow the system to assign a random IP address to the instance.

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.

Note

If you associated an elastic IP address (EIP) with the instance, you can call the ModifyEipAddressAttribute operation to modify the public bandwidth configurations 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 an ECS SDK 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 NicType parameter is optional. If you do not specify this parameter, the default value internet is used. Therefore, when you run the following command to call the DescribeSecurityGroupAttribute operation in Alibaba Cloud CLI, only the public 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 and set NicType 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, see Why are only 10 entries returned after an API operation is called by using an ECS SDK in Alibaba Cloud CLI?