This is from Cook’s Illustrated and is basically the recipe I grew up on, with the addition of garlic. I’ve tweaked the technique a bit to temper the eggs and make it more difficult to curdle.
2 tbs extra-virgin olive oil
1/2 pound bacon (6 to 8 slices), cut crosswise into 1/4-inch pieces
3 eggs
3 ounces Parmesan cheese , finely grated (1 cup)
3 small cloves garlic , minced
1 pound spaghetti
Table salt and ground black pepper (see note)
Cook spaghetti, reserving a cup of cooking water.
Meanwhile, heat oil in large skillet over medium heat until shimmering, but not smoking. Add bacon and cook, stirring occasionally, until lightly browned and crisp, about 8 minutes. Remove from heat and cover to keep warm. Beat eggs, cheeses, and garlic together with fork in small bowl. Slowly stir in about 1/3 cup of the hot pasta cooking water to temper the eggs.
Return drained pasta to pot; pour egg mixture over hot pasta stirring constantly. Sprinkle with 1 teaspoon sea salt flakes or 3/4 teaspoon table salt; toss well to combine. Pour bacon mixture over pasta, season generously with black pepper, and toss lightly to combine. Serve immediately.