You should put the keypair file inside your home-directory/.ssh. If the directory does not exist, then create one. Also, after you create the file you will have to change the permissions to make it readable only for the users. Then open your terminal and type this command:
chmod 600 $HOME/.ssh/your-keypair-file
This will limit access to the file
chmod 700 $HOME/.ssh
This will limit access to the folder
OpenSSH protocol will not allow you to use a key which can be viewed by everyone. That is why we have to do the above steps.
Enter the below command to log on to your terminal:
ssh -i $HOME/.ssh/<your keypair file> [email protected]<ec2-hostname>