AWS connect to an EC2 serial console via aws cli

To connect to the serial console of an EC2 instance, you can use the aws cli.

  1. Add your public ssh key to the serial console connector
aws ec2-instance-connect send-serial-console-ssh-public-key \
  --instance-id <instance-id> \
  --serial-port 0 \
  --ssh-public-key file:///home/foo/.ssh/my_key.pub \
  1. Connect to the serial console
ssh <instance-id>.port0@serial-console.ec2-instance-connect.<region>.aws

Keep in mind, the SSH Key is only valid for a short time. You can still only have 1 serial connection. If you have the console opened in the browser, you have to close it first.

Kim Klotz