In this paper, we consider the problem of optimally coordinating the response of a group of distributed energy resources (DERs) so they collectively meet the electric power demanded by a collection of loads, while minimizing the total generation cost and respecting the DER capacity limits. This problem can be cast as a convex optimization problem, where the global objective is to minimize a sum of convex functions corresponding to individual DER generation cost, while satisfying (i) linear inequality constraints corresponding to the DER capacity limits and (ii) a linear equality constraint corresponding to the total power generated by the DERs being equal to the total power demand. We develop distributed algorithms to solve the DER coordination problem over time-varying communication networks with either bidirectional or unidirectional communication links. The proposed algorithms can be seen as distribute