Start by setting the Instant Pot to the 'Sauté' mode. Add the olive oil, allowing it to heat.
Add the diced onion and cook for 3-4 minutes until it becomes translucent. Stir occasionally to prevent burning.
Stir in the minced garlic and diced bell pepper (if using), cooking for an additional 1-2 minutes until fragrant.
Add the crushed tomatoes, tomato paste, oregano, basil, salt, black pepper, red pepper flakes (if using), and sugar to the pot. Stir well to combine all ingredients.
Cancel the 'Sauté' mode and close the lid of the Instant Pot. Make sure the valve is set to 'Sealing.'
Set the Instant Pot to 'Manual' or 'Pressure Cook' for 10 minutes on high pressure.
Once the cooking time is complete, carefully perform a quick release by turning the valve to 'Venting.'
Open the lid, and stir the sauce to combine. Adjust seasoning if necessary.
Serve the spaghetti sauce immediately over cooked pasta, garnished with fresh basil if desired.