Combine vinegar, sugar, spices, and 2 tablespoons salt in a saucepan. Bring to a boil, stirring until sugar is dissolved. Fill clean containers tightly with cucumbers and onion. Add boiling brine to cover completely. Let cool completely. Cover, label, and refrigerate at least 1 week before serving, or up to 3 months.