This article revisits the concept of autopoiesis and examines its relation to cognition and life. We present a mathematical model of a 3D tesselation automaton, considered as a minimal example of autopoiesis. This leads us to a thesis T1: "An autopoietic system can be described as a random dynamical system, which is defined only within its organized autopoietic domain." We propose a modified definition of autopoiesis: "An autopoietic system is a network of processes that produces the components that reproduce the network, and that also regulates the boundary conditions necessary for its ongoing existence as a network." We also propose a definition of cognition: "A system is cognitive if and only if sensory inputs serve to trigger actions in a specific way, so as to satisfy a viability constraint." It follows from these definitions that the concepts of autopoiesis and cognition, although deeply related in their connection with the regulation of the boundary...