Amazon has agreed to buy the storied MGM studios for $8.45 billion, the companies said Wednesday, giving the US tech giant a vast library to further its ambitions in streaming. The deal bolsters Amazon Prime Video, which competes with Netflix and others in the fast-evolving market, with some 4,000 films — including the James Bond franchise — and 17,000 television shows. “The real financial value behind this deal is the treasure trove of IP in the deep catalog that we plan to re-imagine and develop together with MGM’s talented team,” said Mike Hopkins, senior vice president of Prime Video and Amazon Studios. The deal comes with Amazon experiencing surging growth in online retail and cloud computing, making a push into entertainment as consumers turn to streaming media. It gives Amazon the fabled Metro Goldwyn Mayer studios, an iconic name in Hollywood which has been through a series of ownership changes and bankruptcy in recent years. In addition to the James Bond franchise, MGM owns the rights to film productions including Rocky, Legally Blonde and Tomb Raider, and television shows such as The Handmaid’s Tale and Real Housewives Of Beverly Hills. “MGM has nearly a century of filmmaking history and complements the work of Amazon Studios, which has primarily focused on producing TV show programming,” a statement from the companies said. “Amazon will help preserve MGM’s heritage and catalog of films, and provide customers with greater access to these existing works. Through this acquisition, Amazon would empower MGM to continue to do what they do best: great storytelling.”