skip to Main Content

I am following this documentation and I try to ssh to the private ec2. I have created the ec2 connect endpoint and I am able to use to connect from the console.

When using ssh from my mac terminal, I have below message:

ssh -i <key-pair>.pem ec2-user@i-xxxxxxx -o ProxyCommand='aws ec2-instance-connect open-tunnel --instance-id i-xxxxxxx'

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument operation: Invalid choice, valid choices are:

send-ssh-public-key                      | send-serial-console-ssh-public-key      
help                                    

kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

Below is the version of the aws cli I am using:

aws --version
aws-cli/2.11.27 Python/3.11.3 Darwin/22.5.0 exe/x86_64 prompt/off

My vpc endpoint connect endpoint:

ec2 instance connect endpoint

How to fixe the ssh connection ?

2

Answers


  1. It looks like the AWS CLI has not been updated yet. I get the same error following their documentation.

    Login or Signup to reply.
  2. The new EC2 Instance Connect Endpoint feature will be added to AWS CLI v2 once the version 2.12.0 is released, referring to the official change log. I expect the repositories will be updated very soon with the latest version of the AWS CLI.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search