Skip to content

Using ssh to access instances

nt3rp edited this page Nov 26, 2012 · 6 revisions

Using ssh to access instances

This section will show you how to ssh into an instance and set up the environment so you can run commands with manage.py

Setting up your ssh key

You will need to add your public SSH key to ssh_keys, located in the root folder of the SecondFunnel project.

If you do not have an SSH key, you'll need to create one.

To add your public SSH key, just add a line like the following to the ssh_keys file:

cat ~/.ssh/id_rsa.pub >> ssh_keys 

The deployment process automatically appends ssh keys to the authorized keys file on the instance, which will allow you to SSH onto the machine.

Getting into an instance

In the AWS Console, go to the EC2 page (at the top of the screen: Services -> EC2), click instances on the left navigation bar, then click your instance. Find the instance's public DNS from the options pane that appears.

Now open a terminal and type in ssh ec2-user@<public_dns_from_above> You should now be on the instance.

Setting up the environment

Our code is stored in /opt/python/bundle/#/app/ where # is the highest numbered directory inside bundle (eg. /opt/python/bundle/7/app/). Once in that directory, run the following:

source ../../../run/venv/bin/activate
source ../env

The first command is to setup the virtual environment, and the second sets up RDS environment variables. You can now run commands with manage.py.

Clone this wiki locally