Aim of the talk is to make a survey on some recent results concerning analysis over spaces with Ricci curvature bounded from below. I will show that the heat flow in such setting can be equivalently built either as gradient flow of the natural Dirichlet energy in L^2 or as gradient flow if the relative entropy in the Wasserstein space. I will also show how such identification can lead to interesting analytic and geometric insights on the structures of the spaces themselves. From a collaboration with L.Ambrosio and G.Savare'.