How to sell pay per use SaaS to AWS customers in the AWS Marketplace
AWS Marketplace allows you to sell software to AWS customers. The customer can either run the software on its own (using AMIs and optional CloudFormation), or you can offer the software as a service (SaaS). You can also offer containers and machine learning algorithms in the AWS Marketplace.
Do you prefer listening to a podcast episode over reading a blog post? Here you go!
The following table summaries your options to sell software in the AWS Marketplace.
Software delivery | Pricing |
---|---|
AMI | free BYOL hourly monthly annual pay per use |
AMI + CloudFormation | free BYOL hourly monthly annual pay per use |
AMIs + CloudFormation | same as above for first AMI only |
SaaS | pay per use contract |
We started selling our Slack based Incident Management for AWS in the AWS Marketplace in June 2019. So far, we are thrilled with the results. We simplified purchasing marbot, which increased the number of customers. Now, marbot appears on the AWS bill of our customers. If you plan to start a side business in the AWS tooling space, we highly recommend to check out AWS Marketplace!
In this post, you will learn how to sell pay per use SaaS in the AWS Marketplace. I will show you the overall process and finish with code snippets to implement the process.
Requirements
- I suggest you create a new AWS account (aka Marketplace Account) to interact with the AWS Marketplace Management Portal
- Register as an AWS Marketplace seller
- Create your SaaS product in the AWS Marketplace Management Portal. Creating a product is a chicken and egg problem. You need some information from AWS (like a
ProductCode
and an SNS topic), and AWS needs information from you. The process has several steps and comes with a testing stage. - Create a new AWS account (aka SaaS Account) where you run your software.
Flows
Once you have created your product, you have to implement three different flows:
- Deal with subscribes: validate the token you receive from AWS Marketplace via an HTTP POST request
- Send metering data to AWS Marketplace
- Deal with unsubscribes: received via an SNS topic
The tricky part is to understand how various parties interact with each other.
- Customer
- AWS
- Your Marketplace Account
- Your SaaS Account
Let’s go through the flows in detail.
Subscribe flow
The following figure demonstrates the interaction.
- An AWS customer clicks on the subscribe button in the AWS Marketplace
- AWS Marketplace forwards the new customer to your website (using an HTTP POST request) with a token
- Your app assumes an IAM role in the Marketplace Account and calls the ResolveCustomer API to validate the token.
- AWS Marketplace publishes a
subscribe-success
message to the SNS topic
Once you received the subscribe-success
message, you can report usage for the customer.
Report Usage flow
Every hour, you have to report the usage for every customer. For example, marbot is billed per active user. So we are sending the number of active users for every customer every hour.
To do so, your app assumes an IAM role in the Marketplace Account and calls the BatchMeterUsage API to report usage.
Unsubscribe flow
At any time, a customer can cancel the subscription.
- AWS Marketplace publishes an
unsubscribe-pending
message to the SNS topic. - One hour passes (you can still report usage for the customer to finish the started hour)
- AWS Marketplace publishes an
unsubscribe-success
message to the SNS topic.
You cannot report usage anymore for the customer.
If you are interested in the implementation details, read on.
Your SaaS Account infrastructure
The following CloudFormation template creates the SQS queue in your SaaS account that will receive the unsubscribe notification.
|
You will learn to process the messages later.
Your Marketplace Account infrastructure
The following CloudFormation template creates the SNS subscription to connect the SNS topic created by AWS marketplace with the SQS queue in the SaaS Account. Besides that, an IAM role is created that you can use in the SaaS Account to validate registration tokens and report usage.
|
Let’s look at the software side of things.
Validate token
Once a new customer subscribes to your SaaS product, AWS Marketplace forwards the new customer to your website using an HTTP POST request. The x-amzn-marketplace-token
parameter needs to be validated on your side. The code assumes the IAM role in the SaaS Account first before the ResolveCustomer API call is made to validate the token.
const AWS = require('aws-sdk'); |
If the token is valid, you likely want to collect additional information from the new customer and add some entries to your database.
Report usage
Every hour, you have to report the usage of every customer. The code assumes the IAM role in the SaaS Account first before the BatchMeterUsage API call is made.
const AWS = require('aws-sdk'); |
Unsubscribe
Sad, but true! Sometimes a customer leaves us. AWS Marketplace will send a message to the SNS Topic that you connected to your SQS queue.
The message format is only partially documented. We observed the following message schema:
{ |
The action
can be one of the following:
subscribe-success
: can be ignored for pay per use SaaS (only important if you integrate directly into API Gateway with keys and usage plans).subscribe-fail
: never seen this. Not sure how to handle it.unsubscribe-pending
: the customer is not paying anymore. You can still send usage data for the current hour.unsubscribe-success
: the customer is not paying anymore. Remove or disable in your database.entitlement-updated
: can be ignored for pay per use SaaS.
Critique
Besides our overall satisfaction with AWS Marketplace, we also experienced a few issues.
- AWS Marketplace operates from the US and is always paid in USD via credit card. This sometimes confuses our clients from Germany which pay their AWS bill in EUR via direct debit.
- Sales taxes are a mystery. We are not sure if AWS Marketplace is comparable to Apple’s App Store, where Apple is the seller.
- Notification messages are mostly undocumented. Shout out to @hoegertn for sharing his learnings with me!
Summary
AWS Marketplace is an easy way to sell software to AWS customers. You have to implement three flows: new subscribers, report usage, and unsubscribes. It was never easier to monetize your AWS related business!