You are on page 1of 85

Aliyun Elastic Compute Service

API

API 2013-01-10

ECS API

.............................................................................................................................. 1
1.1

............................................................................................................ 1

1.2

.......................................................................... 1

....................................................................................................................... 3
2.1

2.2

2.3

2.4
3

........................................................................................................ 3
2.1.1

................................................................................................. 3

2.1.2

................................................................................................. 3

2.1.3

................................................................................................. 3

2.1.4

................................................................................................. 3

2.1.5

................................................................................................. 3

........................................................................................................ 3
2.2.1

......................................................................................... 3

2.2.2

......................................................................................... 4

........................................................................................................ 5
2.3.1

................................................................................................. 5

2.3.2

................................................................................................. 5

........................................................................................................ 7

RAM ECS ....................................................................... 9


3.1

ECS .................................................................. 9

3.2

RAM ECS ..................................................................... 9

3.3

RAM ECS Action .................................................... 10

ECS API

3.4

ECS API ....................................................... 11

3.5

ECS ........................................................................ 12

..................................................................................................................... 14
4.1

4.2

4.3

............................................................................................... 14
4.1.1

............................................................................................... 14

4.1.2

............................................................................................... 18

4.1.3

............................................................................................... 18

4.1.4

............................................................................................... 20

4.1.5

....................................................................................... 21

4.1.6

......................................................... 22

4.1.7

....................................................................................... 24

4.1.8

............................................................................................... 26

4.1.9

................................................................................ 27

4.1.10

................................................................................ 27

............................................................................................... 28
4.2.1

............................................................................ 28

4.2.2

............................................................................................... 30

4.2.3

............................................................................................... 31

4.2.4

................................................................................ 32

............................................................................................... 33
4.3.1

............................................................................................... 33

4.3.2

............................................................................................... 35

4.3.3

.................................................................... 36

4.3.4

....................................................................................... 37

ECS API

4.4

4.5

............................................................................................... 38
4.4.1

....................................................................................... 38

4.4.2

................................................................................... 41

4.4.3

................................................................................... 42

............................................................................................... 43
4.5.1

4.6

4.7

........................................................................................... 44
4.6.1

........................................................................................... 44

4.6.2

................................................................................... 45

4.6.3

................................................................................... 47

4.6.4

................................................................................... 49

4.6.5

................................................................................... 51

4.6.6

........................................................................................... 52

............................................................................................... 53
4.7.1

4.8

................................................................................ 53

...................................................................................................... 55
4.8.1

IP .................................................................................. 43

........................................................................ 55

..................................................................................................................... 57
DiskItemType............................................................................................................... 57
.................................................................................................................... 57
................................................................................................................. 57
................................................................................................................. 57
DiskSetType ................................................................................................................. 57
.................................................................................................................... 57

ECS API

................................................................................................................. 57
................................................................................................................. 58
ImageType................................................................................................................... 58
.................................................................................................................... 58
................................................................................................................. 58
................................................................................................................. 58
InstanceMonitorDataType ........................................................................................... 59
.................................................................................................................... 59
................................................................................................................. 59
................................................................................................................. 59
InstanceStatusItemType .............................................................................................. 60
.................................................................................................................... 60
................................................................................................................. 60
................................................................................................................. 60
InstanceStatusSetType................................................................................................. 60
.................................................................................................................... 60
................................................................................................................. 60
................................................................................................................. 60
InstanceTypeItemType ................................................................................................ 61
.................................................................................................................... 61
................................................................................................................. 61
................................................................................................................. 61
IpAddressSetType ........................................................................................................ 61
.................................................................................................................... 61

ECS API

................................................................................................................. 61
................................................................................................................. 61
PermissionSetType ...................................................................................................... 61
.................................................................................................................... 61
................................................................................................................. 62
................................................................................................................. 62
PermissionType ........................................................................................................... 62
.................................................................................................................... 62
................................................................................................................. 62
................................................................................................................. 62
RegionType.................................................................................................................. 62
.................................................................................................................... 62
................................................................................................................. 63
................................................................................................................. 63
SnapshotType .............................................................................................................. 63
.................................................................................................................... 63
................................................................................................................. 63
................................................................................................................. 63
SecurityGroupIdSetType .............................................................................................. 63
.................................................................................................................... 63
................................................................................................................. 63
................................................................................................................. 64
SecurityGroupSetType ................................................................................................. 64
.................................................................................................................... 64

ECS API

................................................................................................................. 64
................................................................................................................. 64
SecurityGroupItemType............................................................................................... 64
.................................................................................................................... 64
................................................................................................................. 64
................................................................................................................. 64
IpRangeSetType........................................................................................................... 65
.................................................................................................................... 65
................................................................................................................. 65
................................................................................................................. 65
6

............................................................................................................................ 66
6.1

................................................................................... 66

6.2

.................................................................................................. 67
6.2.1

........................................................................................... 67

6.2.2

....................................................................................... 71

6.3

.................................................................................................. 72

6.4

.................................................................................................. 72

6.5

.................................................................................................. 72

6.6

............................................................................................... 73

6.7

6.6.1

............................................................................................... 73

6.6.2

............................................................................................... 74

........................................................................................... 77

............................................................................................................................ 77

ECS API

1
ECSElastic Compute Service
APIECS
ECS

1.1

Instance

ECS Instance

Region

Image

Image File

Disk

Snapshot

IP

IP

SecurityGroup

Security
Group

IP

A B
C CIDR IP

Classless
CIDR

Inter-Domain
Routing

IP

125.203.96.0-125.203.127.255 cidr

:
125.203.0110 0000.0000 0000
125.203.0111 1111.1111 1111
125.203.96.0/19

1.2
ECS

ECS API

ECS Open API


http://help.aliyun.com/view/11108189_13545434.html

ECS API

2
ECS API ECS API HTTP GET

2.1
2.1.1

ECS API ecs.aliyuncs.com

2.1.2

HTTP HTTPS
HTTPS

2.1.3

HTTP GET URL

2.1.4

Action StartInstance

2.1.5

UTF-8

2.2
2.2.1

Format

String

JSON XML XML

Version

String

API YYYY-MM-DD
2013-01-10

AccessKeyId

String

ID

ECS API

Signature

String

SignatureMethod

String

HMAC-SHA1

Timestamp

String

ISO8601
UTC
YYYY-MM-DDThh:mm:ssZ
2013-01-10T12:00:00Z 2013 1
10 20 0 0

SignatureVersion

String

1.0

SignatureNonce

String

ResourceOwnerAccount

String

API
< RAM ECS
> RAM ECS

https://ecs.aliyuncs.com/
?Format=xml
&Version=2013-01-10
&Signature=Pc5WB8gokVn0xfeu%2FZV%2BiNM1dgI%3D
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&AccessKeyId=key-test
&Timestamp=2012-06-01T12:00:00Z

2.2.2

RequestId

XML
<?xml version="1.0" encoding="UTF-8"?>
<!-->
<+Response>
<!-->
<RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>

ECS API
<!-->
</+Response>
JSON
{
"RequestId": "4C467B38-3910-447D-87BC-AC049166F216",
/* */
}

2.3
API HTTP 2xx
4xx 5xx HTTP XML JSON
XML

2.3.1

XML

XML
<?xml version="1.0" encoding="UTF-8"?>
<!-->
<+Response>
<!-->
<RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>
<!-->
</+Response>
JSON
{
"RequestId": "4C467B38-3910-447D-87BC-AC049166F216",
/* */
}

2.3.2

<>

ECS API

HTTP 4xx 5xx HTTP


IDRequestId
IDHostId
HostId RequestId
XML
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<RequestId>8906582E-6722-409A-A6C4-0E7863B733A5</RequestId>
<HostId>ecs.aliyuncs.com</HostId>
<Code>UnsupportedOperation</Code>
<Message>The specified action is not supported.</Message>
</Error>
JSON
{
"RequestId": "8906582E-6722-409A-A6C4-0E7863B733A5",
"HostId": "ecs.aliyuncs.com",
"Code": "UnsupportedOperation",
"Message": "The specified action is not supported."
}

ECS API

2.4
ECS HTTP HTTPS
SignatureECS Access Key ID Access
Key Secret Access Key ID Access Key
Secret

Access Key
ID Access Key Secret

1. Canonicalized Query String


