Developments in quantum information science rely critically on entanglement-a fundamental aspect of quantum mechanics that causes parts of a composite system to show correlations stronger than can be explained classically. In particular, scalable quantum networks require the capability to create, store and distribute entanglement among distant matter nodes by means of photonic channels. Atomic ensembles can play the role of such nodes. So far, in the photon-counting regime, heralded entanglement between atomic ensembles has been successfully demonstrated through probabilistic protocols. But an inherent drawback of this approach is the compromise between the amount of entanglement and its preparation probability, leading to intrinsically low count rates for high entanglement. Here we report a protocol where entanglement between two atomic ensembles is created by coherent mapping of an entangled state of light. By splitting a single photon and performing subsequent state transfer, we separate the generation of entanglement and its storage. After a programmable delay, the stored entanglement is mapped back into photonic modes with overall efficiency of 17%. Together with improvements in single-photon sources, our protocol will allow 'on-demand' entanglement of atomic ensembles, a powerful resource for quantum information science.