Im unable to start a Port Forwarding Session To Remote Host (or simply remote session) on a fargate ecs container, yet can do so on an instance. Using AWS console (thats the website based and not shell based) I cant seem to figure out what settings are needed.
Working (instance remote session):
aws ssm start-session
--target i-{instance}
--region {region}
--profile {profile}
--document-name AWS-StartPortForwardingSessionToRemoteHost
--parameters '{"portNumber":["22"],"localPortNumber":["9999"],"host":["{host}"]}'
Not working the same on on a conatiner:
aws ssm start-session
--target ecs:{clusterName}_{taskId}_{containerRuntimeId}
--region {region}
--profile {profile}
--document-name AWS-StartPortForwardingSessionToRemoteHost
--parameters '{"portNumber":["22"],"localPortNumber":["9999"],"host":["{host}"]}'
Any idea?
I even created a iam policy and attached to the iam roles that run the specific service and tasks inside ecs cluster.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:StartSession",
"ecs:ExecuteCommand"
],
"Resource": [
"arn:aws:ecs:blablabla:cluster/{myCluster}",
"arn:aws:ssm:blablabla::document/AWS-StartInteractiveCommand",
"arn:aws:ssm:blablabla::document/AWS-StartPortForwardingSession",
"arn:aws:ssm:blablabla::document/AWS-StartPortForwardingSessionToRemoteHost"
]
}
]
}