5

I have an EC2 micro instance that has been running for years. I can still SSH into it, but I've completely forgotten the email address I used to create it.

I had been moving from email to email every year to say in the free tier until amazon made the free tier permanent. As a result, the ec2 is not tied to my main email addresses, and must have been registered under one specifically made for this purpose. Unfortunately I do not remember it.

Given that I can still SSH to the instance, how can I recover the email address so I can log into Admin console and deprovision this instance so it's not running forever?

  • 1
    The free tier isn't permanent, most of it lasts only a year. There are some "always free" tiers, but not EC2. Does "uname -a" give you any hints? Otherwise you might try asking AWS support. Phrase it as a billing question otherwise they don't provide support on the free tier. "What email address is the bill for this instance associated with". You may have to do it from a new account since you don't know what account to use, and they'll make you jump through hoops to prove you own the other account. Suggest you use a password manager and record all AWS accout details. KeePass for example. – Tim Jan 18 '19 at 17:28

2 Answers2

3

Since you've got access to the instance you can simply shut it down - problem (almost) solved as shut down instances don't cost money.

[ec2-user@i-1234.... ~]$ sudo poweroff

You'll still have the disk (EBS volume) left behind - the cost is $0.10/GB/month and you pay for it even if the instance if stopped.


Before you shut it down find out what's the account id and instance id and record it for later:

[ec2-user@i-1234.... ~]$ curl http://169.254.169.254/latest/meta-data/iam/info
{
  "Code" : "Success",
  "LastUpdated" : "2019-01-18T20:30:58Z",
  "InstanceProfileArn" : "arn:aws:iam::123456789012:instance-profile/...",
  "InstanceProfileId" : "AIPA..."
}

That 123456789012 in InstanceProfileArn is the AWS Account Id. You may need to that to find out the email address through AWS support.

Also record the Instance Id just in case:

[ec2-user@i-1234.... ~]$ curl http://169.254.169.254/latest/meta-data/instance-id
i-abcd1234abcd1234

Be prepared that it will be a struggle to get AWS to close or restore your access to that account. They are very difficult in these cases.

It may actually be much easier to get your credit card cancelled and let AWS close it for non-payment ;)

Hope that helps!

MLu
  • 23,798
  • 5
  • 54
  • 81
  • I log in as the basic ubuntu user. None of the iam/ resources are available in my instance for some reason, and most of the aws cli commands fail with a demand to run aws configure. I was able to find out the account id through a different service, but when I try to log in with that ID it asks me for an IAM user name. I definitely never set up an IAM user, so the username would have to be the root user name, if there is one, or the email address itself which puts me back at ground zero. On the plus side, there is no credit card on that account - this was all before that was required. – LostEC2Instance Jan 20 '19 at 21:22
3

You will have to submit a support request through AWS Contact Us page. Open the I cannot login to my AWS Account and then Lost account information.

AWS Contact Us

Hope that helps :)

MLu
  • 23,798
  • 5
  • 54
  • 81