We propose a method for simulating (2+1)D compact lattice quantum-electrodynamics, using ultracold atoms in optical lattices. In our model local Bose-Einstein condensates' (BECs) phases correspond to the electromagnetic vector potential, and the local number operators represent the conjugate electric field. The well-known gauge-invariant Kogut-Susskind Hamiltonian is obtained as an effective low-energy theory. The field is then coupled to external static charges. We show that in the strong coupling limit this gives rise to "electric flux tubes" and to confinement. This can be observed by measuring the local density deviations of the BECs, and is expected to hold even, to some extent, outside the perturbative calculable regime.