Step 1:- make sure Tiger VNC is running on your remote machine
a. check wheather any pre-existing vnc server running or not
ps aux | grep Xvnc
b. Kill and restart server
vncserver -kill :1 vncserver :1 -geometry 1920x1080 -depth 24
Step 2 :- in your local terminal type this
ssh -L 5901:localhost:5901 -i your-key.pem ec2-user@your-ec2-instance-ip
Step 3 :- On your local machine, use a VNC client (like tiger VNC Viewer) to connect to localhost:5901.
vncviewer -PreferredEncoding="hextile,h264"
Step 4:- Enter the VNC password you set earlier.
You should then see something like this
https://i.ibb.co/wM2vtn2/Screenshot-2024-09-06-at-10-07-40-PM.png