Mix together vinegar, sugar, salt, peppercorns, and mustard seeds.
Stir until salt and sugar have dissolved.
Pack shallots and garlic into a 4-ounce jar, then pour in pickling liquid.
Push down shallots so they are all covered.
Refrigerate for at least 30 minutes, and preferably one hour, before serving.
Notes
Storage: Pickled shallots will keep in the refrigerator for up to a week, though they will get more tart as the days go on. If you don’t intend to use your shallots for several days, replace ½ of the vinegar with water. That will make the pickling take longer at the start, but will prevent the shallots from becoming too tart after several days in the liquid.