Many people might think that $1,000 isn't enough to get started in the stock market. However, two well-known tech companies could have turned $1,000 into nearly half a million dollars if you had held their stocks through thick and thin.

Amazon.com

Amazon (NASDAQ:AMZN) went public in 1997 at $18 per share. One thousand dollars would have been enough to buy 55 shares. Amazon split three times in 1998 and 1999, which would have boosted your initial share count to 660.

That stake would be worth roughly $494,000 today. Even if you weren't able to buy any IPO shares, you could have bought 42 shares at its first day closing price of $23.50, which would be worth about $377,000 today.

Image

Image source: Amazon.

Much of Amazon's incredible growth can be attributed to founder and CEO Jeff Bezos' ability to continuously evolve the company. Bezos transformed Amazon from an online bookstore into a superstore for all products, introduced Amazon Prime as a free shipping service for members, launched Kindle tablets to sell e-books and other digital content, and sold new devices like the Fire TV, Dash buttons, and Echo to tether more users to its ecosystem.

Prime -- with its discounts, free e-books, free media, and other perks -- became a must-have service for frequent Amazon shoppers. That combination of low online prices and a prisoner-taking ecosystem has been extremely tough for brick-and-mortar retailers to counter.

Amazon also leased out the cloud backbone of its site as AWS (Amazon Web Services), the largest cloud platform in the world, with an annual run rate of around $10 billion. This high-margin business now generates over half of Amazon's operating income, offsets the lower margins at its marketplace business, and gives it the stable profits that proved elusive in the past. Amazon's incredible rally isn't expected to end anytime soon: Analysts believe that its revenue will rise 25% this year as AWS boosts earnings 330%.

Apple

Apple (NASDAQ:AAPL) went public in 1980 at $22 per share. One thousand dollars would have been enough to buy 45 shares. Since then, the stock has split four times, which would have increased your share count to 2,520 -- which currently has a market value of over $245,000.

Image

Image source: Apple.

However, many early investors were initially pessimistic about Apple's ability to follow up the popular Apple II, which was released in 1977, with a comparable hit product. As a result, Apple stock fell nearly 50% below its IPO price to just under $11.50 in 1982.

Assuming that you missed out on the IPO, you could have bought 87 shares with $1,000. That stake would have been split into 4,872 shares, and be worth about $474,500 today. And since Apple pays a forward dividend of 2.3%, your investment would now be paying you nearly $11,000 in cash or reinvested stock (if you choose to reinvest Apple's dividends) every year.

Most of Apple's growth notably occurred after co-founder Steve Jobs returned in 1997. Over the following decade, Jobs refreshed Apple's stagnant product lines with the iMac, iPod, and iPhone, bringing the computer maker back to profitability, and boosting annual revenues by nearly 360% between 1997 and 2008. In fact, if you had invested $1,000 in Apple when Jobs returned as the de facto CEO on July 9. 1997, your holdings would now be worth nearly $200,000.

Looking ahead, Apple faces tougher headwinds than Amazon, because iPhone, iPad, and Mac sales have all been falling year over year. As a result, analysts expect the tech-giant's revenue and earnings to respectively fall 8% and 11% this year.

The key lessons

Investors shouldn't underestimate the value of $1,000, which could balloon to nearly half a million if invested in the right stock. But that's much easier said than done, and often requires investors to take a contrarian view of a company.

Many naysayers initially believed that Bezos' plan to prioritize revenue growth over profitability would prove unsustainable. Barron's, in an infamous article it probably wishes readers would forget, called the company "Amazon Dot Bomb." Likewise, many investors doubted that Steve Jobs, who was ousted from Apple in 1985, could save the company.

Investors also had to ride out some huge price swings to book those big gains. Apple stock plunged more than 50% on Sept. 29, 2000 due to a fourth-quarter warning popping a dot-com inflated bubble. Shares of Amazon plummeted 25% on July 24, 2001 for similar reasons.

If you had panicked and sold either stock back then, you would have left a lot of money on the table. Therefore, with a shrewd contrarian eye, and lots of patience and luck, $1,000 can turn into half a million dollars over a reasonable period of time.

Leo Sun owns shares of Amazon.com. The Motley Fool owns shares of and recommends Amazon.com and Apple. The Motley Fool has the following options: long January 2018 $90 calls on Apple and short January 2018 $95 calls on Apple. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.