ssh tunneling to aws instance

Tunneling to AWS instance using pem file

How to tunnel to bastion instance using ssh tunneling

Usually you are going to need this on jump server or what we bastionwhitelist your IP to the corresponding server before you attempt to ssh tunnel to it.

How do I do that?

Go to your terminal and issue

ssh -i /PATH/TO/YOUR-PEM-FILE.pem -N -L 3308:YOUR-RDS-SERVER:3306 ec2-user@YOUR-AWS-SERVER-IP-OR-NAME

What is happening?
You will get your pem file and use that as a token to jump to your server. In this example I gave and RDS of mysql which by default has port of 3306. And I have given 3308 which will be used from my machine to jump to the server as needed.

what then?

Now, your local machine is configured to relay – forward – the port to the destination and whatever you throwing to your local machine’s 3308 port will be forwarded to the remote servers port and you can access the RDS.

Port not forwarded from vagrant for rails application on host

Having a rails application on the vagrant machine and the 3000 port not being forwarded when you access it form host machine like

http://localhost:3000

if so keep reading

Assuming you have already setup your vagrant machine

Go ahead and open your Vagrant file, find the config.vm.network and update it with

config.vm.network "forwarded_port", guest: 3000, host: 3000

Then make sure you are binding the server with 0.0.0.0 as it is the main problem is being the default 127.0.0.1 for that, when yoiu are instantiation the server do the binding with 0.0.0.0

bin/server --binding=0.0.0.0

Basically the above would tell to listen to almost any ip. This has its own risk if you are doing it on public VM so caution shall be applied. Where as when it is 127.0.0.1, it will be listening to the local address only.

installing macports

If you are a programmer/developer one thing you would face on date to date basis is handling packages.
Macports is a package manager for mac using that simplifying the installation of free/open softwares on you mac.
All how to install procedure is found on http://www.macports.org/install.php
After installing the macports don’t forget to update it

sudo port -v selfupdate

Starting Tomcatv6.0 Server at localhost has encoutered a problem, Port 80 required by Tomcat v6.0 server at localhost already in use. the server may already running in another process, or a system process may be using the port,To start this server you will need to stop the other process or change the port number(s)

While working with tomcat, you might come across this glitch. Here is how to get rid of it easily.

1. Go to server tab in your eclipse. If you cant see it you can have it through window->show view->servers
2. double click on the tomcat server and you will be directed to page for tomcat configuration.
3. On the page you will see list of ports that the current server is using.
4. Change the HTTP/1.1 from 80 – or whatever it is complaining to new one like 9181.
5. what… you’re done… :)

Happy TomCatting.