In a saucepan, heat the water and sugar over medium heat until fully dissolved.
Add the ground coffee (or instant coffee) and stir well. Let it simmer gently for about 10-15 minutes, then remove from heat.
If using a vanilla bean, split it open and add it to the mixture. Let it steep while cooling.
Once the coffee mixture has cooled to room temperature, strain it through a fine-mesh sieve or cheesecloth to remove coffee grounds.
Stir in the vodka (or rum). If you opted for vanilla extract instead of a bean, add it now.
Pour the liqueur into a clean glass bottle or jar with a tight seal. Let it sit in a cool, dark place for at least 3 days (ideally a couple of weeks) before using.