Memory is coded by patterns of neural activity in distinct circuits. Therefore, it should be possible to reverse engineer a memory by artificially creating these patterns of activity in the absence of a sensory experience. In olfactory conditioning, an odor conditioned stimulus (CS) is paired with an unconditioned stimulus (US; for example, a footshock), and the resulting CS-US association guides future behavior. Here we replaced the odor CS with optogenetic stimulation of a specific olfactory glomerulus and the US with optogenetic stimulation of distinct inputs into the ventral tegmental area that mediate either aversion or reward. In doing so, we created a fully artificial memory in mice. Similarly to a natural memory, this artificial memory depended on CS-US contingency during training, and the conditioned response was specific to the CS and reflected the US valence. Moreover, both real and implanted memories engaged overlapping brain circuits and depended on basolateral amygdala activity for expression.