Although bacterial cells are known to experience large forces from osmotic pressure differences and their local microenvironment, quantitative measurements of the mechanical properties of growing bacterial cells have been limited. We provide an experimental approach and theoretical framework for measuring the mechanical properties of live bacteria. We encapsulated bacteria in agarose with a user-defined stiffness, measured the growth rate of individual cells and fit data to a thin-shell mechanical model to extract the effective longitudinal Young's modulus of the cell envelope of Escherichia coli (50-150 MPa), Bacillus subtilis (100-200 MPa) and Pseudomonas aeruginosa (100-200 MPa). Our data provide estimates of cell wall stiffness similar to values obtained via the more labour-intensive technique of atomic force microscopy. To address physiological perturbations that produce changes in cellular mechanical properties, we tested the effect of A22-induced MreB depolymerization on the stiffness of E. coli. The effective longitudinal Young's modulus was not significantly affected by A22 treatment at short time scales, supporting a model in which the interactions between MreB and the cell wall persist on the same time scale as growth. Our technique therefore enables the rapid determination of how changes in genotype and biochemistry affect the mechanical properties of the bacterial envelope.