title: Running ssh on Amazon EC2 instance on port other than 22
body: <p>I am not able to access Amazon EC2 instance via ssh as i am behind a firewall.
  So, i thought of running ssh on port other than 22, like 80 or 443.</p>
  
  <p>I tried starting Amazon EC2 instance via Web Management Console with following 'user data':</p>
  
  <pre><code>#!/bin/bash -ex
  perl -pi -e 's/^#?Port 22$/Port 80/' /etc/ssh/sshd_config
  service sshd restart || service ssh restart
  </code></pre>
  
  <p>The idea being that the above script would execute on instance startup and switch ssh from port 22 to port 80. (Ref: <a href="http://alestic.com/2010/12/ec2-ssh-port-80">http://alestic.com/2010/12/ec2-ssh-port-80</a>)</p>
  
  <p>But ssh is still not accessible on port 80.
  Apparently 'user data' script is not being executed on start up?</p>
  
  <p>I can 'only' start stop instances via Web Management Console, not from command-line (being behind firewall)</p>
  
  <p>Any ideas?</p>