To connect to an EC2 instance over SSH, if the permissions on your .pem file are too broad then you’ll see this error:
Permissions 0644 for ‘keypair.pem’ are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
chmod the .pem file to 0400 and then you should be good. This is described here.