Using Amazon EC2 Instance Connect for SSH access to EC2 instances

Managing and rotating SSH keys may be cumbersome and often leads to security risks. With the launch of EC2 Instance Connect endpoints, it is now easier to connect to EC2 instances via SSH without worrying about SSH keys. The following is required to successfully configure SSH access to EC2 instances via EC2 Instance Connect endpoints.

EC2 Instance Connect Endpoints:

=> Create an EC2 Instance Connect Endpoint - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-ec2-instance-connect-endpoints.html

AWS CLI:

=> Installing or updating the latest version of the AWS CLI - https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

EC2 Instance Connect:

=> Install EC2 Instance Connect on your EC2 instances - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html

Connecting to EC2 Instances:

Once the above requirements are met, an EC2 instance can be accessed via SSH using the EC2 instance connect endpoints with the following command:

$ aws ec2-instance-connect ssh --instance-id i-1234567890example

Troubleshooting: