We propose a non-perturbative formulation of the Atiyah-Patodi-Singer(APS) index in lattice gauge theory, in which the index is given by the $eta$ invariant of the domain-wall Dirac operator. Our definition of the index is always an integer with a finite lattice spacing. To verify this proposal, using the eigenmode set of the free domain-wall fermion, we perturbatively show in the continuum limit that the curvature term in the APS theorem appears as the contribution from the massive bulk extended modes, while the boundary $eta$ invariant comes entirely from the massless edge-localized modes.