aws / aws/aws-cli

`aws ec2-instance-connect` times out too fast on MacOS

Open
#8,802 2 comments 0 reactions 0 assignees View on GitHub
customization ec2-instance-connect feature-request p2
Dominant language
Python
Stars
17.3k
Forks
4.6k
Avg merge
1d 2h
Merged PRs (30d)
13

Description

### Describe the bug

When I use the `ec2-instance-connect` command, the ssh connection disconnects after 5 second of inactivity.

### Expected Behavior

I expect it to wait for a longer idle time before disconnectcing.

### Current Behavior

The ssh connection times out after 5 seconds of inactivity.

### Reproduction Steps

```
$ aws ec2-instance-connect ssh --instance-id --connection-type eice
, #_
~\_ ####_ Amazon Linux 2023
~~ \_#####\
~~ \###|
~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023
~~ V~' '->
~~~ /
~~._. _/
_/ _/
_/m/'
Last login: Mon Jul 15 19:11:22 2024 from 10.0.2.10
[ec2-user@ip-10-80-195-10 ~]$ Timeout, server 10.80.195.10 not responding.
```

### Possible Solution

There's a configuration for the **ServerAliveInterval** in [ssh.py](https://github.com/aws/aws-cli/blob/3c6bd732b30fcce4223f69b6c2fb1249870c78b8/awscli/customizations/ec2instanceconnect/ssh.py#L326C20-L326C41) for 5 seconds.

My MacOS's **/etc/ssh/ssh_config** file contains the following configuration:

```
ServerAliveCountMax 0
ServerAliveInterval 900
```

The short **ServerAliveInternal** option from the AWS CLI doesn't work too well with MacOS's default `ServerAliveCountMax 0`.

Can we either remove it, or configure the `ServerAliveCountMax` alongside it?

### Additional Information/Context

_No response_

### CLI version used

aws-cli/2.17.13 Python/3.11.9 Darwin/23.5.0 exe/x86_64

### Environment details (OS name and version, etc.)

Sonoma 14.5 (Apple M3 Pro)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.