Steps to Subscribe to Buy with Prime Events

📘

Buy with Prime API is now available for early access

Sign up for early access to the Buy with Prime API using the 'Sign Up' button below. The API may change as Amazon receives feedback and iterates on it.

You can subscribe and receive notifications for Buy with Prime events through Amazon EventBridge. This topic walks you through the steps to subscribe to events.

Prerequisites

To subscribe to Buy with Prime events, you must have an Amazon Web Services (AWS) account. To create an AWS account, go to the Amazon Web Services home page and then click Create an AWS account.

Steps to subscribe to Buy with Prime events

To subscribe to Buy with Prime events, take the following steps:

  1. Use the Buy with Prime Event interface to create a partner event source in Amazon EventBridge.
  2. Associate the partner event source with an event bus.
  3. Create a rule.
  4. (Recommended) Configure a dead letter queue for retrying failed events.

Step 1: Use the Buy with Prime Event interface

To receive events from Buy with Prime, call the createEventSubscription mutation. For an example, see Create an event subscription.

The API call requires the following information:

  • AWS account ID: The ID of the AWS account in which you want to receive events. For instructions on how to find your account ID, see Find your AWS account ID.
  • AWS region: The AWS region in which Buy with Prime creates your Amazon EventBridge partner event source. For a list of regions that Amazon EventBridge supports, see Amazon EventBridge endpoints.
  • Partner event source name: The name that you want the Buy with Prime API to assign to your partner event source in Amazon EventBridge. The partner event source name must be globally unique.
  • Event types: The types of events you want to subscribe to.

After successful completion of this request, you will see a new partner event source and event bus in the Amazon EventBridge console.

In the next step, you associate the partner event source with an event bus.

🚧

If you don't associate the partner event source with an event bus within 14 days, the partner event source will automatically be deleted and no events will be delivered to it.

Step 2: Associate the partner event source with an event bus

After Buy with Prime creates the partner event source and event bus in the previous step, you can associate the partner event source with your event bus.

To associate the partner event source with an event bus

  1. Open the Amazon EventBridge console.

  2. On the left, under Integration, click Partner event sources.

  3. Click the name of your partner event source.

  4. Click Associate with event bus and then select the event bus.

    You now have an event bus with the same name as the partner event source.

Step 3: Create a rule

With the partner event source configured to send events to your event bus, you can configure your rules and targets. Configure your rules to forward events to any target you like.

To create a rule

  1. Open the Amazon EventBridge console.

  2. On the left, under Buses, click Rules.

  3. In the drop-down menu, select the associated event bus.

  4. Choose Create rule, and then provide the following details:

    • Name: Name of the rule.
    • Description: Optional description.
    • Event Bus: The event bus that you associated with your partner event source.
  5. On the Build event pattern page, for Event Source, choose Other.

  6. For Event Pattern, paste the following JSON.

     {  
       "source": [{  
         "prefix": ""  
       }]  
     }  
    

    This event pattern sample is just a placeholder pattern that doesn't filter out anything; you can update it to meet your needs. To learn about custom filtering options, see Content filtering in Amazon EventBridge event patterns.

  7. Review the event pattern and update it if necessary.

  8. Choose Next.

  9. In Select targets, choose SQS queue, Lambda, or another target.
    To learn about how to set up API destinations to send events to HTTPS endpoints, see API destinations.

Step 4: (Recommended) Configure a dead letter queue for retrying failed events

Event delivery can fail if, for example, there are network issues, Amazon EventBridge lacks permission to the target resource, and so on. To avoid losing events that fail to be delivered, you can configure a dead-letter queue and send all failed events to it for processing later. To learn more about dead letter queues in Amazon EventBridge, see Event retry policy and using dead-letter queues.

Related topics