Skip to content

Access private ECS task through SSM Session Manager port forwarding

License

Notifications You must be signed in to change notification settings

patheard/aws-ecs-port-forward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS ECS task connect with SSM port forwarding

Connect to a private ECS test using SSM Session Manager port forwarding.

Requirements

Connect

aws ssm start-session \
    --target ecs:<CLUSTER>_<TASK ID>_<CONTAINER_RUNTIME_ID> \
    --document-name AWS-StartPortForwardingSession \
    --parameters '{"portNumber":["80"], "localPortNumber":["1338"]}' \
    --region ca-central-1

# Example
aws ssm start-session \
    --target ecs:internal_ad87713568a9469b8bb056780a2e1ffd_ad87713568a9469b8bb056780a2e1ffd-3386804179 \
    --document-name AWS-StartPortForwardingSession \
    --parameters '{"portNumber":["80"], "localPortNumber":["1338"]}' \
    --region ca-central-1

Credit

Most of this is taken from @mohamed-cds's example, with the addition of:

  • using only VPC PrivateLinks to run the ECS task; and
  • removing the ingress on port 80.

About

Access private ECS task through SSM Session Manager port forwarding

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published