[ECS] [request]: Access to container ports via SSM or ECS Exec
- Dominant language
- Shell
- Stars
- 5.4k
- Forks
- 334
- PR merge metrics
- No merged PRs in 30d
Description
### Community Note
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment
**Tell us about your request**
A simple way to access ports on a specific container instance in an ECS service/task.
**Which service(s) is this request for?**
ECS
**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
Mainly for debugging purposes, I would like to forward a port from a specific container instance to my local machine. As I understand it, the only way to do this is by using ECS Exec (or connecting to the container instance directly and using `docker exec`) to start an interactive session, then connecting to `localhost` from inside the container. Alternatively, the below workaround also seems to work:
**Are you currently working around this issue?**
It is seemingly possible to forward a port from an ECS container using the `AWS-StartPortForwardingSession` SSM Document, by passing the ECS container details to the `target` parameter. I may have missed it but can't see this documented anywhere, so I'm hesitant to rely on it:
```
aws ssm start-session --document-name AWS-StartPortForwardingSession --target "ecs:${CLUSTER_NAME}_${TASK_ID}_${CONTAINER_RUNTIME_ID}" --parameters '{"portNumber":["1234"],"localPortNumber":["1234"]}'
```
**Additional context**
None
**Attachments**
None
Contributor guide
Research direction
Start by investigating the documented ECS Exec and AWS-StartPortForwardingSession paths, using the command and ECS cluster, task, and container runtime details in the issue. Determine whether port forwarding from a specific ECS container to a local machine is supported and what documentation or service behavior would need to change; done means the supported workflow is clearly documented or the request is scoped for implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100