title: How to run a script on your aws-ec2 from a script on your local machine?
body: <p>I have a script on my local machine which helps me to connect to my <strong>ec2</strong>. But, it does not runs the script file specified.</p>
  
  <p>awsconnect.sh:</p>
  
  <pre><code>ssh -i ".pemfile" ubuntu@"ec2-instance"
  
  
    ./data.sh
  </code></pre>
  
  <p><code>data.sh</code> is my file on the <strong>aws-ec2</strong>.</p>
  
  <p>data.sh:</p>
  
  <pre><code> mkdir -p dumps/$(date +"%Y%m%d");
      mysqldump -h localhost -port=3306 -u root -proot abc | gzip &gt; dumps/$(date +"%Y%m%d")/abc.sql.gz;
      logout
  </code></pre>
  
  <p>My <code>data.sh</code> file is running fine if i run it from <strong>aws-ec2</strong> command line.
  But, it is not running from my script file.
  What is the problem?</p>