The two main components of an ecosystem are biotic components (living organisms) and abiotic components (non-living elements such as air, water, and soil).