You can create special discount URLs where you can specify the discounted price, and optionally the period of validity and the max. number of uses.
I've used that in the past for promoting the book, but also for giving the book to colleagues for free (and being able to track whether they actually cared enough to add it to their library :D).
With a traditional publisher, you can typically get some coupon codes for the ebook, but it's a slow process, with little control over the actual amount, no direct access to tracking data etc.
My feeling is that this is a holdover from a time when there was a substantial barrier-to-entry for authorship. Back when publishers were the gatekeepers, anybody could write a book, but relatively few were published.
People could vanity-press anything, but nobody would hear about them, because just as publishing was concentrated, so was marketing.
---
But today, anybody can publish a book, and likewise anybody can market a book, super-cheaply. "I wrote X" is worth geometrically less today than it was a decade ago.
If you write a book for other reasons, by all means bask in the reputation. But I find it extremely unlikely that if you are doing it strictly for economic reasons, that writing a book and then marketing it is going to be superior to the many other ways you might have of building your professional resume.
Maybe you should answer a lot of questions on Stack Overflow. Or--like me--become a blowhard on Hacker News.
Putting a book together, as compared to many things, takes a lot of time and energy and definitely sends social signals. Just last night a friend dropped "he just published a new book" in conversation where Stack Overflow creds would have sounded like a joke. SO just isn't known the way book publishing is. Since the comment was an effective social cue to the audience, she freaked out and asked a bunch of questions. It still works just fine.
That may appeal to some, but given the number of books written that are absolute dreck, the argument carries no more weight with the discerning audience than saying that you put in the work to get a CS degree, so you must be smart.
Now, if you write a book and get nice reviews, thatks a different signal. But absent that... I doubt it's more than an invitation to a conversation.
I wouldn't want to belong to any club whose sole requirement was that I had written and self-published a technical book.
I choose not to publish on Amazon because I have philosophical reasons for not wanting to do business with them. As it is my lifestyle hobby, I needn't worry about leaving money on the table. But if this was my business, that might be important.
The key insight here is that it is a business, and the actual writing of the book is incidental to the success of the business. I repeat, incidental. The main drivers of the publishing business is marketing to acquire more customers, and finding ways to build additional revenue streams to generate value from each customer.
If you don't care to know what LTVs and conversion rates are, you will not be happy running a publishing business regardless of who wrote the book(s) you are publishing.
The other road forward is to have a publishing hobby. Some hobbies make token amounts of money. I know two brothers who buy collectible corvettes, fix them up, drive them for exactly one Summer, and then sell them.
The money they make seems like a nice side-business, until you listen to them tote up the hours and expenses and tax implications. They would make way more money selling almost anything else part-time. And that is my personal experience with my own writing hobby.
The money sounds nice until you actually look at it as a business, and then you start asking why I am on Hacker News writing this comment when I should be curating my email list. The "problem," of course, is that writing is my hobby, not curating email lists.
So I believe you need to decide whether you have a business or a hobby. If it's a business, then you have to put 80% of your work into the activities that produce 80% of the revenue. And that is not writing, in my experience or observation.
Whereas with a hobby, you put 80% of your work into the activities that produce 80% of the happy juice in your brain. If writing does that for you, you can write and make a little something on the side that will pay for some discretionary lifestyle purchases. In my own case, that's things like a 1950s-era Rietveld Crate Chair.
Blatant Endorsement:
FYI, I publish with LeanPub http://leanpub.com, because it generates the maximum revenue for the small scale of my writing hobby, and its "lean" approach helps me maximize my contact with my readers as part of the writing process. Since writing is my hobby, that's a win for me.
They also help people with a writing business in some amazing ways, like their tools for creating courses, which helps generate more revenue from existing content, and the ways they help you build a mailing list so you can develop other revenue streams from your existing readers. If you want to build a business, they help you build your business.