title: Using Jenkins to SSH into EC2 Ubuntu instance and run shell scripts
body: <p>I have installed Jenkins on my local, I have created my own EC2 instance, I can ssh into my instance and run some shell scripts to shut down my Wildfly server installed on my instance.</p>
  
  <p>This is what I do when I do it manually on my Mac.</p>
  
  <ol>
  <li><p>open my mac terminal, type </p>
  
  <p><code>ssh -i /Users/xxx/tools/xxxx.pem ubuntu@10.206.xxx.xx</code></p></li>
  <li><p>It will login to my Instance, and then I type:</p>
  
  <p><code>cd /srv/wildfly-10.1.0.Final/bin</code></p>
  
  <p><code>sudo -s</code></p>
  
  <p><code>source /etc/profile</code></p>
  
  <p><code>./jboss-cli.sh --connect command=:shutdown</code></p></li>
  <li><p>The screen will output </p></li>
  </ol>
  
  <blockquote>
    <p>{"outcome" => "success"}</p>
  </blockquote>
  
  <p>Now, I want to using Jenkins, when I click build button, it will ssh into that instance and run these shell scripts for me. The output is expected the same as I run it after I ssh into the instance.</p>
  
  <p>My question is: what steps should I follow, after I login to my Jenkins local environment: localhost:8080</p>
  
  <p>Create a New Item, which one? Is there some plugin I can use? Where to put my shell scripts, will it run successfully?</p>
  
  <p>A guide would be helpful, thanks a lot!</p>
  
  <p>Additon:
  when I try to login: using my ssh command, I get this error:</p>
  
  <pre><code>Pseudo-terminal will not be allocated because stdin is not a terminal.
  Host key verification failed.
  </code></pre>