In a large pot, over medium-high heat, bring water to a boil. Once the water is boiling, cook the pasta until al dente. When the pasta is ready, reserve 1 cup of pasta water, drain the pasta, and set it aside. I like to reserve a little extra in case I need it.
Make the sauce
In a large skillet, saute bacon over medium-high heat. Once it's beginning to brown and crisp, add the onions and garlic. Continue to cook, stirring frequently, until the onions are soft and golden, for about 5 minutes.
In a separate dish, whisk the eggs, parmesan, and pepper. Set it aside.
Combine
Reduce the heat to the lowest setting and add the pasta to the skillet. Then, use tongs to combine the pasta with the bacon mixture. Pour the egg and parmesan mixture over the pasta.
Make sure the reserved pasta water is still very hot; if not, reheat it in the microwave for 30 seconds. Working quickly, use tongs to combine the pasta and egg mixture in the skillet as you pour in half of the pasta water. For a more saucy pasta, slowly add more pasta water. Melting the cheesy egg mixture with the water is what creates the carbonara sauce.