a)

Signature
GET URI URI
?&

b)

UTF-8 URL
URL
i.

ii.

A-Za-z0-9 -_.~
%XY XY ASCII 16
%22

iii.

UTF-8 %XY%ZA

iv.

%20+

URL Java java.net.URLEncoder


application/x-www-form-urlencoded MIME
+%20
*%2A%7E ~

c)

d)

&

2.
StringToSign=
HTTPMethod + & +
percentEncode(/) + & +
percentEncode(CanonicalizedQueryString)

ECS API

HTTPMethod HTTP GET


percentEncode(/) 1.b URL /
%2F
percentEncode(CanonicalizedQueryString) 1
1.b URL
3. RFC2104 HMAC
Key Access Key Secret &
(ASCII:38) SHA1
4. Base64 HMAC Signature
5. Signature
ECS
RFC3986 URL
DescribeRegions URL
http://ecs.aliyuncs.com/?TimeStamp=2012-12-26T10:33:56Z&Format=XML&Acce
ssKeyId=testid&Action=DescribeRegions&SignatureMethod=HMAC-SHA1&RegionI
d=region1&SignatureNonce=NwDAxvLU6tFE0DVb&Version=2013-01-10&SignatureV
ersion=1.0

StringToSign
GET&%2F&AccessKeyId%3Dtestid%26Action%3DDescribeRegions%26Format%3DXML%
26RegionId%3Dregion1%26SignatureMethod%3DHMAC-SHA1%26SignatureNonce%3DN
wDAxvLU6tFE0DVb%26SignatureVersion%3D1.0%26TimeStamp%3D2012-12-26T10%25
3A33%253A56Z%26Version%3D2013-01-10

Access Key Id testidAccess Key Secret testsecret


HMAC Key testsecret&
SDFQNvyH5rtkc9T5Fwo8DOjw5hc=
URL Signature
http://ecs.aliyuncs.com/?TimeStamp=2012-12-26T10%3A33%3A56Z&Format=XML&
AccessKeyId=testid&Action=DescribeRegions&SignatureMethod=HMAC-SHA1&Reg
ionId=region1&SignatureNonce=NwDAxvLU6tFE0DVb&Version=2012-09-13&Signat
ureVersion=1.0&Signature=SDFQNvyH5rtkc9T5Fwo8DOjw5hc%3d

ECS API

3 RAM ECS
ECS
API
API
RAMResource Access Management ECS
RAM ECS
RAM API
ECS
ResourceOwnerAccount

3.1 ECS
ECS API RAM
RAM API

ECS API

ResourceOwnerAccount
https://ecs.aliyuncs.com/?Action=StartInstance
&InstanceId=Bc23xYm09
&ResourceOwnerAccount=use_X@aliyun.com
&AccessKeyId=user_Y_keyid
&<>

user_Y API user_X ECS StartInstance


id Bc23xYm09 request ResourceOwnerAccount

user_X@aliyun.com StartInstance API

3.2 RAM ECS


RAM
InstanceDiskSnapshotImageSecurityGroup
RAM

ECS API

Instance

