New York (CNN Business) Amazon is spending heavily to keep growing — and that appears to be making investors nervous.

said Thursday that its profit for the three months ending in September fell to $2.1 billion from $2.9 billion in the same period a year ago, a decline of nearly 28%, as the company invests heavily to expedite deliveries.

Shares of Amazon fell as much as 8% in after-hours trading Thursday as its earnings came in below Wall Street estimates.

The company announced in April that it would spend $800 million in the upcoming quarter to make one-day shipping standard for customers who subscribe to Prime, its membership service. Three months later, Amazon said the actual cost ended up being even higher

In a statement with its earnings report on Thursday, CEO Jeff Bezos said the investment will be worthwhile in the long run.

"Customers love the transition of Prime from two days to one day — they've already ordered billions of items with free one-day delivery this year," Bezos said. "It's a big investment, and it's the right long-term decision for customers."

The company's shipping costs for the quarter hit $9.6 billion, up 46% from the prior year, as it worked to cut its standard delivery time for Prime in half.

If that wasn't enough, Amazon's headcount grew by nearly 100,000 full-time and part-time employees during the quarter. Amazon held a a career day last month during which it looked to fill more than 30,000 jobs.

The new employees will largely work in fulfillment and transportation roles, amid the shift to one-day shipping, CFO Brian Olsavsky said on a call with analysts Thursday. The company also grew staff at Amazon Web Services (AWS), its cloud computing segment. He said that business has ramped up hiring of sales and marketing personnel as companies and government agencies increasingly look to transition to cloud computing.

But its investments come at a tricky time for Amazon. AWS, one of the company's key profit drivers, is experiencing slower growth. The division posted nearly $9 billion in sales, up almost 35% from the same time last year, but below the growth it saw in prior quarters.

AWS is the clear leader in cloud computing; its performance follows a larger industry trend of slowing growth as cloud computing becomes more widely adopted. Earlier this week, AWS competitor Microsoft Azure also posted slowing growth — 59% in the three months ending in October, compared to 64% in the prior quarter.