title: mvn deploy to AWS (ssh via distributionManagement)
body: <p>I am working on deploying the WAR file to AWS using Maven. I am planning to use 'mvn deploy' for the same which would ssh the war file to AWS.
  I am following <a href="http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html" rel="nofollow">http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploy-ssh-external.html</a>. </p>
  
  <p>This is my POM file</p>
  
  <pre><code>&lt;project&gt;
    ...
    &lt;distributionManagement&gt;
      &lt;repository&gt;
        &lt;id&gt;ssh-aws&lt;/id&gt;
        &lt;url&gt;scpexe://&lt;ec2 instance&gt;.compute-1.amazonaws.com&lt;/url&gt;
      &lt;/repository&gt;
    &lt;/distributionManagement&gt;
  
    &lt;build&gt;
      &lt;extensions&gt;
        &lt;!-- Enabling the use of FTP --&gt;
        &lt;extension&gt;
          &lt;groupId&gt;org.apache.maven.wagon&lt;/groupId&gt;
           &lt;artifactId&gt;wagon-ssh-external&lt;/artifactId&gt;
           &lt;version&gt;1.0-beta-6&lt;/version&gt;
        &lt;/extension&gt;
      &lt;/extensions&gt;
    &lt;/build&gt;
    ..
  &lt;/project&gt;
  </code></pre>
  
  <p>This is my settings.xml</p>
  
  <pre><code>&lt;server&gt;
      &lt;id&gt;ssh-aws&lt;/id&gt;
      &lt;username&gt;aws-user&lt;/username&gt;
  &lt;/server&gt;
  </code></pre>
  
  <p>The only issue is that I am unable to figure out the <strong>url in distributionManagement</strong> node of pom.xml.</p>
  
  <p>I am able to ssh in the AWS server by the following.</p>
  
  <pre><code>ssh -i ~/pemfile/pemfile-key.pem aws-user@&lt;ec2 instance&gt;.compute-1.amazonaws.com
  </code></pre>
  
  <p>But when I run mvn clean deploy, I receive this..</p>
  
  <pre><code>Exit code: 1 - Permission denied (publickey). -&gt; [Help 1]
  </code></pre>
  
  <p>Thanks in advance.</p>