Skip to content

Execute Command

ecs_execute_command R Documentation

Runs a command remotely on a container within a task

Description

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.

Usage

ecs_execute_command(cluster, container, command, interactive, task)

Arguments

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.

container

The name of the container to execute the command on. A container name only needs to be specified for tasks containing multiple containers.

command

[required] The command to run on the container.

interactive

[required] Use this flag to run your command in interactive mode.

task

[required] The Amazon Resource Name (ARN) or ID of the task the container is part of.

Value

A list with the following syntax:

list(
  clusterArn = "string",
  containerArn = "string",
  containerName = "string",
  interactive = TRUE|FALSE,
  session = list(
    sessionId = "string",
    streamUrl = "string",
    tokenValue = "string"
  ),
  taskArn = "string"
)

Request syntax

svc$execute_command(
  cluster = "string",
  container = "string",
  command = "string",
  interactive = TRUE|FALSE,
  task = "string"
)