Avatar of VH
VH
 asked on

ssh-copy-id to AWS

Hi,

I am trying to use my on-premise Server to manage AWS instances via Ansible.

I have a few play-books to install services on EC2 Instances. I tried to create an ssh-keygen with a sudo that I created on the on-premise server and on the AWS instance, I tried to copy the newly created public key to AWS but keep getting Permission denied (public key)
AWS* ansbile

Avatar of undefined
Last Comment
VH

8/22/2022 - Mon
David Favor

When you spin up an EC2 instance, you'll be provided with a private key, which you must save for future use.

You'll have to use this key when you run ssh-copy-id, so if you missed saving the key you're out of luck.

At least this use to be the way this worked.

If you use your own custom image, with a public key you embed yourself in the instance, then you should be able to use the related private key.

To access any sshd instance, you'll require a valid key or passphrase, if your image allows keyless passphrase access.
ASKER CERTIFIED SOLUTION
VH

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
VH

ASKER
I am able to push Ansible Comments by doing the work this way
Your help has saved me hundreds of hours of internet surfing.
fblack61