調用SendFile向一台或多台ECS執行個體下發遠程檔案。
介面說明
介面說明
目標 ECS 執行個體的狀態必須為運行中(
Running)。目標 ECS 執行個體必須預先安裝雲助手 Agent。
- 雲助手 Agent 版本需要高於以下對應的版本才能支援下發檔案。如果結果返回
ClientNeedUpgrade錯誤碼,請將用戶端更新至最新版本。Linux:1.0.2.569
Windows:1.0.0.149
檔案內容在進行 Base 64 編碼後,大小不能超過 32 KB。
檔案下發可能會因為目標 ECS 執行個體的狀態異常、網路異常或雲助手 Agent 異常而出現失敗的情況。請調用 DescribeSendFileResults ,或參考執行失敗常見錯誤及修複建議進行問題排查。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ecs:SendFile |
update |
*Instance
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| RegionId |
string |
是 |
目標 ECS 執行個體所在的地區 ID。您可以調用 DescribeRegions 查看最新的阿里雲地區列表。 |
cn-hangzhou |
| ResourceGroupId |
string |
否 |
檔案下發的資源群組 ID,當指定該參數時:
|
rg-bp67acfmxazb4p**** |
| RegionId |
string |
是 |
目標 ECS 執行個體所在的地區 ID。您可以調用 DescribeRegions 查看最新的阿里雲地區列表。 |
cn-hangzhou |
| Name |
string |
是 |
檔案名稱。支援全字元集,長度不得超過 255 個字元。 |
file.txt |
| Description |
string |
否 |
描述資訊。支援全字元集,長度不得超過 512 個字元。 |
This is a test file. |
| Timeout |
integer |
否 |
下發檔案的逾時時間。單位:秒。
預設值為 60。 |
60 |
| TargetDir |
string |
是 |
檔案下發目標 ECS 執行個體中的目錄。如不存在則會自動建立。長度不得超過 255 個字元。 |
/home |
| ContentType |
string |
否 |
檔案內容類型。
預設值為 PlainText。 |
PlainText |
| Content |
string |
是 |
檔案內容。檔案內容在 Base 64 編碼後,大小不能超過 32 KB。
|
#!/bin/bash echo "Current User is :" echo $(ps | grep "$$" | awk '{print $2}') -------- oss://bucketName/objectName |
| FileOwner |
string |
否 |
檔案的使用者。只對 Linux 執行個體生效,預設為 root。長度不得超過 64 個字元。 說明
使用其他使用者時,請確保執行個體中存在該使用者。 |
test |
| FileGroup |
string |
否 |
檔案的使用者組。只對 Linux 執行個體生效,預設為 root。長度不得超過 64 個字元。 說明
使用其他使用者組時,請確保執行個體中存在該使用者組。 |
test |
| FileMode |
string |
否 |
檔案的許可權。只對 Linux 執行個體生效,設定方式與 chmod 命令相同。 預設值為 0644,表示使用者具有讀寫權限,使用者組和其它使用者具有隻讀許可權。 |
0644 |
| Overwrite |
boolean |
否 |
如果同名檔案在目標目錄已存在,是否覆蓋檔案。
預設值為 false。 |
true |
| ClientToken |
string |
否 |
保證請求等冪性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證等冪性。 |
123e4567-e89b-12d3-a456-426655440000 |
| InstanceId |
array |
是 |
需要執行命令的 ECS 執行個體列表。最多能指定 50 台 ECS 執行個體 ID。N 的取值範圍為 1~50。 |
i-bp185dy2o3o6n**** |
|
string |
否 |
需要執行命令的 ECS 執行個體列表。最多能指定 50 台 ECS 執行個體 ID。N 的取值範圍為 1~50。 |
i-bp185dy2o3o6n**** |
|
| Tag |
array<object> |
否 |
標籤列表。 |
|
|
object |
否 |
標籤列表。 |
||
| Key |
string |
否 |
檔案下發的標籤鍵。N 的取值範圍為 1~20。一旦傳入該值,則不允許為空白字串。 使用一個標籤過濾資源,查詢到該標籤下的資源數量不能超過 1000 個。使用多個標籤過濾資源,查詢到同時綁定了多個標籤的資源數量不能超過 1000 個。如果資源數量超過 1000 個,您需要使用 ListTagResources 介面進行查詢。 最多支援 64 個字元,不能以 |
TestKey |
| Value |
string |
否 |
檔案下發的標籤值。N 的取值範圍為 1~20。該值可以為空白字串。 最多支援 128 個字元,不能包含 |
TestValue |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| InvokeId |
string |
命令執行 ID。 |
f-7d2a745b412b46**** |
| RequestId |
string |
請求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
樣本
正常返回樣本
JSON格式
{
"InvokeId": "f-7d2a745b412b46****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | RegionId.ApiNotSupported | The api is not supported in this region. | 指定地區下不支援調用 API。請檢查 RegionId 參數取值是否正確。 |
| 400 | MissingParam.InstanceId | The parameter instanceId is missing or empty. | 執行個體ID為空白。 |
| 400 | NumberExceed.Tags | The Tags parameter number is exceed. | 標籤個數超過最大限制。 |
| 400 | MissingParameter.TagKey | You must specify Tag.N.Key. | 請指定標籤鍵。 |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | 標籤中存在重複的鍵,請保持鍵的唯一性。 |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | 指定的標籤鍵參數有誤。 |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | 指定的標籤值參數有誤。 |
| 400 | FileTargetDir.Invalid | The target directory of file is invalid. | |
| 400 | FileMode.Invalid | The mode of file is invalid. | |
| 400 | FileContent.DecodeError | The Content can not be base64 decoded. | |
| 400 | FileContentType.Invalid | The ContentType of file is invalid. | |
| 400 | InvalidParameter.FileOwner | The specified parameter FileOwner is not valid. | 指定的參數FileOwner不合法。 |
| 400 | InvalidParameter.FileGroup | The specified parameter FileGroup is not valid. | 指定的參數FileGroup不合法。 |
| 400 | InvalidClientToken.Malformed | The specified parameter clientToken is not valid. | 指定的等冪參數不合法。 |
| 500 | InternalError.Dispatch | An error occurred when you dispatched the request. | 發送請求時發生錯誤,請稍後重試。 |
| 403 | FileSize.ExceedLimit | The length of file content exceeds limit. | 檔案內容長度超過上限。 |
| 403 | FileName.ExceedLimit | The length of file name exceeds limit. | 檔案名稱長度超過上限。 |
| 403 | FileDesc.ExceedLimit | The length of file description exceeds limit. | 檔案描述長度超過上限。 |
| 403 | InstanceIds.ExceedLimit | The number of instance IDs exceeds the upper limit. | 目標執行個體數量超過上限。 |
| 403 | Operation.Forbidden | The operation is not permitted. | 該操作是不被允許的。 |
| 403 | InvalidTimeout.ExceedLimit | The specified parameter Timeout exceeds the upper limit. | |
| 403 | IdempotentParameterMismatch | The specified parameter has changed while using an already used clientToken. | 指定的客戶令牌已經被使用。 |
| 403 | IdempotentProcessing | The previous idempotent request(s) is still processing. | 先前的等冪請求仍在處理中,請稍後重試。 |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | 地區資訊錯誤 |
| 404 | InvalidInstance.NotFound | The specified instances not found. | 指定的執行個體ID不存在。 |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | 資源群組並不在記錄中。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。