There is no clear boundary between the two, as they are closely related. However, the distinction is that astronomy generally refers to the act of observing things (be that stars, galaxies or whatever) which, coupled with astrophysics, aims to understand those things for their own sake. The aim is to learn about the stars, galaxies or whatever.
On the other hand, the aim of cosmology is to understand broader questions about the Universe, such as its origin, underlying physical laws etc. Cosmology requires astronomy and astrophysics in order to get data to compare to cosmological models, but for a pure cosmologist these are just tools to achieve the aims of cosmology, rather than being the goal in their own right.
As I said though, the boundaries are not clear cut, but that is the basic distinction.