An ecosystem is defined as a community of living organisms interacting with each other and their non-living environment. It consists of biotic components like producers, consumers, and decomposers and abiotic components like sunlight, water, and soil. Energy flows through an ecosystem via food chains that are interconnected in a food web. As energy moves up the trophic levels from producers to primary, secondary and tertiary consumers, the available energy decreases and is depicted in ecological pyramids. There are various types of ecosystems including terrestrial, aquatic, lentic, lotic, and artificial ecosystems created by humans.