5: Copy your SSH public key to your EC2 node
$ scp -i ~/my-ec2-keypair ~/.ssh/id_rsa.pub root@ec2-xxx-xxx-xxx-
xxx.compute-1.amazonaws.com:/root/.ssh/authorized_keys2
NOTE the filename authorized_keys2 – not authorized_keys!!
How can I copy my public key to EC2? when i tried to run command i
also get "Please login as the ec2-user user rather than root user."
5: Copy your SSH public key to your EC2 node
$ scp -i ~/my-ec2-keypair ~/.ssh/id_rsa.pub root@ec2-xxx-xxx-xxx-
xxx.compute-1.amazonaws.com:/root/.ssh/authorized_keys2
NOTE the filename authorized_keys2 – not authorized_keys!!
How can I copy my public key to EC2? when i tried to run command i
also get "Please login as the ec2-user user rather than root user."
If you're using the amazon Linux AMIs (the default) then ssh access for root is turned off. I don't know why those instructions tell you to do everything as root - there's really no reason to. I just use the default ec2-user for stuff that doesn't need special privileges