Closed inscapist closed 3 years ago
As a reference, allowing a local only port (not bound to 0.0.0.0) to be accessible locally, using RDS as example:
In the first session, use socat to forward traffic from localhost:5432 to RDS
aws ssm start-session --target i-0d9baeda74bb88366
# within the instance,
sudo socat TCP4-LISTEN:5432,fork TCP4:cms-database.c5k0aeaxnuu7.ap-southeast-1.rds.amazonaws.com:5432
In the second session, run
aws ssm start-session --target i-0d9baeda74bb88366 \
--document-name AWS-StartPortForwardingSession \
--parameters '{"portNumber":["5432"],"localPortNumber":["15432"]}'
GoSSM is a nice project because it adds more ease of use to the project.
However, it currently does not support port tunneling yet.
https://github.com/gjbae1212/gossm