The Ninth Circuit correctly reads Rule 15 in this opinion. Unlike the district court.
Rule 15 allows you to initially amend your complaint with the consent of the other side and then, if you want, later file an amended complaint as a matter of right. Even in the face of a 12(b)(6) motion to dismiss, and even after the deadline for the opposition to that motion has expired.
You're allowed to amend your complaint once "as a matter of right" (within specified time periods). You don't waive, or exhaust, that right by previously amending your complaint via the alternative means of amendment; e.g., with consent of the court or the opposing party. You've still got your amendment as a matter of right.
Only once. But once indeed.