Commensal microbes in animals have a profound impact on tissue homeostasis, stress resistance, and ageing. We previously showed in Drosophila melanogaster that Acetobacter persici is a member of the gut microbiota that promotes ageing and shortens fly lifespan. However, the molecular mechanism by which this specific bacterial species changes lifespan and physiology remains unclear. The difficulty in studying longevity using gnotobiotic flies is the high risk of contamination during ageing. To overcome this technical challenge, we used a bacteria-conditioned diet enriched with bacterial products and cell wall components. Here, we demonstrate that an A. persici-conditioned diet shortens lifespan and increases intestinal stem cell (ISC) proliferation. Feeding adult flies a diet conditioned with A. persici, but not with Lactiplantibacillus plantarum, can decrease lifespan but increase resistance to paraquat or oral infection of Pseudomonas entomophila, indicating that the bacterium alters the trade-off between lifespan and host defence. A transcriptomic analysis using fly intestine revealed that A. persici preferably induces antimicrobial peptides (AMPs), while L. plantarum upregulates amidase peptidoglycan recognition proteins (PGRPs). The specific induction of these Imd target genes by peptidoglycans from two bacterial species is due to the stimulation of the receptor PGRP-LC in the anterior midgut for AMPs or PGRP-LE from the posterior midgut for amidase PGRPs. Heat-killed A. persici also shortens lifespan and increases ISC proliferation via PGRP-LC, but it is not sufficient to alter the stress resistance. Our study emphasizes the significance of peptidoglycan specificity in determining the gut bacterial impact on healthspan. It also unveils the postbiotic effect of specific gut bacterial species, which turns flies into a "live fast, die young" lifestyle.