The coral holobiont is comprised of a highly diverse microbial community that provides key services to corals such as protection against pathogens and nutrient cycling. The coral surface mucus layer (SML) microbiome is very sensitive to external changes, as it constitutes the direct interface between the coral host and the environment. Here, we investigate whether the bacterial taxonomic and functional profiles in the coral SML are shaped by the local reef zone and explore their role in coral health and ecosystem functioning. The analysis was conducted using metagenomes and metagenome-assembled genomes (MAGs) associated with the coralPseudodiploria strigosaand the water column from two naturally distinct reef environments in Bermuda: inner patch reefs exposed to a fluctuating thermal regime and the more stable outer reefs. The microbial community structure in the coral SML varied according to the local environment, both at taxonomic and functional levels. The coral SML microbiome from inner reefs provides more gene functions that are involved in nutrient cycling (e.g., photosynthesis, phosphorus metabolism, sulfur assimilation) and those that are related to higher levels of microbial activity, competition, and stress response. In contrast, the coral SML microbiome from outer reefs contained genes indicative of a carbohydrate-rich mucus composition found in corals exposed to less stressful temperatures and showed high proportions of microbial gene functions that play a potential role in coral disease, such as degradation of lignin-derived compounds and sulfur oxidation. The fluctuating environment in the inner patch reefs of Bermuda could be driving a more beneficial coral SML microbiome, potentially increasing holobiont resilience to environmental changes and disease.Supplementary InformationThe online version contains supplementary material available at 10.1007/s00248-022-02094-6.