Edinburgh will also provide the venue for the European Challenge Cup the same year, but the host stadium has yet to be chosen for that event.
European Professional Club Rugby announced the decision in Geneva ahead of next season's competition draws.
France will host the 2016 finals, with both being played at the new Grand Stade de Lyon over one weekend.
The Edinburgh finals will also take place over the same weekend.
Scottish Rugby director of commercial operations, communications and public affairs Dominic McKay said: "It is a real endorsement of the work Scottish Rugby and its partners have achieved and will create a fantastic sporting weekend in Edinburgh and bring fans to the city from across Europe.
"We have a great track record of putting on world-class events, including the highly successful hosting of the previous European Cup finals in 2005 and 2009 at BT Murrayfield, and this award will give us a further chance to showcase the passion for rugby and international sport here in Scotland."
The Scottish Government and Event Scotland assisted the Edinburgh bid and First Minister Nicola Sturgeon said: "After what has been quite a successful season for rugby in Scotland with Glasgow being crowned Pro12 champions and Edinburgh reaching the final of the European Challenge Cup, this announcement will keep the feel-good factor in the game going."
Clubs finishing highest in the Celtic, English and French leagues qualify for the Champions Cup, while the others take part in the Challenge Cup.
Edinburgh were beaten by Gloucester in last season's Challenge Cup final, hosted by Harlequins at the Stoop, while Twickenham was the venue for the Champions Cup final in which Toulon defeated French rivals Clermont Auvergne.
Next season's Challenge Cup final will be played in Lyon on Friday 13 May, while the final of the Champions Cup will take place the next day.
European Rugby said it had chosen the 2017 host city now to give organisers greater preparation time.
President Simon Halliday said: "We received an extremely interesting also from the Scottish Rugby and we wanted to recognise choosing the renowned city of Edinburgh for the finals of 2017."
The news was welcomed by Glasgow Warriors head coach Gregor Townsend.
"It's more than just a one-off game now with the Champions Cup and Challenge Cup played in the same city on the same weekend," he said.
"With the quality of players in both tournaments, it's the highest level of club rugby, certainly in Europe if not in the world, so it'll be one of those must-see events.
"It's great for Scottish rugby that it's going to take place in Edinburgh."
Murrayfield Stadium has been chosen to host the 2017 European Champions Cup final in May of that year.