Bring a large pot of lightly salted water to a boil and add spaghetti. Cook until al dente. Drain spaghetti from pot, reserving 1 cup of the pasta water.
Add pancetta to a large skillet over medium heat and cook until meat gets crispy, about 9-10 minutes.
Leave any oil from pancetta in skillet and add green beans. Season with salt and pepper and cook, covered, until they're tender, but still crisp, about 5-7 minutes.
Add cooked spaghetti and pancetta to skillet, along with ½ cup parmesan cheese and toss to combine. Add enough of the reserved pasta water to create a thin sauce that coats the pasta and toss again.
Serve in individual bowls topped with remaining cheese and basil and red pepper flakes, if desired.