Amazon DevPay
Developer Guide (Version 2007-12-01 )
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Did this page help you?  Yes | No |  Tell us about it...

Basic Paid AMI Tasks

This section describes several tasks you might perform when managing your paid AMIs.

Tip

This section presents the instructions using the Amazon EC2 command line tools. Amazon EC2 also has programmatic APIs (Query and SOAP) and a GUI-based console (at https://console.aws.amazon.com/). For more information about using the console, go to the Amazon Elastic Compute Cloud Console and Command Line User Guide. For more information about using the APIs, go to the Amazon Elastic Compute Cloud Developer Guide and the Amazon Elastic Compute Cloud API Reference.

Associating a Product Code with an AMI

Each AMI can have a single product code associated with it. 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 AMI. For more information, see If You Have Multiple AMIs to Sell.

Important

You can associate a product code only with Amazon S3-backed AMIs (those using an instance store root device), and not Amazon EBS-backed AMIs (those using an Amazon EBS root device).

To associate a product code with an AMI

  • Use the ec2-modify-image-attribute command:

PROMPT>  ec2-modify-image-attribute ami-5bae4b32 --product-code 774F4FF8

productCodes        ami-5bae4b32            productCode   774F4FF8

To verify the product code is associated with the AMI

  • Use the ec2-describe-image-attribute command:

PROMPT> ec2-describe-image-attribute ami-5bae4b32 --product-code

productCodes        ami-5bae4b32            productCode   774F4FF8

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. For more information, see The Product Code and AMI Rebundling.

Sharing Your Paid AMI with Select Users or the Public

If you're creating a paid AMI, after you associate the product code with the AMI, you need to share the AMI with select customers or the public.

To share an AMI

  • Use the ec2-modify-image-attribute command.

    The following example shares the AMI with the public.

PROMPT>  ec2-modify-image-attribute ami-5bae4b32 --launch-permission -a all

launchPermission        ami-5bae4b32    ADD     group   all

Even though you've shared the AMI, no one can use it until they sign up for your product by going to the purchase URL. Once customers sign up, any instances of the paid AMI they launch will be billed at the rate you specified during product registration.

Confirming an Instance Is Running an AMI Associated with a Product Code

If you have created a product for others to use with their AMIs (the supported AMI scenario), you might want to confirm that a particular AMI is associated with your product code and a particular instance is currently running that AMI.

Note

You must be the owner of the product code to successfully call ec2-confirm-product-instance with that product code.

Because your customers don't own the product code, they should describe their instances to confirm their instances are running with your product code.

To confirm an instance is running an AMI associated with your product code

  • Use the ec2-confirm-product-instance command:

PROMPT>  ec2-confirm-product-instance 774F4FF8 -i i-10a64379

774F4FF8    i-10a64379  true 111122223333

If the AMI is associated with the product code, true is returned along with the AMI owner's account ID. Otherwise, false is returned.

Getting the Product Code from Within an Instance

A running Amazon EC2 instance can determine if a DevPay product code is attached to itself. The instance retrieves the product code like it retrieves its other metadata. For information about the retrieval of metadata, go to the "Instance Metadata" section of the Amazon Elastic Compute Cloud Developer Guide.

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

Following is an example response.

774F4FF8