-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ECS Exec - reference task by task arn rather than ID #10057
Copy link
Copy link
Closed as not planned
Labels
closing-soonThis issue will automatically close in 4 days unless further comments are made.This issue will automatically close in 4 days unless further comments are made.ecsp3This is a minor priority issueThis is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.Waiting 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.This issue is due to a problem in a service API, not the SDK implementation.
Metadata
Metadata
Assignees
Labels
closing-soonThis issue will automatically close in 4 days unless further comments are made.This issue will automatically close in 4 days unless further comments are made.ecsp3This is a minor priority issueThis is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.Waiting 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.This issue is due to a problem in a service API, not the SDK implementation.
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
Expected Behavior
I can run the
aws ecs execute-commandfunction with a task arn rather than task idCurrent 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 theaws ecs execute-commandfunction with a task arn rather than task idReproduction 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