Whether or not an instance runs user-data scripts is entirely up to the AMI and the software it comes with. Some AMIs do, some don't, and it's up to you to read the provider's documentation or test it for yourself.
Ubuntu AMIs and Amazon Linux AMIs have the cloud-init software package installed. This software runs various processes on your instance (server) when it boots. One of the processes checks to see if it is the first the the instances has ever booted and if the user-data starts with the characters "#!". If both of these are true, then the user data is run on the instance.