AWS

Solution : "An error occurred (TargetNotConnected) when calling the StartSession operation: {instance-id} is not connected."

RyanGomdoriPooh 2022. 1. 20. 11:53

I have a problem accessing Instance through Session Manager in AWS.

That message is "An error occurred (TargetNotConnected) when calling the StartSession operation: {instance-id} is not connected.".

In this post, We deal with how to solve this problem.

We entered a command similar to the command below at the local terminal of Mac.

aws ssm start-session --target i-123456 --document-name AWS-StartSSHSession --parameters 'portNumber=8373'

We got this error message.

An error occurred (TargetNotConnected) when calling the StartSession operation: i-123456 is not connected.

It has two solutions about the error mentioned above.

 

Eventually, Solutions has common reason. Link

 

First of all, We have to check settings for "Session Manager".

 

Let's check steps of solution.

 

1. Check instance settings of "Session Manager" to be connected.

Ref) Settings of Session Manager

 

2. Check instance settings of "Session Manager" to connect.

Ref) Settings of CLI

Ref) Region name

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json

And then, try again this command.

aws ssm start-session --target i-123456 --document-name AWS-StartSSHSession --parameters 'portNumber=8373'

 

From now, We can access instance using by Session Manager.