aws start-session end with **Cannot perform start session: EOF**

3k views Asked by At

I try to using Session Manager within my CI (with a vanilla configuration, so nothing too fancy).

All inputs (keys, etc.) and configurations (user/strategy/key) are valid. I succeed to start a session on my own laptop.

But on my pipeline i got the following message

Starting session with SessionId: xxxx-xxxxxxx
$ **Cannot perform start session: EOF**

Is this shell related ?

For reference, tools used on the CI :

  • Session Manager plugin : 1.2.30.0
  • AWS CLI : aws-cli/1.18.223 Python/2.7.17 Linux/5.4.0-1039-azure botocore/1.19.63
2

There are 2 answers

1
Itai Ganot On BEST ANSWER

If you bumped into this error like I did:

Cannot perform start session: EOF

and got here, then using the information from Benjamin Hao's comment, here are the steps I took to make it finally work:

Install expect, in my case I had to install it on the Github hosted runner which is installed with Ubuntu:

apt install -y expect

Then, add "unbuffer" before the command you're trying to execute, for example:

unbuffer aws ecs execute-command --region $REGION --cluster $ecs_cluster_name --task $ecs_task_id --container ops-machine --command 'clitool env start --confirm' --interactive
0
Soberbia On

For aws ssm command i used the AWS-StartInteractiveCommand option in --document-name

aws ssm start-session --document-name 'AWS-StartInteractiveCommand' --parameters '{"command": ["some_command"]}' --target ${ec2_instance_id}

With this, you don't need to install expect