Dryland regions cover >40% of the Earth's land surface, making these ecosystems the largest biome in the world. Ecosystems in these areas play an important role in determining the interannual variability of the global terrestrial carbon sink. Examining carbon fluxes of various types of dryland ecosystems and their responses to climatic variability is essential for improving projections of the carbon cycle in these regions. In this study, we made use of observations from a regional flux tower observation network in a typical arid endorheic basin, the Heihe river basin (HRB). As a representative area of both the arid region of China and the entire region of central Asia, the HRB includes the main ecosystems in arid regions. We compared the spatial variations of carbon fluxes of five terrestrial ecosystems (i.e., grassland, cropland, desert, wetland, and forest ecosystems) and explored the responses of ecosystem carbon fluxes to climatic factors across different ecosystems. We found that our region exhibits a carbon sink ranging from 85.9 to 508.7 gC/m2/yr for different ecosystems, and the water availability is critical to the spatial variability of carbon fluxes in arid regions. Carbon fluxes across all sites exhibited weak correlations with temperature and precipitation. Marked differences in precipitation effects were observed between the sites within oases and those outside of oases. Irrigation and groundwater recharge were of great importance to the variations in carbon fluxes for the sites within oases. Evapotranspiration (ET) exhibited strong relationships with carbon fluxes, indicating that ET was a better metric of soil water availability than was precipitation in driving the spatial variability of carbon fluxes in arid regions. This study has implications for better understanding the carbon budget of terrestrial ecosystems and informing ecological management in dryland regions.