全部產品
Search
文件中心

Elastic Compute Service:StartInstance

更新時間:Sep 15, 2026

本介面用於啟動一台ECS執行個體,您可以透過指定執行個體ID以及按需設定 InitLocalDisk 等參數啟動執行個體。

介面說明

該介面為非同步介面,執行個體的啟動不是立即完成的,成功呼叫後,執行個體會先進入啟動中(Starting)狀態,您可以呼叫 DescribeInstanceStatus 查看執行個體狀態,當返回的狀態為Running時代表啟動成功。

使用須知

  • 被安全鎖定的執行個體不能透過呼叫該介面啟動。更多資訊,請參閱資源安全鎖定對呼叫 API 的影響。

  • ECS 執行個體狀態必須為已停止(Stopped)。

  • 節省停機模式下可能會因為庫存不足導致啟動失敗。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:StartInstance

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

無 無

請求參數

名稱

類型

必填

描述

樣本值

InstanceId

string

是

指定啟動的執行個體 ID。

i-bp67acfmxazb4p****

InitLocalDisk

boolean

否

當本機磁碟出現故障時,可透過此參數指定啟動執行個體時,是否將執行個體恢復到最初的健康狀態。適用於執行個體規格族 d1、i1 或者 i2 等包含本機磁碟的執行個體。取值範圍:

  • true:將執行個體恢復到最初的健康狀態。

    警告 執行個體原有本機磁碟中的資料將會遺失。

  • false:不做任何處理,維持現狀。

預設值為 false。

true

DryRun

boolean

否

是否只預檢查此次請求。取值範圍:

  • true:僅檢查此次請求,不會啟動執行個體。檢查項目包括 AccessKey 是否有效、RAM 使用者的授權情況和是否填寫了必需參數。如果檢查不通過,則返回對應錯誤。如果檢查通過,會返回錯誤碼 DryRunOperation。

  • false:發送正常請求,請求通過檢查後,返回 2XX 的 HTTP 狀態碼並直接啟動執行個體。

預設值為 false。

true

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

樣本

正常返回樣本

JSON格式

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 LackResource There's no enough resource on the specified capacity reservation.
400 InvalidDedicatedHost.NotEnoughResource The specified dedicated host has not enough resource due to host affinity.
400 InvalidInstance.NotFoundSystemDisk The specified instance does not have system disk.
400 Invalid.PrivatePoolOptions.NoStock The PrivatePool has been used up. 指定的私有集區(彈性保障、資源預訂)容量已經使用完。
500 InstanceNotReady The specified instance is not ready for use.
500 InternalError The request processing has failed due to an internal error and you may retry later or contact support with the request ID.
403 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 InstanceLockedForSecurity The specified operation is denied as your instance is locked for security reasons. 磁碟掛載的執行個體因安全原因被鎖定。
403 InsufficientBalance Your account does not have enough balance.
403 DiskError IncorrectDiskStatus.
403 InstanceExpired The postPaid instance has been expired.Please ensure your account have enough balance. 包年包月執行個體已過期,請您續費後再進行操作。
403 InstanceNotReady The specified instance is not ready for use.
403 DiskInArrears The specified operation is denied as your disk has expired.
403 OperationDenied.SpotPriceLowerThanPublicPrice The spot instance price is lower than public price. 搶占式執行個體的競價價格不能低於公開的價格。
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK needs to be added ECS tag. CMK 需要新增 ECS 標籤。
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
403 InvalidParameter.KMSKeyId.KMSUnauthorized The ECS service is not authorized to access your KMS key. Please grant the ECS service permission to use the key and try again.
403 QuotaExceed.ElasticQuota No additional quota is available for the specified ECS instance type. 您在當前地域選擇的執行個體規格所要建立的台數超出系統限額,或者全執行個體規格 vCPU 配額超出系統限額,您可以前往 ECS 管理主控台或配額中心申請提高限額。
403 OperationDenied.HostRepairing The specified operation is denied as the host of ECS instance is being repaired. ECS 執行個體所在實體機正在維修中,不允許執行指定操作。
403 OperationDenied.NoStock The requested resource is sold out in the specified zone, try other types of resources or other regions and zones. 指定的可用區或叢集中不存在指定磁碟類別,或指定的可用區與叢集不匹配。
403 OperationDenied.KMSKeyUnauthorized The operation is denied due to missing KMS key authorization. Please check the KMS key permissions and ensure the key is properly authorized for this operation.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定的執行個體不存在,請您檢查執行個體 ID 是否正確。
404 InvalidCapacityReservationId.NotFound The specified capacity reservation does not exist.
503 ServiceUnavailable The request has failed due to a temporary failure of the server. 請求後端逾時,請稍後重試。
503 LimitedOperation.ServiceUnavailable The service is currently unavailable. Please try again later. 目前服務不可用。請稍後重試。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。