I am having a tough time figuring out a way to execute a .sh file present on my local linux machine on to a remote linux machine which happens to be an AWS ec2 instance. Here's what I am doing on my local machine:
ssh -i sample.pem ec2-user@server_name.amazon.com 'bash -s' < file_to_remotely_execute.sh
Error that I get is:
Warning: Identity file sample.pem not accessible: No such file or directory. Pseudo-terminal will not be allocated because stdin is not a terminal. Host key verification failed.
This was referred to arrive at the above approach.