Cook the spaghetti in salted water until al dente and drain. Whisk the eggs with the cream. Briefly fry the ham and onion in the pan and add to the egg-cream mixture. Season everything with salt and pepper, add a little more herbs to taste.
Put everything in a large baking dish and sprinkle with the cheese. Preheat the grill and bake the carbonara for about 5 minutes until the cheese is golden brown.