1

I'm trying to setup EC2 Instance Connect to RDP to a Windows server.

I'm running the command like so...

aws ec2-instance-connect open-tunnel \
    --instance-id <my-instance-id> \
    --remote-port 3389 \
    --local-port 33389

The command immediately exits, displaying only...

'VpcId'

No other errors are shown. I don't even know where to start to debug this. The response is meaningless.

I've confirmed that the cli is connecting to the correct AWS account. As far as I can see the IAM user has the correct permissions.

The Instance Connect endpoint works from the AWS console.

My aws cli version is...

aws-cli/2.17.20 Python/3.11.9 Linux/5.15.153.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22

I've tried running the cli command with the --debug option. This is the final part of the output...

2024-10-26 18:43:38,958 - MainThread - botocore.hooks - DEBUG - Event needs-retry.ec2.DescribeInstances: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x7f621f340290>>
2024-10-26 18:43:38,958 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2024-10-26 18:43:38,958 - MainThread - botocore.hooks - DEBUG - Event after-call.ec2.DescribeInstances: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x7f6221583b50>>
2024-10-26 18:43:38,958 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "awscli/clidriver.py", line 499, in main
  File "awscli/clidriver.py", line 634, in __call__
  File "awscli/customizations/commands.py", line 206, in __call__
  File "awscli/customizations/ec2instanceconnect/opentunnel.py", line 111, in _run_main
KeyError: 'VpcId'

'VpcId'

1 Answers1

0

I found the problem. The instance had been terminated. I'd copied the wrong Id ‍♂️

Anyway I'll leave this, just in case it's helpful for anyone else. The error was very confusing.