How to change EC2 Keypair after launching an instance

Sometimes an EC2 instance will be launched via AWS without the Turbot keypair. Due to this, Turbot is unable to SSH into the instance and make configuration changes set by various policies set within Turbot. 

Running EC2 instances cannot have their keypair changed while running, so a bit of a workaround is required. 

  1. Login and add Turbot Public Key to the default user (e.g. ec2_user, ubuntu, root) on the instance
  2. Stop Instance
  3. Launch New Instance with Turbot Key Pair
  4. Stop New Instance and Detach its EBS root Volume
  5. Detach Root EBS Volume from the original Instance and reattach it to the new instance
  6. Restart the instance

If the previous steps either do not work or are not feasible, the other option is to terminate and re-launch the EC2 instance, this time verifying that it is launching with the appropriate Turbot key pair.

If issues persist, do not hesitate to reach out for support at

Was this article helpful?
0 out of 0 found this helpful