I managed to connect to my WPA2 access point by putting the following in /etc/network/interfaces
. Slightly modified from the accepted answer, and using DHCP.
auto wlan0
iface wlan0 inet dhcp
wpa-ssid <your_router>
wpa-psk <your_wpa_key>
Then a simple sudo ifup -v wlan0
and it connected. All good.