ssh-copy-id to AWS


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)
Who is Participating?
VHConnect With a Mentor Author Commented:
That Didn't Work the way around this was to do a ssh add << You PEM Key>>.pem  which allows me to push Ansible comments to an AWS Instance,

Other then that Create Ansible Playbooks add them to S3 install Ansible on the EC2 Instance create a CRON Job to check the S3 Bucket every hour or so,
David FavorLinux/LXD/WordPress/Hosting SavantCommented:
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.
VHAuthor Commented:
I am able to push Ansible Comments by doing the work this way
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.