This magnificent, scary-looking but completely harmless insect is a female Greater Horntail or Giant Woodwasp, Urocerus gigas:
The woodwasps are a groups of sawflies (members of the hymenoptera along with bees, wasps and ants) which lay their eggs in wood. You can actually see the ovipositor inserted into the wood, as well as the more dramatic orangey spike at the back of the insect, which I guess protects the ovipositor when it’s not in use? I’ve tried googling but I’m not sure. It’s certainly not a sting.
One amazing thing I did learn from Google though: the woodwasps actually inject a fungus along with their eggs, and the fungus infects the wood and serves to pre-digest it, making it easier for the larvae to eat.
This even more spectacular hymenopterid is Rhyssa persuasoria, the Giant Ichneumon:
She is also using her ovipositor to drill through solid wood and lay her eggs; but her young don’t eat wood. No, they eat the larvae of various other insects, including, commonly, our friend Urocerus gigas. In fact, she stings the woodwasp grub to paralyse it, and her own larvae eat it alive from the inside.
The whole thing is amazing: the ability of these insects to drill through wood, the fact that the woodwasps inject fungus to help their young, the way the ichneumon wasps manage to find where the larvae are inside the wood (a combination of scent and vibration, apparently), and the way they paralyse them for their own young. All done by instinct.