You can buy prepared duck confit, but if you would like to make your own, you’ll need to start a day in advance.
Trim the extra fat off the duck legs and store for later use. Place duck legs in a non-reactive storage container.
To the bowl of a food processor or blender, add salt, sugar, shallots, garlic, thyme, peppercorns, and bay leaves. Pulse quickly until well combined.
Pour the combined salt mixture over the duck legs, making sure to coat the legs completely. Cover the bowl and place in refrigerator to let the legs cure for 24 hours.
The next day, rinse the duck legs in cold running water to remove excess salt mixture. Pat dry and place the legs in a Dutch oven. Melt the rendered duck fat and pour over the duck legs, adding enough to cover. Place a lid on the pot and bake at 250°F for 6 hours.
When duck legs are thoroughly baked, remove from the oven and strain off the fat. (You can keep the duck fat in the fridge for up to 6 months to use in other recipes as cooking fat.)
Let the duck legs cool and when they are cool enough to handle, pull the flesh from bones and shred it into a mixing bowl. Discard the skin and bones.