it is required that your private key files are not accessible by others. aws code example
Example 1: change permissions pem
chmod 400 key.pem
Example 2: pem key permissions too open
chmod 400 mykey.pem
chmod 400 key.pem
chmod 400 mykey.pem