Public and Private Keys for AWS Users
Create a normal user in AWS
sudo adduser username
sudo usermod --groups sudo --append username
root ALL=(ALL) ALL
username ALL=(ALL) NOPASSWD:ALL
%wheel ALL=(ALL) NOPASSWD:ALL
%sudo ALL=(ALL) NOPASSWD:ALL
cd /home/username
ssh-keygen - b 4096 -f username -t rsa
mkdir .ssh
chmod 700 .ssh
sudo cat username.pub >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys
sudo chown username:centos .ssh
sudo chown username:centos .ssh/authorized_keys
sudo cp username /home/centos
sudo rsync -avr username /home/centos
sudo chmod 777 /home/centos/username
scp -i /home/gautamthakur/Download/gautam-demo.pem centos@aws-public-ip:/home/centos/username username
chmod 400 username
sudo ssh -i private_key_just_created username@you_aws_public_ip
This key that you have created, you can now give that ti the person that you want to access your instance
If you added a password on your key like in demo, you would also need to give your user that password as well.