microRNAs are endogenous small regulatory RNAs that modulate myriad biological processes by repressing target gene expression in a sequence-specific manner. Here we show that the conserved miRNA miR-34 regulates innate immunity and ecdysone signaling in Drosophila. miR-34 over-expression activates antibacterial innate immunity signaling both in cultured cells and in vivo, and flies over-expressing miR-34 display improved survival and pathogen clearance upon Gram-negative bacterial infection; whereas miR-34 knockout animals are defective in antibacterial defense. In particular, miR-34 achieves its immune-stimulatory function, at least in part, by repressing the two novel target genes Dlg1 and Eip75B. In addition, our study reveals a mutual repression between miR-34 expression and ecdysone signaling, and identifies miR-34 as a node in the intricate interplay between ecdysone signaling and innate immunity. Lastly, we identify cis-regulatory genomic elements and trans-acting transcription factors required for optimal ecdysone-mediated repression of miR-34. Taken together, our study enriches the repertoire of immune-modulating miRNAs in animals, and provides new insights into the interplay between steroid hormone signaling and innate immunity.