Cut the bacon and onion into small pieces.
Boil the spaghetti noodles in boiling water.
Heat olive oil in a pan and sauté the bacon and onion.
Add the cooked pasta to the pan and mix well.
In a bowl, mix egg yolks, Parmesan cheese, and heavy cream.
Remove the pan from heat and quickly mix the egg mixture into the pasta.
Season with salt and pepper.