acs:ecs:$regionid:instance/$instanceid
acs:ecs:$regionid:instance/*
acs:ecs:*:instance/*

Disk

acs:ecs:$regionid:disk/$diskid
acs:ecs:$regionid:disk/*
acs:ecs:*:disk/*

Snapshot

acs:ecs:$regionid:snapshot/$snapshotid
acs:ecs:$regionid:snapshot/*
acs:ecs:*:snapshot/*

Image

acs:ecs:$regionid:image/$imageid
acs:ecs:$regionid:image/*
acs:ecs:*:image/*

SecurityGroup

acs:ecs:$regionid:securitygroup/$securitygroupid
acs:ecs:$regionid:securitygroup/*
acs:ecs:*:securitygroup/*

acs:ecs:$regionid:*
acs:ecs:*:*

$regionid region id*$instanceid instance


id*

3.3 RAM ECS Action


RAMECSAction
AddDisk

DescribeInstanceStatus

AllocatePublicIpAddress

DescribeInstanceTypes

AuthorizeSecurityGroup

DescribeRegions

CreateImage

DescribeSecurityGroupAttribute

CreateInstance

DescribeSecurityGroups

CreateSecurityGroup

DescribeSnapshotAttribute

CreateSnapshot

DescribeSnapshots

DeleteDisk

JoinSecurityGroup

DeleteImage

LeaveSecurityGroup

DeleteInstance

ModifyInstanceAttribute

DeleteSecurityGroup

RebootInstance

DeleteSnapshot

ResetDisk

DescribeImages

RevokeSecurityGroup

DescribeInstanceAttribute

StartInstance

DescribeInstanceDisks

StopInstance

10

ECS API

3.4 ECS API


ECS Open API ECS ECS RAM

ECS API API


API
Action

AddDisk

acs:ecs:$regionid:instance/$instanceid

AllocatePublicIpAddress

acs:ecs: $regionid:instance/$instanceid
acs:ecs:$regionid:securitygroup/$securitygroupid

AuthorizeSecurityGroup

[and acs:ecs:$regionid:securitygroup/$sourcegroupid (
SourceGroupId) ]

CreateImage

acs:ecs:$regionid:image/*

and

acs:ecs:$regionid:snapshot/$snapshotid
acs:ecs:$regionid:instance/*

and

acs:ecs:$regionid:securitygroup/$securitygroupid
CreateInstance

and

acs:ecs:$regionid:image/$imageid
[and acs:ecs:$regionid:snapshot/$snapshotid (
DataDisk.n.SnapshotId)]

CreateSecurityGroup
CreateSnapshot

acs:ecs:$regionid:securitygroup/*
acs:ecs:$regionid:instance/$instanceid or
acs:ecs:$regionid:disk/$diskid

DeleteDisk

acs:ecs:$regionid:instance/$instanceid

DeleteImage

acs:ecs:$regionid:image/$imageid

DeleteInstance

acs:ecs:$regionid:instance/$instanceid

DeleteSecurityGroup

acs:ecs:$regionid:securitygroup/$securitygroupid
acs:ecs:$regionid:snapshot/$snapshotid

DeleteSnapshot

acs:ecs:$regionid:disk/$diskid or
acs:ecs:$regionid:instance/$instanceid

DescribeImages

acs:ecs:$regionid:image/$imageid

DescribeInstanceAttribute

acs:ecs:$regionid:instance/$instanceid

DescribeInstanceDisks

acs:ecs:$regionid:instance/$instanceid

DescribeInstanceStatus

acs:ecs:$regionid:instance/$instanceid

DescribeInstanceTypes

acs:ecs:*:*

11

or

ECS API

Action

DescribeRegions

acs:ecs:*:*

DescribeSecurityGroupAttribute

acs:ecs:$regionid:securitygroup/$securitygroupid

DescribeSecurityGroups

acs:ecs:$regionid:securitygroup/$securitygroupid

DescribeSnapshotAttribute

acs:ecs:$regionid:snapshot/$snapshotid

DescribeSnapshots

JoinSecurityGroup

LeaveSecurityGroup

acs:ecs:$regionid:disk/$diskid

or

acs:ecs:$regionid:instance/$instanceid
acs:ecs:$regionid:instance/$instanceid

acs:ecs:$regionid:securitygroup/$securitygroupid
acs:ecs:$regionid:instance/$instanceid

and

acs:ecs:$regionid:securitygroup/$securitygroupid

ModifyInstanceAttribute

acs:ecs:$regionid:instance/$instanceid

RebootInstance

acs:ecs:$regionid:instance/$instanceid
acs:ecs:$regionid:instance/$instanceid

ResetDisk

and

or

acs:ecs:$regionid:disk/$diskid
acs:ecs:$regionid:securitygroup/$securitygroupid

RevokeSecurityGroup

[and acs:ecs:$regionid:securitygroup/$securitygroupid(
sourcegroupid) ]

StartInstance

acs:ecs:$regionid:instance/$instanceid

StopInstance

acs:ecs:$regionid:instance/$instanceid

3.5 ECS
xiaoming@aliyun.com ECS InstanceId Bc23xYm09
xiaoming@aliyun.com beibei@aliyun.com
beibei@aliyun.com ECS API RebootInstanceStopInstance
DescribeInstanceAttribute
xiaoming
1. XiaoMing Beibei Xiaoming RAM
Xiaoming
RAM AddUser UserName=ALIYUN$beibei@aliyun.com
https://ram.aliyuncs.com/?Action=AddUser
&UserName=ALIYUN$beibei@aliyun.com
&<>

12

ECS API

2. PolicyPolicy JsonString json


{
"Version": "1",
"Statement":[
{
"Effect": "Allow",
"Action": ["ecs:RebootInstance","ecs:StopInstance", "ecs:DescribeInstanceAttribute"],
"Resource": ["acs:ecs:*:instance/Bc23xYm09"]
}]
}

3. Xiaoming RAM PutPolicy Beibei Policy PolicyName


web_front_server_policy xiaoming policy
https://ram.aliyuncs.com/?Action=PutUserPolicy
&UserName=ALIYUN$beibei@aliyun.com
&PolicyName=web_front_server_policy
&PolicyDocument=$ 2 policy
&<>

Policy Beibei RebootInstanceStopInstance


DescribeInstanceAttribute ECS API Xiaoming Bc23xYm09 ECS

4. Beibei ECS API ECS RebootInstance


ResourceOwnerAccount API xiaoming
https://ecs.aliyuncs.com/?Action=RebootInstance
&InstanceId=Bc23xYm09
&ResourceOwnerAccount=xiaoming@aliyun.com
&<>

5. Xiaoming Beibei Xiaoming RAM


DeleteUserPolicy policy
https://ram.aliyuncs.com/?Action=DeleteUserPolicy
&UserName=ALIYUN$beibei@aliyun.com
&PolicyName=web_front_server_policy
&<>

6. Beibei ECS API ECS


Response

13

ECS API
{
"RequestId": "7463B73D-35CC-4D19-A010-6B8D65D242EF",
"HostId": "ecs.aliyuncs.com",
"Code": " Forbidden",
"Message": " User not authorized to operate on the specified
resource."
}

4
4.1
4.1.1

1000

InternetChargeType PayByBandwidth
InternetMaxBandwidthOut
InternetChargeType PayByTraffic
InternetMaxBandwidthOut
InternetChargeType InternetMaxBandwidthOut

14

ECS API

InternetMaxBandwidthIn

4 2T2048G

cloud 2T2048Gephemeral
1T1024G

512M windows 4G
32

Action

String

CreateInstance

RegionId

String

Region ID

ImageId

String

ID

InstanceType

String

SecurityGroupId

String

InstanceName

String

64

InstanceId

InternetChargeType

String

15

ECS API

PayByBandwidth

PayByTraffic

PayByBandwidth
InternetMaxBandwidthIn

Integer

Mbps(Mega bit per


second)[1,200]
AliyunAPI
200Mbps

InternetMaxBandwidthOut

Integer

Mbps(Mega bit per


second)
[1,5]
[1,100]
API
0Mbps

1~200Mbps

HostName

String

2 .-
hostname
Windows 15
-"."

Linux 30

Password

String

6~30
Password HTTPS
API

SystemDisk.Category

String

cloud
ephemeral

cloud

ephemeral

cloud
DataDisk.n.Size

Integer

n n 1
GB 5~1024

DataDisk.n.Category

String

ephemeral

ephemeral

16

ECS API

SystemDisk.Category ephemeral
ephemeral

DataDisk.n.SnapshotId

String

DataDisk.n.Size

2013 7 15
Response
InvalidSnapshot.TooOld

ClientToken

String

64 ASCII

InstanceId

String

ID

https://ecs.aliyuncs.com/?Action=CreateInstance
&RegionId=cn-hangzhou-dg-a01
&ImageId=_32_23c472_20120822172155_aliguest.vhd
&SecurityGroupId=C0003E8B-B930-4F59-ADC0-0E209A9012B0
&HostName=Bctest01
&InstanceType=ecs.t1.small
&<>

XML
<CreateInstanceResponse>
<RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
<InstanceId>Bc23xYm09</InstanceId>
</CreateInstanceResponse>
JSON
{
"RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
"InstanceId": "Bc23xYm09",

17

ECS API
}

4.1.2

Starting

Stopped

locked

Action

String

StartInstance

InstanceId

String

ID

https://ecs.aliyuncs.com/?Action=StartInstance
&InstanceId=Bc23xYm09
&<>

XML
<StartInstanceResponse>
<RequestId>C0003E8B-B930-4F59-ADC0-0E209A9012A8</RequestId>
</StartInstanceResponse>
JSON
{
RequestId: C0003E8B-B930-4F59-ADC0-0E209A9012A8
}

4.1.3

18

ECS API

Running

Stopping Stop
Stopped

locked

Action

String

StopInstance

InstanceId

String

ID

ForceStop

String

true

false

false
false true

https://ecs.aliyuncs.com/?Action=StopInstance
&InstanceId=Bc23xYm09
&<>

XML
<StopInstanceResponse>
<RequestId>1C488B66-B819-4D14-8711-C4EAAA13AC01</RequestId>
</StopInstanceResponse>
JSON
{
RequestId: 1C488B66-B819-4D14-8711-C4EAAA13AC01
}

19

ECS API

4.1.4

Running

Starting

locked

Action

String

RebootInstance

InstanceId

String

ID

ForceStop

String

true

false

false true

false

https://ecs.aliyuncs.com/?Action=RebootInstance
&InstanceId=Bc23xYm09
&<>

XML
<RebootInstanceResponse>
<RequestId>F2E2C40D-AB09-45A1-B5C5-EB9F5C4E4E4A</RequestId>
</RebootInstanceResponse>
JSON
{
RequestId: F2E2C40D-AB09-45A1-B5C5-EB9F5C4E4E4A

20

ECS API
}

4.1.5

Deleted Starting

locked

Action

String

ModifyInstanceAttribute

InstanceId

String

ID

InstanceName

String

64

Password

String

6~30

HostName

String

2 .-
hostname
Windows 15
-.
Linux 30

SecurityGroupId

String

https://ecs.aliyuncs.com/?Action=ModifyInstanceAttribute
&InstanceId=35F20777-0DFF-C152-41FA-BCE0EA0B2FD7
&Password=pwd
&<>

21

ECS API

XML
<ModifyInstanceAttributeResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyInstanceAttributeResponse>
JSON
{
RequestId: 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
}

4.1.6

RAM
100 PageNumberPageSize

Forbidden.AccessTooManyOthersResource
Response TotalCount ResourceOwner
100 TotalCount 100

Action

String

DescribeInstanceStatus

RegionId

String

Region ID

PageNumber

Integer

1 1

PageSize

Integer

50 10

TotalCount

Integer

PageNumber

Integer

PageSize

Integer

InstanceStatuses

InstanceStatusSetType

InstanceStatusItemType

InstanceStatusSetType

22

ECS API

https://ecs.aliyuncs.com/?Action=DescribeInstanceStatus
&RegionId=cn-hangzhou-dg-a01
&<>

XML
<DescribeInstanceStatusResponse>
<RequestId>6EF60BEC-0242-43AF-BB20-270359FB54A7</RequestId>
<TotalCount>2</TotalCount>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<InstanceStatuses>
<InstanceStatus>
<InstanceId>Bc23xYm09</InstanceId>
<Status>Running</Status>
</InstanceStatus>
<InstanceStatus>
<InstanceId>Bc23xOmc0</InstanceId>
<Status>Stopped</Status>
</InstanceStatus>
</InstanceStatuses>
</DescribeInstanceStatusResponse>
JSON
{
RequestId: 6EF60BEC-0242-43AF-BB20-270359FB54A7,
TotalCount: 2,
PageNumber: 1,
PageSize: 10,
InstanceStatuses: {
InstanceStatus: [{
InstanceId: Bc23xYm09,
Status: Running
},
{
InstanceId: Bc23xOmc0,
Status: Stopped
}]
}
}

23

ECS API

4.1.7

Action

String

DescribeInstanceAttribute

InstanceId

String

ID

InstanceId

String

ID

InstanceName

String

ImageId

String

ID

RegionId

String

ID

InstanceType

String

HostName

String

Status

String

SecurityGroupIds

SecurityGroupIdSetType

SecurityGroupIdSetType

PublicIpAddress

IpAddressSetType

IP
IpAddressSetType

InternetMaxBandwidthIn

Integer

InternetMaxBandwidthOut

Integer

InternetChargeType

String

PayByBandwidth |
PayByTraffic
PayByBandwidth

PayByTraffic
PayByBandwidth

CreationTime

String

ISO8601
UTC
YYYY-MM-DDThh:mmZ

https://ecs.aliyuncs.com/?Action=DescribeInstanceAttribute

24

ECS API
&InstanceId=Bc23xYm09
&<>

XML
<DescribeInstanceAttributeResponse>
<RequestId>C330F17D-8395-4F7B-B78A-51BB3AE233D5</RequestId>
<InstanceId>Bc23xYm09</InstanceId>
<ImageId>rhel54.64.20110224.01.vhd</ImageId>
<RegionId>cn-hangzhou-dg-a01</RegionId>
<InstanceType>ecs.t1.xsmall</InstanceType>
<HostName>VM-Test</HostName>
<Status>Starting</Status>
<PublicIpAddress>
<IpAddress>10.10.10.10</IpAddress>
</PublicIpAddress>
<InnerIpAddress>
<IpAddress>10.241.119.181</IpAddress>
</InnerIpAddress>
<InternetMaxBandwidthOut>5</InternetMaxBandwidthOut>
<InternetMaxBandwidthIn>5</InternetMaxBandwidthIn>
<InternetChargeType>PayByBandwidth</InternetChargeType>
<SecurityGroupIds>
<SecurityGroupId>0E209A9012B0</SecurityGroupId>
</SecurityGroupIds>
</DescribeInstanceAttributeResponse>
JSON
{
"RequestId": " C330F17D-8395-4F7B-B78A-51BB3AE233D5",
"InstanceId": "Bc23xYm09",
"ImageId": "rhel54.64.20110224.01.vhd",
"RegionId": "cn-hangzhou-dg-a01",
"InstanceType": "ecs.t1.xsmall",
"HostName": "VM-Test",
"PublicIpAddress": {
"IpAddress": ["10.10.10.10"]
},
"InnerIpAddress": {
"IpAddress": ["10.241.119.181"]
},
"InternetMaxBandwidthOut": 5,

25

ECS API
"InternetMaxBandwidthIn": 5,
"InternetChargeType":"PayByBandwidth",
"Status": "Starting",
"SecurityGroupIds": {
"SecurityGroupId": ["C0003E8B-B930-4F59-ADC0-0E209A9012B0"]
}
}

4.1.8

Stopped Deleted

Action

String

DeleteInstance

InstanceId

String

ID

https://ecs.aliyuncs.com/?Action=DeleteInstance
&InstanceId=Bc23xYm09
&<>

XML
<DeleteInstanceResponse>
<RequestId>928E2273-5715-46B9-A730-238DC996A533</RequestId>
</DeleteInstanceResponse>
JSON
{

26

ECS API
"RequestId": "928E2273-5715-46B9-A730-238DC996A533"
}

4.1.9

Stopped Running

1000

Action

String

JoinSecurityGroup

InstanceId

String

ID

SecurityGroupId

String

https://ecs.aliyuncs.com/?Action=JoinSecurityGroup
&InstanceId=35F20777-0DFF-C152-41FA-BCE0EA0B2FD7
&SecurityGroupId=F876FF7BA984
&<>

XML
<JoinSecurityGroupResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</JoinSecurityGroupResponse>
JSON
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

4.1.10

27

ECS API

Stopped Running

Action

String

LeaveSecurityGroup

InstanceId

String

ID

SecurityGroupId

String

https://ecs.aliyuncs.com/?Action=LeaveSecurityGroup
&InstanceId=35F20777-0DFF-C152-41FA-BCE0EA0B2FD7
&SecurityGroupId=F876FF7BA984
&<>

XML
<LeaveSecurityGroupResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</LeaveSecurityGroupResponse>
JSON
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

4.2
4.2.1

Running Stopped

Running

28

ECS API

4 2T
8T

locked

2013 7 15

Action

String

AddDisk

InstanceId

String

Size

String

GB
5~2048

SnapshotId

String

SnapshotId
Snapshot Snapshot
Snapshot 2013 7 15
Response
InvalidSnapshot.TooOld

ClientToken

String

64 ASCII

DiskId

String

https://ecs.aliyuncs.com/?Action=AddDisk
&InstanceId=Bc0102-23xYm09
&Size=20
&<>

XML
<AddDiskResponse>
<RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
<DiskId>1033-60053321</DiskId>

29

ECS API
</AddDiskResponse>
JSON
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
"DiskId": "1033-60053321"
}

4.2.2

Running Stopped

Running

ID

locked

Action

String

DeleteDisk

InstanceId

String

ID

DiskId

String

ID

https://ecs.aliyuncs.com/?Action=DeleteDisk
&DiskId=1033-60053321
&<>

XML
<DeleteDiskResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>

30

ECS API
</DeleteDiskResponse>
JSON
{
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

4.2.3

Stopped

Action

String

ResetDisk

InstanceId

String

DiskId

String

ID

SnapshotId

String

ID

https://ecs.aliyuncs.com/?Action=ResetDisk
&InstanceId=Bc0102-23xYm09
&DiskId=1033-60053321
&SnapshotId=923FE2BF04C5
&<>

XML
<ResetDiskResponse>
<RequestId>F3CD6886-D8D0-4FEE-B93E-1B73239673DE</RequestId>
</ResetDiskResponse>
JSON
{"RequestId":"F3CD6886-D8D0-4FEE-B93E-1B73239673DE"}

31

ECS API

4.2.4

ID

Starting Deleted

Action

String

DescribeInstanceDisks

InstanceId

String

Id

Disks

DiskItemType

DiskItemType

https://ecs.aliyuncs.com/?Action=DescribeInstanceDisks
&InstanceId=Bc23xYm09
&<>

XML
<DescribeInstanceDisksResponse>
<RequestId>E4FFD20F-EC72-466A-9815-1CED3C88A863</RequestId>
<Disks>
<Disk>
<DiskId>1033-60053321</DiskId>
<Size>20</Size>
<Type>system</Type>
<Category>ephemeral</Category>
</Disk>
<Disk>
<DiskId>1033-10056026</DiskId>
<Size>100</Size>
<Type>data</Type>
<Category>ephemeral</Category>
</Disk>

32

ECS API
</Disks>
</DescribeInstanceDisksResponse>
JSON
{
"RequestId": "E4FFD20F-EC72-466A-9815-1CED3C88A863",
"Disks": {
Disk: [{
"DiskId": "1033-60053321",
"Size": 20,
"Type": "system"
},
{
"DiskId": " 1033-10056026",
"Size": 100,
"Type": "data"
}]
}
}

4.3
4.3.1

Stopped Running

100%

100%

3
5 3
2

33

ECS API

Action

String

CreateSnapshot

InstanceId

String

ID

DiskId

String

ID

SnapshotName

String

"-"
[0,300]

ClientToken

String

64 ASCII

SnapshotId

String

ID

https://ecs.aliyuncs.com/?Action=CreateSnapshot
&InstanceId=Bc23xYm09
&DiskId=1033-60053321
&<>

XML
<CreateSnapshotResponse>
<RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
<SnapshotId>923FE2BF04C5</SnapshotId>
</CreateSnapshotResponse>
JSON
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
"SnapshotId": "923FE2BF04C5"
}

34

ECS API

4.3.2

100%

Stopped Running

ID

Action

String

DeleteSnapshot

DiskId

String

ID

InstanceId

String

SnapshotId

String

ID

https://ecs.aliyuncs.com/?Action=DeleteSnapshot
&DiskId=1033-60053321
&InstanceId=Bc23xYm09
&SnapshotId=923FE2BF04C5
&<>

XML
<DeleteSnapshotResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</DeleteSnapshotResponse>
JSON
{
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

35

ECS API

4.3.3

Action

String

DescribeSnapshots

InstanceId

String

ID

DiskId

String

ID

Snapshots

SnapshotType

SnapshotType

https://ecs.aliyuncs.com/?Action=DescribeSnapshots
&InstanceId=Bc23xYm09
&DiskId=1033-60053321
&<>

XML
<DescribeSnapshotsResponse>
<RequestId>1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6</RequestId>
<Snapshots>
<Snapshot>
<SnapshotId>923FE2BF04C5</SnapshotId>
<Progress>100</Progress>
<CreationTime>2012-06-01T12:03Z</CreationTime>
</Snapshot>
</Snapshots>
</DescribeSnapshotsResponse>
JSON
{
"RequestId": "1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6",
"Snapshots": {
"Snapshot": [{

36

ECS API
"SnapshotId": "923FE2BF04C5",
"Progress": "100",
"CreationTime": "2012-06-01T12:03Z"
}]
}
}

4.3.4

Action

String

DescribeSnapshotAttribute

RegionId

String

Id

SnapshotId

String

SnapshotId

String

SnapshotName

String

Progress

Integer

100

CreationTime

String

ISO8601 UTC
YYYY-MM-DDThh:mmZ

https://ecs.aliyuncs.com/?Action=DescribeSnapshotAttribute
&RegionId=cn-hangzhou-dg-a01
&SnapshotId=923FE2BF04C5
&<>

XML
<DescribeSnapshotAttributeResponse>
<RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
<SnapshotId>923FE2BF04C5</SnapshotId>
<Progress>100</Progress>
<CreationTime>2012-06-01T12:03Z</CreationTime>

37

ECS API
</DescribeSnapshotAttributeResponse>
JSON
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
"SnapshotId": "923FE2BF04C5",
"Progress": "100",
"CreationTime": 2012-06-01T12:03Z,
}

4.4
4.4.1

10

Action

String

DescribeImages

RegionId

String

Region ID

PageNumber

Integer

1 1

PageSize

Integer

50
10

ImageId

String

ID,

ImageOwnerAlias

String

system

self

others

RegionId

String

Id

TotalCount

Integer

PageNumber

Integer

PageSize

Integer

10 50

38

ECS API

Images

ImageType

ImageType

Architecture

i386 | x86_64

String

https://ecs.aliyuncs.com/?Action=DescribeImages
&RegionId=cn-hangzhou-dg-a01
&<>

XML
<DescribeImagesResponse>
<RequestId>63DFD5FB-294A-45C9-8206-1D82C9882D33</RequestId>
<RegionId>cn-hangzhou-dg-a01</RegionId>
<TotalCount>12</TotalCount>
<PageNumber>1</PageNumber>
<PageSize>3</PageSize>
<Images>
<Image>
<ImageId>windows2003stdcn.64.20110509.01.vhd</ImageId>
<ImageVersion>1</ImageVersion>
<Platform>Windows Server 2003</Platform>
<Description>
windows2003stdcn.64.20110509.01.vhd
</Description>
<Size>60</Size>
<Architecture>x86_64</Architecture>
<ImageOwnerAlias>system</ImageOwnerAlias>
<OSName>Windows Server 2003 64 </OSName>
</Image>
<Image>
<ImageId>windows2003.20101028.ww.01.vhd</ImageId>
<ImageVersion>1</ImageVersion>
<Platform>Windows Server 2003</Platform>
<Description>windows2003.20101028.ww.01.vhd</Description>
<Size>60</Size>
<Architecture>i386</Architecture>
<ImageOwnerAlias>system</ImageOwnerAlias>
<OSName>Windows Server 2003</OSName>
</Image>

39

ECS API
<Image>
<ImageId>rhel54.64.20110224.01.vhd</ImageId>
<ImageVersion>1</ImageVersion>
<Platform>Red Hat</Platform>
<Description>rhel54.64.20110224.01.vhd</Description>
<Size>60</Size>
<Architecture>x86_64</Architecture>
<ImageOwnerAlias>self</ImageOwnerAlias>
<OSName>Red Hat 64 </OSName>
</Image>
</Images>
</DescribeImagesResponse>

JSON
{
"RequestId": "63DFD5FB-294A-45C9-8206-1D82C9882D33",
"RegionId": "cn-hangzhou-dg-a01",
"TotalCount": 12,
"PageNumber": "1",
"PageSize": "10",
"Images": {
"Image": [{
"ImageId": "windows2003stdcn.64.20110509.01.vhd",
"ImageVersion": "1",
"Platform": "Windows Server 2003",
"Description": "windows2003stdcn.64.20110509.01.vhd",
"Size": 60,
"ImageOwnerAlias": "system",
"OSName": "Windows Server 2003 64 "
},
{
"ImageId": "rhel54.64.20110224.01.vhd",
"ImageVersion": "1",
"Platform": "Red Hat",
"Description": "rhel54.64.20110224.01.vhd",
"Size": 60,
"ImageOwnerAlias": "system",
"OSName": "Windows Server 2003"
},
{
"ImageId": "debian-603-64.rs.test.20120417.vhd",

40

ECS API
"ImageVersion": "1",
"Platform": "Red Hat",
"Description": "debian-603-64.rs.test.20120417.vhd",
"Size": 60,
"ImageOwnerAlias": "self",
"OSName": "Red Hat 64 "
}]
}
}

4.4.2

ECS

100%

locked

2013 7 15 Request
Response code InvalidSnapshot.TooOld

Action

String

CreateImage

RegionId

String

Region ID

SnapshotId

String

ID

ImageVersion

String

1~40

Description

String

1~200

OSName

String

ClientToken

String

64
ASCII

ImageId

String

ID

41

ECS API

https://ecs.aliyuncs.com/?Action=CreateImage
&RegionId=cn-hangzhou-dg-a01
&ImageVersion=img-2012-12-01-1300
&Description=demo_image
&<>

XML
<CreateImageResponse>
<RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
<ImageId>63DFD5FB-294A-45C9-8206-1D82C9882D09</ImageId>
</CreateImageResponse>
JSON
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9",
"ImageId": "63DFD5FB-294A-45C9-8206-1D82C9882D09"
}

4.4.3

ECS

Action

String

DeleteImage

RegionId

String

Region ID

ImageId

String

ID

https://ecs.aliyuncs.com/?Action=DeleteImage
&RegionId=cn-hangzhou-dg-a01

42

ECS API
&ImageId=63DFD5FB-294A-45C9-8206-1D82C9882D09
&<>

XML
<DeleteImageResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</DeleteImageResponse>
JSON
{
"RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

4.5
4.5.1

IP

IP

Running Stopped

IP

IP IP

IP IP
IP

locked IP

Action

String

AllocatePublicIpAddress

InstanceId

String

IP ID

IpAddress

String

IP

43

ECS API
https://ecs.aliyuncs.com/?Action=AllocatePublicIpAddress
&InstanceId=Bc0102-23xYm09
&<>

XML
<AllocatePublicIpAddressResponse>
<RequestId>F2EF6A3B-E345-46B9-931E-0EA094818567</RequestId>
<IpAddress>10.1.149.159</IpAddress>
</AllocatePublicIpAddressResponse>
JSON
{
"RequestId": "F2EF6A3B-E345-46B9-931E-0EA094818567",
"IpAddress": "10.1.149.159"
}

4.6

4.6.1

100

Action

String

CreateSecurityGroup

RegionId

String

Region ID

Description

String

500

ClientToken

String

64 ASCII

44

ECS API

SecurityGroupId

ID

String

https://ecs.aliyuncs.com/?Action=CreateSecurityGroup
&RegionId=cn-hangzhou-dg-a01
&Description=for%20a%20demo
&<>

XML
<CreateSecurityGroupResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
<SecurityGroupId>F876FF7BA984</SecurityGroupId>
</CreateSecurityGroupResponse>
JSON
{
"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
"SecurityGroupId":" F876FF7BA984"
}

4.6.2

1 region
2 IP CIDR

accept

NicType internet intranet

100

NicType intranet

SourceGroupIdIpProtocolPortRange
NicTypePolicy SourceCidrIpIpProtocolPortRangeNicTypePolicy

45

ECS API

Action

String

AuthorizeSecurityGroup

SecurityGroupId

String

RegionId

String

Region ID

IpProtocol

String

IP tcp|udp|icmp|gre|all
all

PortRange

String

IP tcpudp
1~655351/200
1~200200/1
icmp -1/-1
gre -1/-1
IpProtocol all -1/-1

SourceGroupId

String

Region
SourceGroupId SourceCidrIp
SourceCidrIp
NicType intranet

SourceCidrIp

String

IP CIDR
IP 0.0.0.0/0
10.159.6.18/12 10.159.6.186

Policy

String

accept
accept

NicType

String

internet

intranet

internet
SourceGroupId
NicType intranet

1 region Group
https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroup
&SecurityGroupId=C0003E8B-B930-4F59-ADC0-0E209A9012B0
&SourceGroupId=1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6
&IpProtocol=tcp
&PortRange=1/65535

46

ECS API
&<>

2 IP
https://ecs.aliyuncs.com/?Action=AuthorizeSecurityGroup
&SecurityGroupId=C0003E8B-B930-4F59-ADC0-0E209A9012B0
&SourceCidrIp=0.0.0.0/0
&IpProtocol=tcp
&PortRange=1/65535
&<>

XML
<AuthorizeSecurityGroupResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</AuthorizeSecurityGroupResponse>
JSON
{"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"}

4.6.3

Action

String

DescribeSecurityGroupAttribute

SecurityGroupId

String

ID

RegionId

String

Region ID

NicType

String

internet|intranet
internet

SecurityGroupId

String

RegionId

String

Id

Description

String

Permissions

PermissionType

PermissionType

47

ECS API

https://ecs.aliyuncs.com/?Action=DescribeSecurityGroupAttribute
&SecurityGroupId=C0003E8B-B930-4F59-ADC0-0E209A9012B0
&RegionId=cn-hangzhou-dg-a01
&<>

XML
<DescribeSecurityGroupAttributeResponse>
<RequestId>1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6</RequestId>
<RegionId>cn-hangzhou-dg-a01</RegionId>
<SecurityGroupId>C0003E8B-B930-4F59-ADC0-0E209A9012B0</SecurityGroupId>
<Description>for demo</Description>
<Permissions>
<Permission>
<IpProtocol>ALL</IpProtocol>
<PortRange>-1/-1</PortRange>
<SourceGroupId>8dsmf982</SourceGroupId>
<Policy>Accept</Policy>
<NicType>intranet</NicType>
</Permission>
<Permission>
<IpProtocol>tcp</IpProtocol>
<PortRange>1/65535</PortRange>
<SourceCidrIp>0.0.0.0/0</SourceCidrIp>
<Policy>accept</Policy>
<NicType>internet</NicType>
</Permission>
</Permissions>
</DescribeSecurityGroupAttributeResponse>
JSON
{
"RequestId": "1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6",
"RegionId": "cn-hangzhou-dg-a01",
"SecurityGroupId": "C0003E8B-B930-4F59-ADC0-0E209A9012B0",
"Description": "for demo",
"Permissions": {
"Permission": [{
"IpProtocol": "ALL",
"PortRange": "-1/-1",

48

ECS API
"SourceGroupId": "8dsmf982",
"Policy": "Accept",
"NicType": "intranet"
},
{
"IpProtocol": "tcp",
"PortRange": "1/65535",
"SourceCidrIp": "0.0.0.0/0",
"Policy": "accept",
"NicType": "internet"
}]
}
}

4.6.4

10
ID

Action

String

DescribeSecurityGroups

RegionId

String

PageNumber

Integer

1 1

PageSize

Integer

50 10

TotalCount

Integer

PageNumber

Integer

PageSize

Integer

RegionId

String

Id

SecurityGroups

SecurityGroupItemType

SecurityGroupItemType

https://ecs.aliyuncs.com/?Action=DescribeSecurityGroups
&RegionId=cn-hangzhou-dg-a01
&<>

49

ECS API

XML
<DescribeSecurityGroupsResponse>
<RequestId>94D38899-626D-434A-891F-7E1F77A81525</RequestId>
<TotalCount>4</TotalCount>
<PageNumber>1</PageNumber>
<PageSize>10</PageSize>
<RegionId>cn-hangzhou-dg-a01</RegionId>
<SecurityGroups>
<SecurityGroup>
<SecurityGroupId>63DFD5FB</SecurityGroupId>
<Description>Test</Description>
</SecurityGroup>
<SecurityGroup>
<SecurityGroupId>086FFC27</SecurityGroupId>
<Description>test00212</Description>
</SecurityGroup>
<SecurityGroup>
<SecurityGroupId>BA4B7975</SecurityGroupId>
<Description>cn-hangzhou-dg-a01 test group</Description>
</SecurityGroup>
<SecurityGroup>
<SecurityGroupId>35F20777</SecurityGroupId>
<Description>cn-hangzhou-dg-a01 test group</Description>
</SecurityGroup>
</SecurityGroups>
</DescribeSecurityGroupsResponse>
JSON
{
"RequestId": "94D38899-626D-434A-891F-7E1F77A81525",
"TotalCount": 4,
"PageSize": "10",
"RegionId": "cn-hangzhou-dg-a01",
"PageNumber": "1",
"SecurityGroups": {
"SecurityGroup": [{
"SecurityGroupId": "63DFD5FB",
"Description": "TestByXcf"
},
{

50

ECS API
"SecurityGroupId": "086FFC27",
"Description": "test00212"
},
{
"SecurityGroupId": "BA4B7975",
"Description": "cn-hangzhou-dg-a01 test group"
},
{
"SecurityGroupId": "35F20777",
"Description": "cn-hangzhou-dg-a01 test group"
}]
}
}

4.6.5

Group Region
IP

SourceGroupIdIpProtocolPortRange
NicTypePolicy SourceCidrIpIpProtocolPortRangeNicTypePolicy

Action

String

RevokeSecurityGroup

SecurityGroupId

String

ID

RegionId

String

Region ID

IpProtocol

String

IP tcp|udp|icmp|gre|all
all

PortRange

String

IP tcpudp
1~65535
icmp -1/-1
gre -1/-1
IpProtocol all -1/-1

SourceGroupId

String

Region ID

51

ECS API

SourceGroupId SourceCidrIp
SourceCidrIp
Group 10 ,

SourceCidrIp

String

IP CIDR
IP 0.0.0.0/0
10.159.6.18/12 10.159.6.186

Policy

String

acceptdrop
reject
accept

NicType

String

internet|intranet
internet

SourceGroupId NicType intranet

https://ecs.aliyuncs.com/?Action=RevokeSecurityGroup
&SecurityGroupId=C0003E8B-B930-4F59-ADC0-0E209A9012B0
&SourceGroupId=1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6
&IpProtocol=tcp
&PortRange=1/65535
&<>

XML
<RevokeSecurityGroupResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</RevokeSecurityGroupResponse>
JSON
{"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"}

4.6.6

52

ECS API

Action

String

DeleteSecurityGroup

SecurityGroupId

String

ID

RegionId

String

Id

Regions

RegionType

RegionType

https://ecs.aliyuncs.com/?Action=DeleteSecurityGroup
&SecurityGroupId=C0003E8B-B930-4F59-ADC0-0E209A9012B0
&RegionId=cn-hangzhou-dg-a01
&<>

XML
<DeleteSecurityGroupResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RquestID>
</DeleteSecurityGroupResponse>
JSON
"RequestId":"CEF72CEB-54B6-4AE8-B225-F876FF7BA984"}

4.7
4.7.1

Region

Action

String

DescribeRegions

53

ECS API

Regions

RegionType

RegionType

https://ecs.aliyuncs.com/?Action=DescribeRegions
&<>

XML
<DescribeRegionsResponse>
<RequestId>611CB80C-B6A9-43DB-9E38-0B0AC3D9B58F</RequestId>
<Regions>
<Region>
<RegionId>cn-hangzhou-dg-a01</RegionId>
</Region>
<Region>
<RegionId>cn-qingdao-cm5-a01</RegionId>
</Region>
</Regions>
</DescribeRegionsResponse>
JSON
{
"RequestId": "611CB80C-B6A9-43DB-9E38-0B0AC3D9B58F",
"Regions": {
"Region": [{
"RegionId": "cn-hangzhou-dg-a01"
},
{
"RegionId": "cn-qingdao-cm5-a01"
}]
}
}

54

ECS API

4.8
4.8.1

ECS

http://help.aliyun.com/view/11108189_13545434.html

Action

String

DescribeInstanceTypes

InstanceTypes

InstanceTypeItemType

InstanceTypeItemType

https://ecs.aliyuncs.com/?Action=DescribeInstanceTypes
&<>

XML
<DescribeInstanceTypesResponse>
<RequestId>1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6</RequestId>
<InstanceTypes>
<InstanceType>
<InstanceTypeId>ecs.t1.xsmall</InstanceTypeId>
<CpuCoreCount>1</CpuCoreCount>
<MemorySize>0.5</MemorySize>
</InstanceType>
<InstanceType>
<InstanceTypeId>ecs.t1.small</InstanceTypeId>
<CpuCoreCount>1</CpuCoreCount>
<MemorySize>1</MemorySize>
</InstanceType>

55

ECS API
<InstanceType>
<InstanceTypeId>ecs.s1.xsmall</InstanceTypeId>
<CpuCoreCount>1</CpuCoreCount>
<MemorySize>1.5</MemorySize>
</InstanceType>
</InstanceTypes>
</DescribeInstanceTypesResponse>
JSON
{
"RequestId": "1651FBB6-4FBF-49FF-A9F5-DF5D696C7EC6",
"InstanceTypes": {
"InstanceType": [{
"InstanceTypeId": "ecs.t1.xsmall",
"CpuCoreCount": 1,
"MemorySize": 0.5
},
{
"InstanceTypeId": "ecs.t1.small",
"CpuCoreCount": 1,
"MemorySize": 1
},
{
"InstanceTypeId": "ecs.s1.xsmall",
"CpuCoreCount": 1,
"MemorySize": 1.5
}]
}
}

56

ECS API

5
DiskItemType

Disk

DiskId

String

ID

Type

String

Category

String

system:

data:

Size

Integer

cloud:

ephemeral:

GB

DiskSetType

Disks

57

ECS API

Disk

DiskItemType

DiskItemType

ImageType

Image

ImageId

String

ImageVersion

String

PlatForm

String

Description

String

Size

Integer

ImageOwnerAlias

String

OSName

system

self

others

String

58

ECS API

InstanceMonitorDataType

InstanceMonitorData

InstanceId

String

ID

CPU

Double

CPU %

Memory

Integer

MB

IntranetRX

Integer

kbytes

IntranetTX

Integer

kbytes

IntranetFlow

Integer

kbytes

IntranetBandwidth

Integer

kbytes/s

InternetRX

Integer

kbytes

InternetTX

Integer

kbytes

InternetFlow

Integer

InternetBandwidth

Integer

kbytes/s

IOPSRead

Integer

IO /s

IOPSWrite

Integer

IO /s

BPSRead

Integer

byte/s

59

ECS API

BPSWrite

Integer

byte/s

TimeStamp

String

ISO8601

InstanceStatusItemType

InstanceStatus

InstanceId

String

ID

Status

String

InstanceStatusSetType

InstanceStatuses

InstanceStatus

InstanceStatusItemType[]

60

InstanceStatusItemType

ECS API

InstanceTypeItemType

InstanceType

InstanceTypeId

String

ID

CpuCoreCount

Integer

CPU

MemorySize

Double

GB

IpAddressSetType

IP

IpAddress

String

IP

PermissionSetType

61

ECS API

Permissions

Permision

PermissionType

PermissionType

PermissionType

Permission

IpProtocol

String

IP

PortRange

String

SourceCidrIp

String

IP

SourceGroupId

String

Policy

String

NicType

String

RegionType

Region

62

ECS API

Region

RegionId

Region ID

String

SnapshotType

SnapshotId

String

ID

SnapshotName

String

Progress

Integer

CreationTime

String

ISO8601 UTC

YYYY-MM-DDThh:mmZ

SecurityGroupIdSetType

ID

SecurityGroupIds

63

ECS API

SecurityGroupId

ID

String

SecurityGroupSetType

SecurityGroups

SecurityGroup

SecurityGroupItemType

SecurityGroupItemType

SecurityGroupItemType

SecurityGroups

SecurityGroupId

String

ID

Description

String

64

ECS API

IpRangeSetType

IP

IpRanges

IpAddress

String

CIDR IP

NicType

String

internet | intranet

65

ECS API

6
6.1

Tiny

Standard

High

CPU(Core)

(G)

ecs.t1.xsmall

0.5

ecs.t1.small

ecs.s1.small

ecs.s1.medium

ecs.s2.small

ecs.s2.large

ecs.s2.xlarge

ecs.s3.medium

ecs.s3.large

ecs.m1.medium

16

ecs.m1.xlarge

32

ecs.c1.small

ecs.c1.large

16

ecs.c2.xlarge

16

64

Memory

High CPU

60G~2048G 10G 5 ()

66

ECS API

6.2
6.2.1

HTTP

UnsupportedOperation

The specified action is not supported.

400

NoSuchVersion

The specified version does not exist.

400

UnsupportedParameter

The parameter <parameter name> is not

400

supported.
MissingParameter

The input parameter "<parameter name>"

400

that is mandatory for processing this


request is not supplied.
InvalidParameter

The specified parameter "<parameter

400

name>" is not valid.


Or
The specified image does not support the s
pecified instance type.
Throttling

Request was denied due to request

400

throttling.
InvalidAccessKeyId.NotFound

The Access Key ID provided does not exist

400

in our records.
Forbidden

User not authorized to operate on the

403

specified resource.
Forbidden.RiskControl

This operation is forbidden by Aliyun Risk

403

Control system.
Forbiden.NomoreSecurityGroup

This operation is forbidden because an


instance must be in 1 security group at

67

403

ECS API

HTTP

least.
Forbidden.AccessTooManyOthersR

This operator is forbidden because too

esource

many other ones resource to be accessed.

SignatureDoesNotMatch

The signature we calculated does not

403

403

match the one you provided. Please refer to


the API reference about authentication for
details.
SignatureNonceUsed

The request signature nonce has been

400

used.
IdempotentParameterMismatch

Request uses a client token in a previous

400

request but is not identical to that request.


IncorrectInstanceStatus

The current instance status does not

400

support this operation.


InstanceMountedSnapshot

The current instance mounted snapshot.

400

Please uninstall first


InvalidSecurityGroupStatus

The current security group status does not

400

support this operation.


InvalidSecurityGroup.InUse

The current security group is referenced by

400

an instance or another security group and


cannot be deleted.
SecurityGroupLimitExceeded

Exceeding the allowed amount of security

400

groups.
DiskNumberLimitExceeded

Exceeding the allowed amount of disks.

400

SecurityGroupRuleLimitExceeded

Exceeding the allowed amount of rules of a

400

security group.
SecurityGroupInstanceLimitExce

Exceeding the allowed amount of instances

ed

68

400

ECS API

HTTP

of a security group.
InstanceSecurityGroupLimitExce

Exceeding the allowed amount of security

eded

groups that an instance can be in.

InvalidSnapshot.InUse

Specified snapshot is mounted and cannot

400

400

be deleted
InvalidInstanceId.NotFound

Specified instance does not exist.

400

InvalidInstanceId.Malformed

Specified instance ID is not valid.

400

InvalidInstanceType.NotFound

Specified instance type does not exist.

400

InvalidRegionId.NotFound

Specified region does not exist.

400

InvalidDiskId.NotFound

Specified disk does not exist.

400

InvalidDiskId.Malformed

Specified disk ID is not valid.

400

InvalidDisk.NotReady

The specified disk is not ready for this

400

operation. Please try it later.


InvalidDiskType.NotFound

Disks of specified DiskType does not exist.

400

InvalidDiskCategory.NotSupport

The specified disk category is not

400

ed

supported by this operation.

InvalidSnapshotId.NotFound

Specified snapshot does not exist.

400

InvalidSnapshotId.Malformed

Specified snapshot ID is not valid.

400

InvalidSnapshot.Unbootable

Specified snapshot is not bootable maybe

400

because it was not created from a system


disk.
InvalidSnapshot.NotReady

The specified snapshot is not ready for this

400

operation. Please try it later.


InvalidSnapshot.TooOld

This operation is forbidden because the


specified snapshot is created before

69

400

ECS API

HTTP

2013-07-15.
InvalidPassword.Malformed

Specified password is not valid.

400

InvalidPublicIpAddress.NotFoun

Specified public IP address does not exist.

400

Specified public IP address is not valid.

400

InvalidHostName.Malformed

Specified host name is not valid.

400

InvalidImageId.NotFound

Specified image does not exist.

400

InvalidImageId.Malformed

Specified image ID is not valid.

400

InvalidImageId.BasedSnapshotTo

Specified image is based on a snapshot

400

oOld

created before 2013-07-15

InvalidSecurityGroupId.Malform

Specified security group ID is not valid.

400

Specified security group does not exist.

400

InvalidSourceGroupId.NotFound

Specified source group does not exist.

400

InvalidSourceGroupId.Malformed

The source group ID can not be the same

400

d
InvalidPublicIpAddress.Malform
ed

ed
InvalidSecurityGroupId.NotFoun
d

with the destination group ID.


InvalidSecurityGroupDescriptio

Specified description is not valid.

400

InvalidIpProtocol

Specified IP protocol is not valid.

400

InvalidDiskSize.Malformed

Specified disk size is not valid.

400

InvalidDiskSize.Exceeded

The total size of disks exceeds its quota.

400

InvalidInternetMaxBandwidth.Ma

Specified internet max bandwidth is not

400

70

ECS API

HTTP

lformed

valid.

InvalidSourceCidrIp.Malformed

Specified source CIDR IP is not valid.

400

InvalidPortRange.Malformed

Specified port range is not valid.

400

InvalidPolicy.Malformed

Specified policy is not valid.

400

InvalidNicType.Malformed

Specified nic type is not valid.

400

ChargeTypeViolation

Operations on this kind of resources are not

403

permitted.
InsufficientBalance

Your account does not have enough

400

balance.
QuotaExceeded

Living instances quota exceeded.

400

DiskNumberLimitExceeded

Exceeding the allowed amount of

400

disks.
OperationDenied

Specified operation is denied as your

403

instance is locked for security reasons.


RiskControl.Refused

Your action was.refused by RiskControl.

400

QuotaExceeded.Snapshot

Snapshot quota exceeded.

400

QuotaExceeded.Image

Image quota exceeded.

400

Forbidden.SystemDiskCannotBeDe

This operation is forbidden because system

400

leted

disk cannot be deleted.

6.2.2

HTTP

InsufficientInstanceCapacity

There is insufficient capacity available for


the requested instance.

71

500

ECS API

HTTP

InternalError

The request processing has failed due to

500

some unknown error, exception or failure.


ServiceUnavailable

The request has failed due to a temporary

503

failure of the server.

6.3

Stopped

Starting

Running

Stopping

Deleted

6.4

6.5

Category

cloud

2T

72

2T

ECS API

ephemeral

1T

2T

6.6
ECS ECS HTTP HTTP HTTPS
ECS ECS

HTTP

6.6.1

HTTP ECS GET


URL
URL
ECS http://ecs.aliyuncs.com/

https://ecs.aliyuncs.com/ HTTPS HTTPS


SSL
Action

JSON
{
"RequestId": "4C467B38-3910-447D-87BC-AC049166F216",
/* */
}

