Imagine doubling your money in just two years' time. For some lucky investors, this actually happens. Indeed, this has been the case for Amazon.com (AMZN -1.14%) investors over the past two years. During this time, shares of the e-commerce giant have skyrocketed more than 123%.

AMZN Chart

AMZN data by YCharts.

Here's a look at some of the factors driving Amazon.com's stock price higher during this period, as well as a look at the stock's potential going forward.

Why did Amazon stock double?

One of the main reasons Amazon.com's stock has doubled during the past two years is because the company surprised investors with how fast it has been able to grow profits. While investors knew two years ago the e-commerce company would be capable of churning profits if it were to pull back its growth initiatives, investors didn't expect profits to come as quickly as they did.

Consider the company's recent progress in its net income. In 2015, Amazon's net profit was $596 million -- up from a $241 million loss in 2014. And in the trailing 12 months, Amazon's net income soared to $1.9 billion. Further, the company's latest quarter in particular highlights just how impressively Amazon is beginning to generate fatter profits for investors. It reported a net profit of $857 million in the second quarter of 2016 alone. This is up hugely from $92 million in the year-ago quarter.

Amazon warehouse. Image source: Amazon.

What's just as surprising as how Amazon has been able to grow its profits during the past two years is that it has been able to do this while continuing to rapidly increase its operating expenses. In Amazon's six months ended June 30, for instance, operating expenses were $59.5 billion -- up nearly $10 billion from the year-ago period.

One final point highlights another outcome Amazon investors have likely been very pleased with during the past two years. Amazon has been able to turn not just one, but two segments -- its North America e-commerce business and cloud-based services platform Amazon Web Services, or AWS -- into significant contributors to its bottom line. In the company's most recent quarter, these two segments generated $702 million and $718 million in operating income, respectively. By turning two very different businesses into cash cows, Amazon has essentially increased the sustainability of Amazon's business and reduced risk for shareholders.

How long before Amazon stock doubles again?

While Amazon's excellent track record, particularly during the past two years, does make the stock worth holding, the stock's significant rise during this period means investors are arguably already pricing in a rosier outlook for the company's business. Investors' high expectations for the company are evident both by the company's price-to-earnings ratio of about 190 and its price-to-sales ratio of 3.

Still, investors interested in Amazon shouldn't let a pricey valuation keep them away. A company with an incredible track record, an obvious competitive advantage (thanks to Amazon's economies of scale in e-commerce and cloud services), and huge market potential isn't likely to trade at a conservative valuation. With this in mind, I still think Amazon stock is a buy today and could double again during the next five years, making for an approximately 15% annualized return.