Cut the guanciale into 1/3-inch dice. Heat a deep, heavy-bottomed, 12-inch skillet over moderate heat. Cook guanciale, stirring, until fat begins to render, 1 to 2 minutes. Add the onion and cook, stirring occasionally, until onion is golden, about 10 minutes. Add the wine and boil until reduced by half, 1 to 2 minutes. Turn off heat.

Cook the spaghetti in boiling, salted water until al dente.

While pasta is cooking, whisk together the egg yolks, grated cheeses, salt and pepper in a small bowl.

Drain spaghetti in a colander and add to guanciale-onion mixture. Turn heat to medium-low and toss pasta with tongs until coated. Remove from heat and add egg mixture, tossing to combine. Serve immediately.