Access EC2 Instance Without Public IP

amazon-web-services

I have two EC2 instances, one with a public IPv4 Public IP and one without one. I have the passwords for both and can successfully log into one (with the IPv4 Public IP), but am unable to access the other. I am assuming that the one without the IPv4 Public IP needs a public IP, but it looks like I won't be able to create one. When I try to RDP into this machine, I get the error with the message:

Remote access to the server is not enabled. The remote computer is
turned off. The remote computer is not available on the network.

Here are the steps I've tried for remoting into this machine:

  1. I do have a VPC for this EC2 and I verified that it's open to all outside access for port 3389 (RDP port).
  2. My client machine can access RDP successfully, as it can log into the other EC2 instance.
  3. When I look at the instance – and I am just guessing here that this is where the problem is – these differ from the instance I can access:

Public DNS (IPv4)

IPv4 Public IP [the accessible machine has this set, the unaccessible does not]

IPv6 IPs

Private DNS [details filled]

Private IPs [details filled]

  1. I don't see a DNS name for this machine listed, as an alternative to the IP. When I try launch it by clicking on the instance, clicking connect, and downloading the RDP file, the IP address it tries to connect to is the Private IPs. I also tried connecting to the Private DNS – which RDP throws an error that it can't find that computer.
  2. If I click on the instance, click Actions and Select Manage IP Addresses, I do not see any public IP listed. Again, the other machine has one.
  3. I've also verified some of the steps here.

In this situation, (a) how can I access this EC2 instance through RDP, and (b) (or – if this is the only thing that's necessary) how could I assign a public IP address in this situation. If the latter is not possible, will it even be possible to access the machine – it seems odd that AWS would allow someone to create a machine they couldn't access.

Best Answer

This happens because it doesn't have an elastic IP associated so it can only be accessed from inside the VPC using the internal IP.

I can think of three options to solve this.

Option 1:

Assign an Elastic IP to the instance.

Go into the EC2 dashboard, then in the NETWORK & SECURITY menu go to Elastic IPs.

Click on Allocate a new address.

Right click on the new IP and select Associate address.

Associate it with your EC2 instance that doesn't have an elastic IP.

Now you can try to connect to the instance again and the RDP IP will be the elastic one instead of the VPC private one.

Option 2:

If you need this EC2 instance to stay disconnected from the internet, you can connect from another EC2 instance inside the same VPC using the private IP with a RDP compatible software.

Option 3:

Go to the VPC dashboard, then to VPN Connections, Create a VPN Connection and connect to it to be able to RDP into the EC2 instance using the private IP.