For nonnegative integers q, n, d, let A_q(n,d) denote the maximum cardinality of a code of length n over an alphabet [q] with q letters and with minimum distance at least d. We consider the following upper bound on A_q(n,d). For any k, let mathcal{C}_k be the collection of codes of cardinality at most k. Then A_q(n,d) is at most the maximum value of sum _{vin [q]^n}x({v}), where x is a function mathcal{C}_4rightarrow {mathbb {R}}_+ such that x(emptyset )=1 and x(C)=!0 if C has minimum distance less than d, and such that the mathcal{C}_2times mathcal{C}_2 matrix (x(Ccup C'))_{C,C'in mathcal{C}_2} is positive semidefinite. By the symmetry of the problem, we can apply representation theory to reduce the problem to a semidefinite programming problem with order bounded by a polynomial in n. It yields the new upper bounds A_4(6,3)le 176, A_4(7,3)le 596, A_4(7,4)le 155, A_5(7,4)le 489, and A_5(7,5)le 87.