Put two coupe or martini glasses in the freezer to chill while you brew the coffee.
Brew 4 shots of espresso, about 120 ml / 4 fl oz total, using a machine or a moka pot on the stovetop.
Stir the sugar into the hot espresso right away until fully dissolved. Let it cool for 2 minutes so it won't melt the ice too fast.
Fill a cocktail shaker with the ice cubes, then pour in the sweetened espresso.
Seal the shaker and shake hard for 15 to 20 seconds, until the outside feels ice-cold and you hear the ice breaking down.
Strain into the chilled glasses right away. A pale tan foam cap, about 1 cm thick, should sit on top.
If making the boozy version, pour 15 ml of coffee liqueur or amaretto into each glass before straining the espresso over it.
Garnish with a lemon twist if using and serve immediately, while the foam is still intact.