In this case, the aglycone contains a cyanohydrin group. Plants that make cyanogenic glycosides store them in the vacuole, but, if the plant is attacked, they are released and become activated by enzymes in the cytoplasm. These remove the sugar part of the molecule, allowing the cyanohydrin structure to collapse and release toxic hydrogen cyanide. Storing them in inactive forms in the vacuole prevents them from damaging the plant under normal conditions.
Along with playing a role in deterring herbivores, in some plants they control germination, bud formation, carbon and nitrogen transport, and possibly act as antioxidants. The production of  cyanogenic glycosides is an evolutionarily conserved function, appearing in species as old as ferns and as recent as angiosperms.  These compounds are made by around 3,000 species. In screens they are found in about 11% of cultivated plants but only 5% of plants overall; humans seem to have selected for them.
Examples include amygdalin and prunasin which are made by the bitter almond tree; other species that produce cyanogenic glycosides are sorghum (from which dhurrin, the first cyanogenic glycoside to be identified, was first isolated), barley, flax, white clover, and cassava, which produces linamarin and lotaustralin.
Amygdalin and a synthetic derivative, laetrile, were investigated as potential drugs to treat cancer and were heavily promoted as alternative medicine; they are ineffective and dangerous.
Some butterfly species, such as the Dryas iulia and Parnassius smintheus, have evolved to use the cyanogenic glycosides found in their host plants as a form of protection against predators through their unpalatability.