Brett Kelly recently posted his TextExpander snippet for creating links to Amazon products and automatically including an affiliate code. It's an impressive bit of hoop-jumping and is quite handy.
I take a completely different approach that works for me, although you might still prefer Brett's.
In my version, you define a expansion like this:
http://www.amazon.com/exec/obidos/ASIN/%clipboard/YOUR_AFFILIATE_CODE
Define your trigger as you like, I use "pamazon".
To use this, go to a product's Amazon page and copy the product's ISBN (if it's a book) or the ASIN (if it's not a book) to your clipboard. The numbers are found in the "Product Details" section of all Amazon listings.
Type your trigger, and instantly, TextExpander spits out the full-formed URL to the product, complete with your affiliate code.
If you'd prefer a more verbose write-up of this tip, here's an older description of how to set it up. Also, you might be interested in: A tip for using Plain Clip with TextExpander.