An IDEAL (Intrinsic, Deductive, Explicit, ALgorithmic) characterization of a reference spacetime metric $g_0$ consists of a set of tensorial equations $T[g]=0$, constructed covariantly out of the metric $g$, its Riemann curvature and their derivatives, that are satisfied if and only if $g$ is locally isometric to the reference spacetime metric $g_0$. The same notion can be extended to include matter fields, where the equations $T[g,phi]=0$ are allowed to also depend on the matter fields $phi$. We will present the first IDEAL characterization of cosmological FLRW spacetimes, with and without a dynamical scalar field. The solution of this problem also has implications for the construction of local gauge invariant observables for cosmological perturbations. Namely, by construction, the linearization $dot{T}[g_0,phi_0; delta g, delta phi]$ about $(g,phi) mapsto (g_0 + delta g, phi_0 + deltaphi)$ gives a complete set of local gauge invariant field combinations for cosmological perturbations. This is joint work with G. Canepa.