In just over two decades, Amazon has gone from a startup based out of founder and chief executive officer Jeff Bezos's garage to one of the most powerful companies on Earth. If the planned purchase of Whole Foods Market and the company's ongoing push into the world of fashion are any indication, it seems the Seattle-based giant will only continue to expand its reach.

Supporting the growth of the company and managing the legal risks faced by such a behemoth is a massive legal department of more than 800 people, led since 2012 by David Zapolsky, Amazon's senior vice-president, general counsel and secretary.

While there are challenges in keeping up with the legal needs of a company like Amazon, such as managing a legal department that has grown to include more than 400 lawyers with offices in 15 different countries, Zapolsky says that the in-house legal team still, more than 15 years after he joined the company, feels the same in some respects.

Zapolsky says he is sometimes asked whether it is very different working with a legal team of 800 as opposed to the 15 to 20 that were at Amazon when he first joined in 1999. "The answer is: in some ways yes, but in some ways, no," he observes.

In a wide-ranging interview, Zapolsky discusses how he ended up at the helm of Amazon's legal department and offers a rare inside look at his team.

How did you end up at Amazon?

David Zapolsky: "When I was in college, it was a tough choice of whether to become a music professor or a lawyer. For lots of reasons, some obvious and some not, I ended up choosing law. So I went to law school in Berkeley [formerly the Boalt Hall School of Law] and then I moved back to New York to work in the Brooklyn District Attorney's Office.

I said: 'Well how big is the litigation department?' He said: 'Well, you would be it'

"I spent almost three years there doing largely sex crimes, child abuse and domestic violence trials. And from there, I was very lucky to be able to jump to Wachtell Lipton Rosen & Katz in 1991, where I learned all about business. Then I made the decision in 1994 to move to Seattle, where I worked at [the] firm Bogle & Gates, which dissolved in 1999, so I bounced for about six months to Dorsey & Whitney. Then I got a call from a former colleague at Bogle, whose wife had gone in-house at Amazon earlier in the year, and basically, he called to ask if I'd be interested in going to Amazon to do litigation.

"I said: 'Well how big is the litigation department?' He said: 'Well, you would be it'. And I knew at that point that it was just sort of the opportunity of a lifetime. I leapt at it and joined Amazon in November of 1999 and led the litigation and regulatory group for just about 13 years."

And then you were named general counsel in 2012?

Zapolsky: "Yes. It was not an express ambition of mine to be general counsel. I loved being the head of litigation and regulatory. In some ways, I felt like I was kind of built for that job and I never thought that the general counsel job would be as fun or as interesting as the issues I got to tackle there.

"But just almost exactly five years ago, my boss [previous GC] Michelle Wilson called me into her office unexpectedly and said: 'I've got three things to tell you.' I thought I was in trouble. But the three things were: 'I'm adopting a baby, I'm leaving in two weeks and I want you to take over as general counsel'. It was totally out of the blue.

"I hadn't given any thought whatsoever to doing the job. But as I thought about it more and talked to her and other people in the organisation, I got more comfortable with the idea. Or I at least got comfortable with the idea of giving it a shot. My biggest fear was that I wouldn't be able to do that job as well as I could do the other [litigation and regulatory] job. The jury's still out whether that's the case, but I will say it's a lot more fun than I imagined it to be."

Has the legal department changed as Amazon has grown?

Zapolsky: "To give you a sense of how quickly things change around here, when I became general counsel, I wouldn't have dreamed that by 2016, we would have an entire group of lawyers dedicated to aviation law, both for our drone programmes and for the [Boeing] 767s that we lease as part of our logistics network. Nor would I have thought that we would need an entire legal office in Santa Monica, basically filled with entertainment lawyers to help grow our original TV and movie Amazon Studios business, which we now do.

"Since I've been general counsel, we've built those two groups and many others as we've changed the business. What we have to do is we have to be lean, we have to be very nimble and we have to be willing to repurpose the resources we have to follow what the most pressing needs are.

"We also have our own internal tech team, which is run by our legal operations group. So we have a number of projects underway to invent our own technology to streamline the work that we do throughout the department, to hopefully allow our lawyers and legal professionals to automate some of the more routine work to focus on higher order issues.

"But in other ways, the legal department is not all that different. We're still very fast-moving and entrepreneurial. We still have a lot of fun. And I still see a lot of the same faces today that I did back then. We have tremendous continuity, especially among the senior leadership in the legal department… there's a lot about it that feels the same."

Is it difficult to keep up with such a large legal department?

Zapolsky: "That's our biggest challenge. I mean, it's a great challenge to have, but keeping up with what the company is doing around the world is our challenge. There are a lot of people out there that I don't know personally, which is a problem that gets worse every year. Part of the way I try to compensate for that is I try not to let more than two or three years go by without visiting, at least, our major international legal offices."

What are the top concerns for your team?

Zapolsky: "The business-related concerns vary from business to business [within Amazon]. But from an enterprise-wide standpoint, we all think about making sure we're doing everything to preserve customer trust. If we make a mistake on privacy, that's obviously a very high-stakes mistake. We could cost ourselves customer trust that way. Cybersecurity is another area where we devote resources and we want to make sure we're helping the business do everything possible to preserve customer trust along that dimension.

"As we grow geographically into places like the Middle East, where we don't have much experience, we have to make sure that our compliance functions are robust and able to grow into those regions, to make sure we're doing business the right way and that our employees understand the leadership principles and are following them.

"And then there are lot of challenges that go with being a big company that has business models that cross borders. We have this vision of being able to have seamless, cross-border commerce and information flows for everybody in the world, but that's actually a lot easier to do physically and electronically than it is to do legally because you have different languages, different cultures, different consumer protection regulations, different trade regulations.

"There's no silver bullet to a lot of that. You have to figure that out country by country, product category by product category."

Under your leadership, the legal department has participated in diversity and pro bono initiatives. Why are these important to you?

Zapolsky: "At Amazon, we have this very strong corporate ethic to be right a lot, which is one of our leadership principles. If everybody looks the same and comes from similar backgrounds, you're probably not going to get that, so diversity has a very real business meaning and a business importance here. And it's very important to me that we have lawyers and legal professionals that represent all of our customers.

"We have the benefit of having lots of open positions at any given time, so there's a lot of recruiting overlay that aligns very, very well with these efforts. We look at retention, recruiting and we do periodic training for our people within our department. We also have a policy where we sponsor every lawyer who wants to go participate in community minority bar associations. And on the external side, we challenge ourselves to look for attorneys in non-traditional places, like with the OnRamp Fellowship.

"On the pro bono side, it's really hard for in-house lawyers to do pro bono work. You just don't have the same infrastructure [as you do at firms] to support it, you don't have the same legal culture that recognises what it is and it's hard to start. So my strategy has been to provide as many different opportunities to our lawyers to get involved, even if that means just for an afternoon or just for a couple of hours.

"We've had great success, for instance, taking teams of people to DACA [Deferred Action for Childhood Arrivals] clinics to help these amazing young people process paperwork that puts them in that programme."