0

I have created AWS VPC . In that VPC 5 ec2 instances are created, ONLY 1 Instance is publicly accessible other 4 instances are in private network.

i am using script to transfer war file from my local machine to Pubilcly accessible server and then it will transfer to private server .

I am using same pem file all server , so during scp command it will transfer war file from local machine to publicly accessible server but it will failed to transfer war file from publicly accessible to Private server .

It gives the error:

Host key verification failed!

Script commands :

  1. Transferring from Local machine to publicly accessible server.

    scp -p portno -i ./Test.pem ./Test.war ec2-user@publicly_accessible_server_ ip:/home/ec2-user/    
    

Working fine It will transfer local to publicly accessible server.

  1. Transferring from publicly accessible server to Private Server.

     ssh -p portno -i ./Test.pem ec2-user@**publicly accessible server ip** "scp -P portno -i /opt/IdentityFiles/Test.pem /home/ec2-user/Test.war ec2-user@**private_server_ip**:/home/ec2-user/"
    

Not able send war files from publicly accessible server to private server gives error Host verification failed**

permission pem file are working .

Note :suppose i run the second command from terminal it works , but in script it is not working !

  • Looks like a duplicate of: [How to scp with a second remote host Ask](https://stackoverflow.com/questions/9139417/how-to-scp-with-a-second-remote-host) – Raf May 26 '17 at 08:13
  • Possible duplicate of [How to scp with a second remote host](https://stackoverflow.com/questions/9139417/how-to-scp-with-a-second-remote-host) – Jakuje May 26 '17 at 08:36
  • A better architecture pattern is to upload the war file to S3 and access it via the AWS S3 command line, that way you have no need for a public server and can control access to the S3 bucket via IAM roles and policies. – strongjz May 26 '17 at 23:35

0 Answers0