我的 java 应用程序在 AWS ECS 容器中运行,8000 作为公开端口
我的 ECS 在私有子网下运行
我想通过会话管理器连接到我的 ECS,如下所示:
aws ssm start-session --target My-ECS-Instance-ID --document-name AWS-StartPortForwardingSession --parameters '{"portNumber":["8000"], "localPortNumber":["8000"]}' --region My-Region
Run Code Online (Sandbox Code Playgroud)
连接似乎建立起来没有任何问题:
Starting session with SessionId: botocore-session-1******-09cf*********8
Port 8000 opened for sessionId botocore-session-1******-09cf*********8.
Run Code Online (Sandbox Code Playgroud)
但不幸的是,当我卷曲这个网址时:
curl -X GET "http://localhost:8000/api/user/9"
Run Code Online (Sandbox Code Playgroud)
它生成以下输出:
卷曲:(52)服务器的空回复