Skip to content

ECS Exec - reference task by task arn rather than ID #10057

@ecandostuff

Description

@ecandostuff

Describe the bug

In the ecs exec docs, it shows I can reference a task either by ID or by task arn. At the bottom of the docs, it then goes on to provide a sample command which references the task by it's full arn.

However, when I try to reference a task by arn (which I need to do based on how resources are formatted in my organization's IAM policies), I get the following error:
An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: task length should be one of [32,36]

The command works fine with the task ID, but then it references the task in the format arn:aws:ecs:{region}:{acc-number}:task/{id} rather than including the cluster name in the middle like we would expect and shows in the arn in the console. This leads to the resulting resource name not aligning with the expectation for resource naming in my org's IAM policies.

Regardless of the issue in the paragraph above, the docs reflect that you can reference task by either arn or ID. If you aren't going to support arn as a way to reference a task, remove it from the docs.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I can run the aws ecs execute-command function with a task arn rather than task id

Current Behavior

I get an error An error occurred (InvalidParameterException) when calling the ExecuteCommand operation: task length should be one of [32,36] when I try to run the aws ecs execute-command function with a task arn rather than task id

Reproduction Steps

Run this command from the ecs exec docs:

aws ecs execute-command
--cluster MyCluster
--task arn:aws:ecs:us-east-1:123456789012:task/MyCluster/d789e94343414c25b9f6bd59eEXAMPLE
--container MyContainer
--interactive
--command "/bin/sh"

Possible Solution

remove whatever length validation has been put in place on the task attribute for the ecs execute-command function

Additional Information/Context

No response

CLI version used

2.33.15

Environment details (OS name and version, etc.)

MacOS

Metadata

Metadata

Assignees

Labels

ecsp3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.service-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions