I have exactly the same problem when connecting to a remote instance on AWS. It seems to be related to xrdp. See for instance this thread, which describes a detailed work-around.
EDIT: Took me a while to get back to this, but since there has been no further activity in this thread, I finally got around to add details as suggested (demanded?) in the comments.
These are the steps I had to do to fix the keyboard layout in xrdp in Ubuntu 12.04. The original link was a big help, but a bit out-dated. I also found useful information with the rdesktop project, for finding country codes: here and here.
Open console and set xkb map to correct model & layout.
setxkbmap -model pc105 -layout no
Replace model and layout language code to whatever is the correct one for you. I just ran
setxkbmap -print on the client PC (which incidently also runs Ubuntu 12.04) to get an idea about these values. Note that
setxkbmap needs to have a display to run. You can either run the console through a RDP session or perhaps even login through ssh with X display redirection, like this
ssh -X <server>.
Generate XRDP keymap file:
sudo mv km-0414.ini /etc/xrdp
sudo chown root:root /etc/xrdp/km-0414.ini
Replace the country code 0414 with the correct code for your country. See the rdesktop doc to find the correct code for you.
Restart the xrdp service:
sudo service xrdp restart