73

ECS API

6.6.2

DescribeRegions Java
http://dev.aliyun.com
Action DescribeRegions RegionIdECS
RegionId
Signature URL URL URL
http://ecs.aliyuncs.com/?TimeStamp=2012-12-26T10:33:56Z&Format=XML&AccessKey
Id=testid&Action=DescribeRegions&SignatureMethod=HMAC-SHA1&SignatureNonce=Nw
DAxvLU6tFE0DVb&Version=2013-01-10&SignatureVersion=1.0

Canonicalized Query String

http://ecs.aliyuncs.com/?TimeStamp=2012-12-26T10:33:56Z&Format=XML&AccessKey
Id=testid&Action=DescribeRegions&SignatureMethod=HMAC-SHA1&SignatureNonce=Nw
DAxvLU6tFE0DVb&Version=2013-01-10&SignatureVersion=1.0

StringToSign
GET&%2F&AccessKeyId%3Dtestid%26Action%3DDescribeRegions%26Format%3DXML%26Sig
natureMethod%3DHMAC-SHA1%26SignatureNonce%3DNwDAxvLU6tFE0DVb%26SignatureVers
ion%3D1.0%26TimeStamp%3D2012-12-26T10%253A33%253A56Z%26Version%3D2013-01-10

Java

StringToSign
Map<String,
String> Access Key ID testid
final String HTTP_METHOD = "GET";
Map<String, String> parameters = new HashMap<String, String>();
//
parameters.put("Action", "DescribeRegions");
parameters.put("Version", "2013-01-10");
parameters.put("AccessKeyId", "testid");
parameters.put("TimeStamp", formatIso8601Date(new Date()));
parameters.put("SignatureMethod", "HMAC-SHA1");
parameters.put("SignatureVersion", "1");
parameters.put("SignatureNonce", UUID.randomUUID().toString());
parameters.put("Format", "XML");
//

