Skip to content

Instantly share code, notes, and snippets.

@RafalWilinski
Created April 16, 2022 15:08
Show Gist options
  • Save RafalWilinski/6c8d1f7d67e3b6cb9a47a4a9c0786f9c to your computer and use it in GitHub Desktop.
Save RafalWilinski/6c8d1f7d67e3b6cb9a47a4a9c0786f9c to your computer and use it in GitHub Desktop.
Visual diagram of How AWS Marketplace fit into your Monthly/Annual subscriptions model
sequenceDiagram
  participant User
  participant AWS Marketplace Product Page
  participant Your Marketplace Landing Form
  participant Your subscriptions API
  participant AWS Marketplace Metering Service

  User ->> AWS Marketplace Product Page: Visits
   User ->> AWS Marketplace Product Page: Purchases contract/subscription
  AWS Marketplace Metering Service ->> Subscriptions SNS: `subscription-updated` event
  AWS Marketplace Metering Service ->> Entitlements SNS: `entitlement-updated` event
  Note right of Subscriptions SNS: Important in contract updates/cancellations

  AWS Marketplace Product Page->>Your Marketplace Landing Form: Redirect with `x-amzn-marketplace-token` in body
  Note left of Your Marketplace Landing Form: We only know the AWS identity and IDs at this point. We need to collect email & extra data
  User -->> Your Marketplace Landing Form: Fills out extra details like email
  User -->> Your Marketplace Landing Form: Submits form
  Your Marketplace Landing Form->>Your subscriptions API: Form details + `x-amzn-marketplace-token`
  Your subscriptions API ->>+ AWS Marketplace Metering Service: aws meteringmarketplace resolve-customer --token <token>

  alt token valid
    AWS Marketplace Metering Service ->> Your subscriptions API: CustomerIdentifier, ProductCode
    Your subscriptions API ->>+ AWS Marketplace Metering Service: aws marketplaceentitlementservice get-entitlements ...
    AWS Marketplace Metering Service ->>- Your subscriptions API: Dimensions like "licensesCount"
    Note left of Your subscriptions API: Create subscription
    Your subscriptions API ->> Your Marketplace Landing Form: Success, further instructions, license details

  else token invalid
    AWS Marketplace Metering Service ->>- Your subscriptions API: Bad Request
    Your subscriptions API ->> Your Marketplace Landing Form: Display error
  end
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment