Remove stems and rinse tomatoes. Set aside.
Sterilize four 1-quart jars and lids if using the boiling-water canner method. Otherwise, jars and lids need to be clean but don't have to be sterilized.
Fill the jars with tomatoes, packing them tightly, leaving about a 1-inch headspace, but without damaging them. As you fill the jars with tomatoes, add garlic, bay leaves, shallots, and peppercorns. Also, throw in a few leaves/twigs of herbs of your choosing and jalapeno slices (only if you want to add some heat).
Add four tablespoons of white vinegar per jar.
In a medium pot, bring water to a boil, add salt and sugar and stir until both are dissolved.
Pour the hot brine into jars, leaving 1/2" headspace. Put on lids and tighten finger-tight.
Process jars according to the chosen method specified in the post and the notes to the recipe. My preferred method is the weighted-gauge pressure canner method. As my elevation is below 1,000 feet, I process my cherry tomatoes for 15 minutes at 5 lbs pressure.
If using a pressure canner, let the pressure canner de-pressurize on its own. Using a jar lifter, transfer jars to tray lined with paper towels and let cool to room temperature.
Store in a cool, dry place for up to a year or longer. Canned fruit and vegetables may start slowly losing their freshness after a year but will still taste good and will be safe to eat.
Refrigerate after opening.