An optimization-based approach is proposed to design elastostatic cloaking devices in two-dimensional (2D) lattices. Given an elastic lattice with a defect, i.e. a circular or elliptical hole, a small region (cloak) around the hole is designed to hide the effect of the hole on the elastostatic response of the lattice. Inspired by the direct lattice transformation approach to elastostatic cloaking in 2D lattices, the lattice nodal positions in the design region are obtained using a coordinate transformation of the reference (undisturbed) lattice nodes. Subsequently, additional connectivity (i.e. a ground structure) is defined in the design region and the stiffness properties of these elements are optimized to mimic the global stiffness characteristics of the reference lattice. A weighted least-squares objective function is proposed, where the weights have a physical interpretation—they are the design-dependent coefficients of the design lattice stiffness matrix. The formulation leads to a convex objective function that does not require a solution to an additional adjoint system. Optimization-based cloaks are designed considering uniaxial tension in multiple directions and are shown to exhibit approximate elastostatic cloaking, not only when subjected to the boundary conditions they were designed for but also for uniaxial tension in directions not used in design and for shear loading.