Nitric oxide (NO) at a high concentration is an effector to kill pathogens during insect immune responses, it also functions as a second messenger at a low concentration to regulate antimicrobial peptide (AMP) production in insects. Drosophila calcineurin subunit CanA1 is a ubiquitous serine/threonine protein phosphatase involved in NO-induced AMP production. However, it is unclear how NO regulates AMP expression. In this study, we used a lepidopteran pest Ostrinia furnacalis and Drosophila S2 cells to investigate how NO signaling affects the AMP production. Bacterial infections upregulated the transcription of nitric oxide synthase 1/2 (NOS1/2), CanA and AMP genes and increased NO concentration in larval hemolymph. Inhibition of NOS or CanA activity reduced the survival of bacteria-infected O. furnacalis. NO donor increased NO level in plasma and upregulated the production of CanA and certain AMPs. In S2 cells, killed Escherichia coli induced NOS transcription and boosted NO production, whereas knockdown of NOS blocked the NO level increase caused by E. coli. As in O. furnacalis larvae, supplementation of the NO donor increased NO level in the culture medium and AMP expression in S2 cells. Suppression of the key pathway genes showed that the IMD (but not Toll) pathway was involved in the upregulation of CecropinA1, Defensin, Diptericin, and Drosomycin by killed E. coli. Knockdown of NOS also reduced the expression of CanA1 and AMPs induced by E. coli, indicative of a role of NO in the AMP expression. Furthermore, CanA1 RNA interference and inhibition of its phosphatase activity significantly reduced NO-induced AMP expression, and knockdown of IMD suppressed NO-induced AMP expression. Together, these results suggest that NO-induced AMP production is mediated by CanA1 via the IMD pathway.