aws/session-manager-plugin

An error occurred (TargetNotConnected) when calling the ...is not connected.

dev-samples opened this issue · 1 comments

Based on:
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html

In am trying to connect to a container running in a Fargate task using the session manager from my local machine (Mac M1).

I have installed:

curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/mac_arm64/session-manager-plugin.pkg" -o "session-manager-plugin.pkg"
sudo installer -pkg session-manager-plugin.pkg -target /
sudo ln -s /usr/local/sessionmanagerplugin/bin/session-manager-plugin /usr/local/bin/session-manager-plugin

And based on:
https://stackoverflow.com/a/67641633/363603

I am trying to start it with:

# ecs:<cluster-name>_<task-id>_<container-runtime_id>
aws ssm start-session --target ecs:sample-cluster_efe***9e0_efe***536

but get:

An error occurred (TargetNotConnected) when calling the StartSession operation: ecs:sample-cluster_ef***a9e0_efe**536 is not connected.

I also tried to add:

        {
            "Effect": "Allow",
            "Action": [
                "ssmmessages:CreateControlChannel",
                "ssmmessages:CreateDataChannel",
                "ssmmessages:OpenControlChannel",
                "ssmmessages:OpenDataChannel"
            ],
            "Resource": "*"
        }

to the Fargate task IAM role but besides from that I have not done anything special to on my Fargate task so most likely I am missing some config from:
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-prerequisites.html

but any input is appreciated!