Certified Security - Specialty

Sign Up Free or Log In to participate!

How can I create a “clean” EC2 AMI with no pre-existing ssh keys?

If taking an AMI image of an EC2 instance is going to preserve existing ssh public keys for all ssh users, how would i create an AMI image with no pre-existing keys?  Would I have to use password login?  Would then AMI image then have a user with password login?

1 Answers

Hi.

While you are logged in you can remove the public keys that are there.

Have you seen this guide? It provides some helpful instructions on how to clean up a machine before creating the AMI.

 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/building-shared-amis.html

When you launch a new instance using the AMI, AWS will append the ec2 key pair public key you selected to the list of authorised keys on the new instance.

Chatz

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?