I'm gonna send a piece of code of what I'm doing in the user-data.
#!bin/bash
echo 'export MY_VAR="some value"' >> /home/ubuntu/.bashrc
source /home/ubuntu/.bashrc
If your user start some process our enter by means of ssh, you'll get those variables.