Break spaghetti into half or smaller, and add it to the Instant Pot steel insert.
Add water and olive oil. Press the spaghetti under water. It should just covered with water. Close lid of the instant pot with vent in sealing position.
Press the Manual or Pressure Cook button and cook at high pressure for 4 minutes. The time to cook is usually 1 minute less than half of the suggest time on the pasta box. This will result in al dente pasta.
When the instant pot beeps, quick release the pressure manually. Toss the spaghetti with tongs, so all the noodles are separated.
Add the sun-dried tomatoes and pesto. Toss to coat the spaghetti well.
Mix in the lemon juice if adding. Garnish with red chili flakes, cheese and basil leaves.
This recipe was created in a 6qt Instant Pot DUO60 Multi-use Pressure Cooker.
In 4 minutes, the spaghetti with be Al dente. If you want softer spaghetti, add 1-2 minutes to cooking time.
If you like more saucy spaghetti, add more pesto sauce. You can also add some heavy cream to make this a creamy pesto spaghetti.