The reason it will not work is because the software is stripping the code and will continue to do so.
Advertising outside of WordAds at WordPress.com, http://wordads.co/ including affiliate links, is not allowed. For full details, please see:
The only exceptions are in italics:
Affiliate marketing blogs: Blogs with the primary purpose of driving traffic to affiliate programs and get-rich-quick schemes (“Make six figures from home!!”, “20 easy steps to top profits!!”, etc). This includes multi-level marketing (MLM) blogs and pyramid schemes.
To be clear, people writing their own original book, movie or game reviews and linking them to Amazon, or people linking to their own products on Etsy do NOT fall into this category.
Here is a thread in the support forums that talks more about which affiliate links are OK or not OK. http://en.wordpress.com/types-of-blogs/
Yes, you can have Amazon affiliate links on a self hosted WordPress.org install. However, WordPress.com and WordPress.org are completely separate so there is no upgrade involved. You hire a web hosted and set up your own self hosted install.