I know… not a fix
Allow root login
awsfix ()
{
ip=$1;
pemloc="<loc>"
pubkey="<your pub key>"
ssh -i $pemloc ec2-user@$ip "sudo sed -i \"s,#PermitRootLogin yes,PermitRootLogin yes,g\" /etc/ssh/sshd_config";
ssh -i $pemloc ec2-user@$ip "echo '$pubkey' | sudo tee -a /root/.ssh/authorized_keys";
ssh -i $pemloc ec2-user@$ip "nohup sleep 2; sudo systemctl restart sshd&"
}