Fry the bacon and the onion. Once the bacon is cooked and the onion is tender, remove from heat and reserve.
Boil some salted water, then add the pasta. Boil until pasta is at desired tenderness. Drain and put into a bowl.
Working quickly, add the egg yolk to the hot pasta (you want to work quickly so the pasta will cook the egg yolk), along with the cream and the bacon bits and onion. Mix everything and season with salt and pepper, if desired.