You must be the owner of an AMI to associate a product code with it. You can associate a single product code with more than one paid AMI. You might do this if you have similar versions of an AMI (for example, a 32-bit version and a 64-bit version), you've assigned them all the same price, and you'd like to minimize the number of Amazon DevPay product codes you have (to make your bookkeeping easier).
You can't change or remove the productCodes attribute after you've set it.
If you want to use the same image without the product code or associate a different product code
with the image, you must reregister the image to obtain a new AMI ID. You can then use that AMI
without a product code or associate the new product code with the AMI ID.
Example
The following example associates the ami-2bb65342 AMI with the 774F4FF8 product code.