Here you will find several methods to access your EC2 if you lost you SSH key

If the instance is EBS backed:

  • Stop the instance, detach the root volume
  • Attach the root volume to another instance as a data volume
  • Modify the ~/.ssh/authorized_keys file with your new key
  • Move the the volume back to the stopped instance
  • Start the instance and you can SSH into it again

If the instance is EBS (new method ๐Ÿง™):

Instance Store backed EC2:

  • You cannot stop the instance (otherwise data is lost) - AWS recommends termination
  • Use Session Manager access and edit the ~/.ssh/authorized_keys file directly

references