The purpose of the present study is to profile the microfloral structure in the intestines of the white shrimp, Litopenaeus vannamei, after being fed a control diet, in comparison with the diets containing Bacillus subtilis E20‐fermented soybean meal (FSBM) or an antimicrobial peptide (AMP) isolated from B. subtilis E20‐FSBM (diets designated FSBMD and AMPD, respectively) for 60 days. Metagenomic data showed detection of eight phyla, 20 classes, 40 orders, 68 families and 96 genera. Despite no statistically significant difference, an evaluation of microbial diversity recorded higher species richness, Shannon–Weaver diversity index and evenness in the AMPD and FSBMD groups, compared to the control diet group. Venn diagrams showed that 58 of the operational taxonomic units (OTUs) were shared among the control, FSBMD and AMPD groups, but additional beneficial microbes were only found in the FSBMD and AMPD groups. In addition to the augmentation of beneficial bacteria in the FSBMD and AMPD groups, the abundance of potential pathogens, Vibrio and Flavobacterium, was lower in the gut of shrimp fed the FSBMD and AMPD. The results clearly suggest that the FSBMD and AMPD have the capability to change the microfloral structure of shrimp intestines and could be used for disease prevention in shrimp aquaculture.