An ecosystem is...
All of the organisms living in one area, and the abiotic conditions in which they live.
Abiotic conditions are just non-living things, like the temperature, soil quality, salinity, etc.
An ecosystem differs from a habitat because a habitat is only the area in which organisms live.
An ecosystem needs to be self-supporting, and provide pretty much everything it needs, such as water, nutrients, carbon, etc.
Ecosystems need things like carbon so that it can recycle it, and be sustainable.
The only thing an ecosystem relies on outside of itself is the Sun, which provides it with energy.