0

I have released the Elastic IP from my EC2-instance since I was trying to reduce my monthly bills. Now the EC2-instance is not accessible. I am not sure how to fix my EC2-instance.

I am copying and pasting the public IP address into the browser and it does not connect. My FTP is also no longer connecting. The ec2 instance is still "Running" according to AWS, but I am not able to connect to the public IP.

What is the best way to fix this be able to connect via public IP again?

For those users who like me are

I have also tried associating a new elastic IP address to the ec2 instance and that also has not worked

I have tried rebooting the instance

I AM ABLE TO SSH INTO THE INSTANCE. However, the public IP is still not working. Here is my security group:

HTTP TCP 80 0.0.0.0/0 - SSH TCP 22 0.0.0.0/0 - Custom TCP TCP 5901 0.0.0.0/0 - MYSQL/Aurora TCP 3306 XXXXXXXXXXXXX EC2 mysql HTTPS TCP 443 0.0.0.0/0

* SOLVED *

After dissociating the elastic IP, I had to SSH into the instance and restart the server

sudo service httpd start

8
  • To give some more information, the public IP does not seem to be working for the original ec2 after I released the elastic IP. How could I fix this dilemma? Thanks
    – UKtoTaiwan
    Apr 15, 2020 at 11:21
  • Have you tried stooping and starting the server? and what error are you getting with public IP? Apr 15, 2020 at 12:24
  • Does the instance have a Public IP address? Are you connecting via that IP address? What are you trying to do (SSH, web, ...)? Please edit your question to add more details (eg what do you mean by "does not open"). Removing an Elastic IP address has no impact on a server, so the server is probably still running. Apr 15, 2020 at 12:39
  • @saurabh14292 I tried a "Reboot" and it is still not connecting. The problem is that it does not connect to the public IP. I copy and paste the public IP into the browser and it does not connect.
    – UKtoTaiwan
    Apr 16, 2020 at 5:45
  • 1
    Let's start simple.. Is it Linux or Windows? What happens when you try to SSH or RDP into it. You'll need to give us more information than "not accessible". Apr 16, 2020 at 11:51

2 Answers 2

1

Please Note: you actually increase your monthly bill by holding an Elastic IP, but not using it. Using an ElasticIP is free as long as it is in use.

The following applies to Elastic IPs

An Elastic IP address doesn’t incur charges as long as the following conditions are true:

  • The Elastic IP address is associated with an EC2 instance.
  • The instance associated with the Elastic IP address is running.
  • The instance has only one Elastic IP address attached to it.

Note: If the address is from a BYOIP address pool, you're never charged for that address.

You're charged by the hour for each Elastic IP address that doesn't meet these conditions. For pricing information, see Elastic IP Addresses on the Amazon EC2 pricing page.

To fix your instance problem, there is no way for anyone to properly answer your question, because it would assume understanding how the instance was setup to begin with. And when you say "it's not working", does not mean anything sensible.

The approach you should use in the future is to ensure that you setup your infrastructure on AWS (or any other cloud provider) using Infrastructure-as-code, like AWS Cloudformation or Terraform.

Using infrastructure-as-code gives you the benefit of having your infrastructure stored as source-code, and makes it very easy to restore or update setups.

Here are links to AWS CloudFormation and Terraform

1
  • Thank you very much, I will look into these going forward. But for now I am still trying to access my ec2 instance via public IP. I am copying and pasting that IP address into the browser and it does not connect. My FTP is also no longer connecting. The ec2 instance is still "Running", but I am not able to connect to the public IP.
    – UKtoTaiwan
    Apr 16, 2020 at 5:49
0

It appears that your current situation is that you are unable to SSH into your Amazon EC2 Linux instance. Once you are able to do this, it is likely that everything else will be working for you.

Operating System

First, you can confirm that the instance is booting the operating system. In the Amazon EC2 management console, select the instance and then go to Actions / Instance Settings / Get System Log. If the operating system booted correctly, it should display a lot of log information, ending with a login: prompt. If this is not appearing, then something is wrong with the contents of the boot disk and none of the following steps will apply.

Security Group

The most common cause of a "connection time out" is an incorrect configuration of the security groups.

Check the security groups associated with the instance. They should permit Inbound access on port 22 (SSH) either from your IP address or 0.0.0.0/0. For debugging purposes, I recommend temporarily setting this to 0.0.0.0/0 just to eliminate one possible cause of the problem. Then, try to SSH again.

Network

Next, I would suggest testing the network by launching an Amazon EC2 instance in the same subnet. If this works, then we know that the network is setup correctly. The steps are:

  • Launch a new Amazon EC2 Linux instance
  • Choose the same subnet as the original instance
  • Choose Auto-assign Public IP = Enable
  • Leave everything else at the default settings and launch the instance
  • You will need to select a keypair, so make sure it is one for which you have the private half of the keypair

After a few minutes, try to SSH into this new instance.

If you were able to successfully SSH into the new instance, then this indicates that the networking configuration for that subnet is fine.

Worst case

By elimination, the resulting cause of the problem would lie in the system configuration within the instance. Without being able to SSH into the instance, this would be difficult to resolve.

In such a case, it would be necessary to launch a replacement instance. If you wish to recover data from the original instance, this can be done by stopping the original instance, detaching the Amazon EBS boot disk, then attaching it to another instance so that the content can be copied off.

1
  • My recommendation was to launch a new instance using the Amazon Linux 2 AMI (not an AMI of your instance). The intention is to confirm whether the network configuration is correct, not whether the disk image of your instance is correct. By launching an instance using the official Amazon Linux 2 AMI, if there is still a problem then it would be network-related, rather than related to the contents of the instance. If, on the other hand, the new instance works, then we know that the network configuration is okay. Unfortunately, the test you just performed does not help us identify a cause. Apr 18, 2020 at 9:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.