A running Amazon EC2 instance can determine if an Amazon DevPay product code is attached to itself. The instance retrieves the product code like it retrieves its other metadata. For more information about the retrieval of metadata, see Instance Metadata.
The instance retrieves the product code by querying a web server with this REST-like API call:
GET http://169.254.169.254/2007-03-01/meta-data/product-codes