EC2 Instance Connect Endpoint allows you to connect to an instance without requiring the instance to have a public IPv4 address. You can connect to any instances that support TCP.
For more info and its limitations please visit this link.
To create an EC2 instance connect endpoint open VPC service from the management console, select Endpoints then Create endpoint.
Fill in the endpoint name, choose EC2 Instance Connect Endpoint. then select the desired VPC.
you can use the option "Preserve Client IP" if you want the endpoint to use your IP when establishing the connection (for example if you configured the EC2 instance's security group to only accept connections from your IP)
select desired subnet and endpoint security group, no need to open any ports in inbound rules.
then click create endpoint. note that creation will take some time.
To create an EC2 instance, in the management console go to EC2 service. Choose Instances then launch Instances.
fill in the EC2 instance name and choose the AMI
choose the key pair if you want, it is optional. and select the instance type
choose the VPC and subnet (subnet I choose is private). I disabled the auto assign public IP options as I don't need it. Select the security group and make sure the appropriate port is enabled in the inbound rules (22 for linux and port 3389 for windows). If you limited the source connection to your IP, you need to use an endpoint with option "Preserve Client IP" enabled.
My EC2 instance is now created, in a private subnet with no public IP and no key pair, still I can connect to it using the ec2 instance connect endpoint.
In EC2 service page select your instance and click connect
select EC2 Instance Connect, Connect using EC2 Instance Connect Endpoint, choose the end point you created then click connect.
you are now connected to the EC2 instance
To connect using CLI, you have to install AWS CLI first (check this link ) , create an access key (check this link ) and configure CLI using " aws configure "command.
Afer that use the following command to connect to your EC2 instance
" aws ec2-instance-connect ssh --instance-id i-1234567890example --connection-type eice "
replace i-1234567890example with your EC2 instance id
If you face the following error:
aws: error: argument operation: Invalid choice, valid choices are:
send-ssh-public-key | send-serial-console-ssh-public-key help
please update you AWS CLI and the problem will be solved.
Top comments (2)
Bravo
Very Informative