|

🔎Tracking AWS Marketplace Activity with CloudTrail

Want to keep a close eye on actions related to your AWS Marketplace usage or seller operations? AWS CloudTrail is your essential tool! By logging API calls, CloudTrail provides a detailed history of activity within your AWS account.This post will guide you on exactly how to find and interpret AWS Marketplace events in your CloudTrail logs.

Contents

🛠️ Finding Marketplace Actions

To view AWS Marketplace actions in CloudTrail, make sure CloudTrail is enabled and look for events originating from two specific event sources:

  1. metering-marketplace.amazonaws.com
  2. catalog.marketplace.amazonaws.com

These event sources log crucial activities for both buyers and sellers interacting with the Marketplace.

Supported Marketplace APIs Logged in CloudTrail

CloudTrail records API calls made to various AWS Marketplace services, offering comprehensive oversight:

  • Metering Service: Logs actions like BatchMeterUsage, which Marketplace sellers use to report customer usage for their SaaS products. This is vital for accurate billing.
  • Catalog API: Logs actions such as StartChangeSet, DescribeChangeSet, and ListChangeSets, which are used by sellers to manage and update their product listings on the Marketplace.

Understanding Marketplace Event Details

When you find a Marketplace event in CloudTrail, it contains rich details that help you understand “who did what, when, and how.” Look for these key fields:

FieldDescription
eventSourceIdentifies the service: metering-marketplace.amazonaws.com or catalog.marketplace.amazonaws.com.
eventNameThe specific API action performed (e.g., BatchMeterUsage, StartChangeSet).
userIdentityDetails on who made the request (IAM user, role, federated user).
requestParametersThe input provided to the API call.
responseElementsThe output or result of the API call.

📍 Where to Find Marketplace Events

You have several options for accessing and analyzing your Marketplace events:

  1. CloudTrail Console: Navigate to Event history and use the Event source or Event name filters to narrow down the results.
  2. CloudTrail Logs in S3: If you’ve created a trail, logs are delivered to your designated S3 bucket. You can use powerful querying tools like Amazon Athena or CloudWatch Logs Insights to analyze these large datasets efficiently.
  3. AWS CLI Lookup: Use the AWS Command Line Interface for quick, targeted searches:Bashaws cloudtrail lookup-events --lookup-attributes AttributeKey=EventSource,AttributeValue=metering-marketplace.amazonaws.com

🔍 Example Log Snippet: The Seller’s View

For sellers, reviewing a BatchMeterUsage event is crucial for verifying billing operations. Here is a simplified example showing a successful usage submission:

{
  "eventSource": "metering-marketplace.amazonaws.com",
  "eventName": "BatchMeterUsage",
  "userIdentity": {
    "type": "IAMUser",
    "userName": "MarketplaceSeller" 
  },
  "requestParameters": {
    "productCode": "EXAMPLE_CODE",
    "usageRecords": [...] 
  },
  "responseElements": {
    "results": [...],
    "unprocessedRecords": [] 
  }
}

In this example, the responseElements confirm the status of the metering records, helping the seller verify that usage records were submitted successfully.

To better your MarketPlace Tracking, tag the marketplace resources (Tag the resources that are launched from the marketplace)