Sends a remote file to one or more ECS instances.
Operation description
Operation description
The target ECS instances must be in the running state.
Cloud Assistant Agent must be installed on the target ECS instances. For more information, see Cloud Assistant Agent.
- The Cloud Assistant Agent version must be later than the following versions to support file sending. If the
ClientNeedUpgradeerror code is returned, update the agent to the latest version.Linux: 1.0.2.569
Windows: 1.0.0.149
The file content cannot exceed 32 KB after Base64 encoding.
File sending may fail due to exceptions in the target ECS instance status, network issues, or Cloud Assistant Agent exceptions. Call DescribeSendFileResults or refer to Common errors and solutions for execution failures to troubleshoot issues.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:SendFile |
update |
*Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID of the target ECS instances. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| ResourceGroupId |
string |
No |
The ID of the resource group for file sending. If you specify this parameter:
|
rg-bp67acfmxazb4p**** |
| Name |
string |
Yes |
The name of the file. The full character set is supported. The name cannot exceed 255 characters in length. |
file.txt |
| Description |
string |
No |
The description of the file. The full character set is supported. The description cannot exceed 512 characters in length. |
This is a test file. |
| Timeout |
integer |
No |
The timeout period for sending the file. Unit: seconds.
Default value: 60. |
60 |
| TargetDir |
string |
Yes |
The destination directory on the target ECS instances where the file is sent. If the directory does not exist, it is automatically created. The directory path cannot exceed 255 characters in length. |
/home |
| ContentType |
string |
No |
The content type of the file. Valid values:
Default value: PlainText. |
PlainText |
| Content |
string |
Yes |
The content of the file. The file content cannot exceed 32 KB after Base64 encoding.
|
#!/bin/bash echo "Current User is :" echo $(ps | grep "$$" | awk '{print $2}') -------- oss://bucketName/objectName |
| FileOwner |
string |
No |
The owner of the file. This parameter takes effect only on Linux instances. Default value: root. The value cannot exceed 64 characters in length. Note
If you specify a different user, make sure that the user exists on the instance. |
test |
| FileGroup |
string |
No |
The group of the file. This parameter takes effect only on Linux instances. Default value: root. The value cannot exceed 64 characters in length. Note
If you specify a different user group, make sure that the user group exists on the instance. |
test |
| FileMode |
string |
No |
The permissions on the file. This parameter takes effect only on Linux instances. You can configure this parameter in the same way as you run the chmod command. Default value: 0644, which indicates that the owner has read and write permissions, and the group and other users have read-only permissions. |
0644 |
| Overwrite |
boolean |
No |
Specifies whether to overwrite a file with the same name in the destination directory. Valid values:
Default value: false. |
true |
| ClientToken |
string |
No |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but make sure that the token is unique among different requests. ClientToken supports only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
123e4567-e89b-12d3-a456-426655440000 |
| InstanceId |
array |
Yes |
The IDs of the ECS instances to which you want to send the file. You can specify up to 50 instance IDs. Valid values of N: 1 to 50. |
i-bp185dy2o3o6n**** |
|
string |
No |
The IDs of the ECS instances to which you want to send the file. You can specify up to 50 instance IDs. Valid values of N: 1 to 50. |
i-bp185dy2o3o6n**** |
|
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
The tags. |
||
| Key |
string |
No |
The key of the tag for file sending. Valid values of N: 1 to 20. The tag key cannot be an empty string. If you use a single tag to filter resources, the resource count with this tag cannot exceed 1,000. If you use multiple tags to filter resources, the resource count with all the specified tags attached cannot exceed 1,000. If the resource count exceeds 1,000, call ListTagResources to query the resources. The tag key can be up to 64 characters in length and cannot start with |
TestKey |
| Value |
string |
No |
The value of the tag for file sending. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain |
TestValue |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| InvokeId |
string |
The execution ID. |
f-7d2a745b412b46**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"InvokeId": "f-7d2a745b412b46****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | RegionId.ApiNotSupported | The api is not supported in this region. | The API operation cannot be called in the specified region. Check whether the specified RegionId parameter is valid. |
| 400 | MissingParam.InstanceId | The parameter instanceId is missing or empty. | The instance ID is empty. |
| 400 | NumberExceed.Tags | The Tags parameter number is exceed. | The number of tags exceeds the maximum limit. |
| 400 | MissingParameter.TagKey | You must specify Tag.N.Key. | The tag key is not specified. |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The specified tag key already exists. Tag keys must be unique. |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | The specified Tag.N.Key parameter is invalid. |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | The specified tag value is invalid. |
| 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. | The specified FileOwner parameter is invalid. |
| 400 | InvalidParameter.FileGroup | The specified parameter FileGroup is not valid. | The specified FileGroup parameter is invalid. |
| 400 | InvalidClientToken.Malformed | The specified parameter clientToken is not valid. | The specified ClientToken parameter does not meet the format requirements. The parameter must contain only ASCII characters and cannot exceed 64 characters in length. |
| 500 | InternalError.Dispatch | An error occurred when you dispatched the request. | An error occurred while the request is being sent. Try again later. |
| 403 | FileSize.ExceedLimit | The length of file content exceeds limit. | The length of the file content exceeds the upper limit. |
| 403 | FileName.ExceedLimit | The length of file name exceeds limit. | The length of the file name exceeds the upper limit. |
| 403 | FileDesc.ExceedLimit | The length of file description exceeds limit. | The length of the file description exceeds the upper limit. |
| 403 | InstanceIds.ExceedLimit | The number of instance IDs exceeds the upper limit. | The number of specified instance IDs exceeds the upper limit. |
| 403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
| 403 | InvalidTimeout.ExceedLimit | The specified parameter Timeout exceeds the upper limit. | |
| 403 | IdempotentParameterMismatch | The specified parameter has changed while using an already used clientToken. | The specified client token has already been used. |
| 403 | IdempotentProcessing | The previous idempotent request(s) is still processing. | A previous idempotent request is being processed. Try again later. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | Region information error |
| 404 | InvalidInstance.NotFound | The specified instances not found. | The specified instance ID does not exist. |
| 404 | InvalidResourceGroup.NotFound | The ResourceGroup provided does not exist in our records. | The specified resource group does not exist. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.