74

ECS API
String[] sortedKeys = parameters.keySet().toArray(new String[]{});
Arrays.sort(sortedKeys);
final String SEPARATOR = "&";
// stringToSign
StringBuilder stringToSign = new StringBuilder();
stringToSign.append(HTTP_METHOD).append(SEPARATOR);
stringToSign.append(percentEncode("/")).append(SEPARATOR);
StringBuilder canonicalizedQueryString = new StringBuilder();
for(String key : sortedKeys) {
// keyvalue
canonicalizedQueryString.append("&")
.append(percentEncode(key)).append("=")
.append(percentEncode(parameters.get(key)));
}
// canonicalizedQueryString
stringToSign.append(percentEncode(
canonicalizedQueryString.toString().substring(1)));

TimeStamp ISO8601 UTC


TimeStamp
private static final String ISO8601_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
private static String formatIso8601Date(Date date) {
SimpleDateFormat df = new SimpleDateFormat(ISO8601_DATE_FORMAT);
df.setTimeZone(new SimpleTimeZone(0, "GMT"));
return df.format(date);
}

canonicalizedQueryString
stringToSign
java.net.URLEncoder
private static final String ENCODING = "UTF-8";
private static String percentEncode(String value)
throws UnsupportedEncodingException{
return value != null ?
URLEncoder.encode(value, ENCODING).replace("+", "%20")
.replace("*", "%2A").replace("%7E", "~")

75

ECS API
: null;
}

