The human gut is inhabited with trillions of bacteria, gut microbiota, that have co-evolved with us and affect our physiology within and outside the gut. Our bodies are exposed to an immense number of bacteria at birth but it is relatively unclear how the gut microbiota is established and how the feeding pattern affects the microbial ecology. The gut microbiota has recently been suggested as a novel contributor to obesity and related comorbidities, such as type 2 diabetes (T2D) and cardiovascular diseases (CVD). We recently found that the gut microbiota is altered in patients with CVD and T2D and that we can classify patients based on the microbiota. Using germ-free mice we have causally linked the gut microbiota to obesity and insulin resistance and have recently found that the gut microbiota modulates adipose inflammation, bile acid signaling, and enteroendocrine cell function. During the past years, it has become clear that bariatric surgery modulates gut microbial ecology. However, it is unclear whether the altered gut microbiota directly contributes to the improved metabolic outcome of bariatric surgery. The aim of my talk is to discuss how the gut microbiota is established early in life and how a perturbed microbiota may contribute to metabolic disease later in life.