AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Container for the parameters to the ExecuteCommand operation. Runs a command remotely on a container within a task.
If you use a condition key in your IAM policy to refine the conditions for the policy
statement, for example limit the actions to a specific cluster, you receive an AccessDeniedException
when there is a mismatch between the condition key value and the corresponding parameter
value.
For information about required permissions and considerations, see Using Amazon ECS Exec for debugging in the Amazon ECS Developer Guide.
Namespace: Amazon.ECS.Model
Assembly: AWSSDK.ECS.dll
Version: 3.x.y.z
public class ExecuteCommandRequest : AmazonECSRequest IAmazonWebServiceRequest
The ExecuteCommandRequest type exposes the following members
Name | Description | |
---|---|---|
![]() |
ExecuteCommandRequest() |
Name | Type | Description | |
---|---|---|---|
![]() |
Cluster | System.String |
Gets and sets the property Cluster. The Amazon Resource Name (ARN) or short name of the cluster the task is running in. If you do not specify a cluster, the default cluster is assumed. |
![]() |
Command | System.String |
Gets and sets the property Command. The command to run on the container. |
![]() |
Container | System.String |
Gets and sets the property Container. The name of the container to execute the command on. A container name only needs to be specified for tasks containing multiple containers. |
![]() |
Interactive | System.Boolean |
Gets and sets the property Interactive. Use this flag to run your command in interactive mode. |
![]() |
Task | System.String |
Gets and sets the property Task. The Amazon Resource Name (ARN) or ID of the task the container is part of. |
This example runs an interactive /bin/sh command on a container MyContainer.
var client = new AmazonECSClient(); var response = client.ExecuteCommand(new ExecuteCommandRequest { Cluster = "MyCluster", Command = "/bin/sh", Container = "MyContainer", Interactive = true, Task = "arn:aws:ecs:us-east-1:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE" }); string clusterArn = response.ClusterArn; string containerArn = response.ContainerArn; string containerName = response.ContainerName; bool interactive = response.Interactive; Session session = response.Session; string taskArn = response.TaskArn;
.NET:
Supported in: 8.0 and newer, Core 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5 and newer, 3.5