Access Key Id testid Access Key Secret testsecret


HMAC Key testsecret&
SDFQNvyH5rtkc9T5Fwo8DOjw5hc=
Java
//
final String ALGORITHM = "HmacSHA1";
final String ENCODING = "UTF-8";
key = "testsecret&";
Mac mac = Mac.getInstance(ALGORITHM);
mac.init(new SecretKeySpec(
key.getBytes(ENCODING), ALGORITHM));
byte[] signData = mac.doFinal(
stringToSign.getBytes(ENCODING));
String signature =
new String(Base64.encodeBase64(signData));

RFC3986 URL
http://ecs.aliyuncs.com/?TimeStamp=2012-12-26T10%3A33%3A56Z&Format=XML&Acces
sKeyId=testid&Action=DescribeRegions&SignatureMethod=HMAC-SHA1&RegionId=regi
on1&SignatureNonce=NwDAxvLU6tFE0DVb&Version=2012-09-13&SignatureVersion=1.0&
Signature=SDFQNvyH5rtkc9T5Fwo8DOjw5hc%3d

HTTP URL HTTP ECS

<DescribeRegionsResponse>
<Regions>
<Region>
<LocalName></LocalName>
<RegionId>cn-qingdao</RegionId>
</Region>
<Region>
<LocalName></LocalName>
<RegionId>cn-hangzhou</RegionId>
</Region>
</Regions>
<RequestId>833C6B2C-E309-45D4-A5C3-03A7A7A48ACF</RequestId>

76

ECS API
</DescribeRegionsResponse>

XML Id LocalName
Format JSON JSON

6.7
ECS
ClientToken
ClientToken
ClientToken 64 ASCII

ClientToken
InstanceId
ClientToken ECS InstanceId
ClientToken ECS
IdempotentParameterMismatch SignatureNonceTimestamp
Signature
ECS SignatureNonce
Timestamp SignatureNonce
Timestamp Signature
500InternetError 503ServiceUnavailable
200
4xx
try it later

API 2013-01-10
2014-3-22

2013-01-24

2013-04-10

2013-01-10

IP

ResetInstance

SnapshotName

GetMonitorData InstanceId

77

ECS API

2013-05-22

2014-04-03

API API

RequestId 2013 7
15 CreateImage/AddDisk
CreateInstance 512M windows
4G 32
DescribeMonitorData InstanceIdTime

78