Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dev-samples opened this issue May 26, 2023 · 1 comment

Comments

@dev-samples
Copy link

dev-samples commented May 26, 2023

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!

@kenkoooo
Copy link

I'm not sure if you're still encountering this issue, but I resolved a similar problem by adding "enableExecuteCommand": true to the service definition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants