In this video, you’ll see you’ll see Part 2 of how to create a container product on AWS Marketplace.
By listing your container product on AWS Marketplace, you can grow your customer base,
protect your product’s Intellectual Property, and improve efficiency and reliability.
This video is part 2 of a three-part series.
In Part 1, we saw how to create a container
product for AWS Marketplace and publish it in a limited state.
In this segment, we’ll see how to complete a Marketplace API integration needed for a
pricing model and build a container image for uploading it to AWS Marketplace.
Specifically, we’re going to deepdive into the hourly pricing model and go through
the process of setting up integration with the RegisterUsage API using example code.
For this demonstration, we’ll be using an NGINX Docker container
as our product to be listed.
We want to charge the customer for the amount of time they use the container.
To do this, we need to integrate the container product with the RegisterUsage API.
First, let’s go to the AWS Marketplace
Management Portal and find the product information in the limited listing.
We can find the product ID and product code here.
For demonstration purposes, we’ve already created a Python script
for calling the RegisterUsage API that includes the product code.
We’ll incorporate that Python script into the Docker file.
Next, let’s build the container image.
The RegisterUsage operation can only be called from an Amazon Elastic
Container Service (ECS) task or EKS pod.
Trying to call it locally will produce an error.
For our purposes, we have already created an EKS cluster to call the operation from.
We also already have eksctl and kubectl installed.
If we run the “kubectl get all” command,
we can see that a basic cluster is already defined.
Let’s go ahead and build our container image.
The container is built.
The next step is tagging it.
We want the tag to include the name of the repository where we’ll be pushing the container.
Again, we can get that from the limited listing in the AWS Marketplace Management Portal.
We’ve already created a repository,
but let’s briefly go through the process of creating a new one.
We can add up to 50 repositories per product listing using this option.
We can fill in the name of the repository and click submit,
and a request will be added to the queue.
Let’s go back now and review the request for the repository we’ve already created.
Notice the status of request.
Now we’ll tag the container image with the URL of the repository.
Next, let’s see how to push the image to the repository.
First, we’ll log in to the Docker repository.
We can obtain the push commands
for the repository in the Marketplace Management Portal.
Let’s push the container image to the repository.
Next, we need to make sure our EKS cluster service account can
actually be used for the RegisterUsage API calls.
Let’s create an AWS Identity and Access Management (IAM)
OpenID Connect (OIDC) provider association for the cluster.
We already have an IAM policy with the required permissions,
hence this error message.
Let’s create a new service account for the cluster and add the policy.
This command will create a CloudFormation stack behind the scenes.
Let’s take a quick look at the stack.
Here it is.
Let’s run this container.
This is the kubectl command for starting that container, with the name of the pod,
the name of the image, the repository name, and the tag name: test_one.
Next, we’ll test the container we just uploaded
to the Marketplace Management Portal with the tag test_one.
Now that we’ve kickstarted the pod, let’s check if there’s a log file.
Notice that this code specifies the creation of a log file when the Python script is run.
Let’s view the log file.
We can see that when this container started it called the Python script.
The signature will contain details like the product code and this key.
Along with those details, we got back a 200 HTTP status code, as expected.
Next, let’s stop the container.
We now know that the RegisterUsage call for the hourly usage of our
container product works.
Let’s delete the pod.
Next, let’s try building an image with the wrong product code.
We’ll go ahead and run the container again.
Let’s check the log file.
This time, the log file says an error occurred due to an invalid product code.
Let’s stop and delete the pod.
In the next part of this video series,
we’ll continue the process of creating our AWS Marketplace container product.
You’ve just seen Part 2 of how to create a container product in AWS Marketplace.
You can learn more about this topic in the description and links for this video.
Thanks for watching. Now it’s your turn to try.