I'm trying to connect to AWS instance through terminal using SSH with the public IP address and I keep getting:
Warning: Identity file .cer not accessible: No such file or directory. ubuntu@XXXXXXXX.us-east-2.compute.amazonaws.com: Permission denied (publickey).
I'm running this script to remote in, hosts.txt contains the IP address
#!/bin/bash
while read HOST INSTANCE_KEY;
do
if ssh -i $INSTANCE_KEY.cer ubuntu@$HOST '
STATUS=`/opt/agent.sh status | awk 'NR==1{print $3 $4}'`
[ "$STATUS" = "isrunning" ]
'; then
echo "$HOST == FAIL"
else
echo "$HOST == PASS"
fi
done < hosts.txt
I'm need to SSH to public IP Address using the Authentication Key received from AWS