I don't know Amazon's policy, but many companies have you sign something when you start saying that they own anything and everything you work on, even if it's in your free time. Most of these companies also will provide you forms you can fill out explaining the projects you work on (or own) that will give you control/ownership of it rather than the company. I've filled out the same paperwork for all 4 companies I've worked at during my career.
If you have something new you want to work on, you normally need to contact your company's legal or HR team and get signoff that you are allowed to work on it (and that you can maintain ownership of it).