使用记录 AWS Marketplace 计量API呼叫 AWS CloudTrail - AWS Marketplace

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用记录 AWS Marketplace 计量API呼叫 AWS CloudTrail

AWS Marketplace 与 AWS CloudTrail一项服务集成,该服务提供用户、角色或角色所执行操作 AWS 服务 的记录 AWS Marketplace。 CloudTrail 将API呼叫捕获 AWS Marketplace 为事件。捕获的调用包括来自 AWS Marketplace 控制台的调用和对 AWS Marketplace API操作的代码调用。

CloudTrail 在您创建账户 AWS 账户 时已在您的账户上启用。当支持的事件活动发生在中时 AWS Marketplace,该活动会与其他 CloudTrail 事件一起记录在 AWS 服务 事件历史记录中。您可以在 账户中查看、搜索和下载最新事件。

每个事件或日记账条目都包含有关生成请求的人员信息。身份信息有助于您确定以下内容:

  • 请求是使用根凭证还是 AWS Identity and Access Management 用户凭证发出的。

  • 请求是使用角色还是联合用户的临时安全凭证发出的。

  • 请求是否由其他 AWS 服务发出。

AWS Marketplace 支持将BatchMeterUsage操作作为事件记录在 CloudTrail日志文件中。

AWS Marketplace 计量API日志文件条目示例

例如:BatchMeterUsage

以下示例显示了一个 CloudTrail 日志条目,该条目演示了中的BatchMeterUsage操作 AWS Marketplace Metering Service。当卖家发送计量记录以报告其客户对所列软件即服务 (SaaS) 产品的使用情况时 AWS Marketplace,此 CloudTrail 日志条目将记录在卖家的日志条目中 AWS 账户。

{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:user/Alice", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2018-04-19T16:32:51Z", "eventSource": "metering-marketplace.amazonaws.com", "eventName": "BatchMeterUsage", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.0.2/24", "userAgent": "Coral/Netty14", "requestParameters": { "usageRecords": [ { "dimension": "Dimension1", "timestamp": "Apr 19, 2018 4:32:50 PM", "customerIdentifier": "customer1", "quantity": 1 } ], "productCode": "EXAMPLE_proCode" }, "responseElements": { "results": [ { "usageRecord": { "dimension": "Dimension1", "timestamp": "Apr 19, 2018 4:32:50 PM", "customerIdentifier": "customer1", "quantity": 1 }, "meteringRecordId": "bEXAMPLE-98f0-4e90-8bd2-bf0EXAMPLE1e", "status": "Success" } ], "unprocessedRecords": [ ] }, "requestID": "dEXAMPLE-251d-11e7-8d11-1f3EXAMPLE8b", "eventID": "cEXAMPLE-e6c2-465d-b47f-150EXAMPLE97", "readOnly": false, "eventType": "AwsApiCall", "recipientAccountId": "123456789012" } ] }

示例:容器的 RegisterUsage

以下示例显示了一个 CloudTrail 日志条目,该条目演示了中的RegisterUsage操作 AWS Marketplace Metering Service。在买家部署按小时定价的容器产品时,容器中的软件会在买家RegisterUsage内部调用 AWS 账户,为该亚马逊弹性容器服务 (亚马逊ECS) 任务或亚马逊弹性 Kubernetes Service (Amazon) Pod 启动每小时计量。 AWS Marketplace AWS 账户 EKS此 CloudTrail 日志条目记录在买家的日志中 AWS 账户。

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID:botocore-session-1111111111", "arn": "arn:aws:sts::123456789012:assumed-role/Alice/botocore-session-1111111111", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/Alice", "accountId": "123456789012", "userName": "Alice" }, "webIdFederationData": { "federatedProvider": "arn:aws:iam::123456789012:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/EXAMPLEFA1C58F08CDB049167EXAMPLE", "attributes": {} }, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-07-23T02:19:34Z" } } }, "eventTime": "2020-07-23T02:19:46Z", "eventSource": "metering-marketplace.amazonaws.com", "eventName": "RegisterUsage", "awsRegion": "us-east-1", "sourceIPAddress": "1.2.3.4", "userAgent": "aws-cli/1.18.103 Python/3.8.2 Linux/4.14.181-142.260.amzn2.x86_64 botocore/1.17.26", "requestParameters": { "productCode": "EXAMPLE_proCode", "publicKeyVersion": 1 }, "responseElements": { "signature": "eyJhbGciOiJQUzI1Ni..." }, "requestID": "dEXAMPLE-251d-11e7-8d11-1f3EXAMPLE8b", "eventID": "cEXAMPLE-e6c2-465d-b47f-150EXAMPLE97", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }

示例:MeterUsage适用于 Amazon 上的容器 EKS

以下示例显示了一个 CloudTrail 日志条目,该条目演示了在 Amazon 上 AWS Marketplace Metering Service 对容器执行的MeterUsage操作EKS。当在买方部署具有自定义计量的集装箱产品时 AWS 账户,集装箱中的软件会在买方MeterUsage内部调用每小时 AWS 账户 进行一次报告。 AWS Marketplace 此 CloudTrail 日志条目记录在买家的日志中 AWS 账户。

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID:botocore-session-1111111111", "arn": "arn:aws:sts::123456789012:assumed-role/Alice/botocore-session-1111111111", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/Alice", "accountId": "123456789012", "userName": "Alice" }, "webIdFederationData": { "federatedProvider": "arn:aws:iam::123456789012:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/EXAMPLEFA1C58F08CDB049167EXAMPLE", "attributes": {} }, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-07-23T01:03:26Z" } } }, "eventTime": "2020-07-23T01:38:13Z", "eventSource": "metering-marketplace.amazonaws.com", "eventName": "MeterUsage", "awsRegion": "us-east-1", "sourceIPAddress": "1.2.3.4", "userAgent": "aws-cli/1.18.103 Python/3.8.2 Linux/4.14.181-142.260.amzn2.x86_64 botocore/1.17.26", "requestParameters": { "timestamp": "Jul 23, 2020 1:35:44 AM", "usageQuantity": 1, "usageDimension": "Dimension1", "productCode": "EXAMPLE_proCode" }, "responseElements": { "meteringRecordId": "bEXAMPLE-98f0-4e90-8bd2-bf0EXAMPLE1e" }, "requestID": "dEXAMPLE-251d-11e7-8d11-1f3EXAMPLE8b", "eventID": "cEXAMPLE-e6c2-465d-b47f-150EXAMPLE97", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }

示例:MeterUsage开启 AMIs

以下示例显示了一个 CloudTrail 日志条目,该条目演示了 Amazon 系统映像 (AMIs) 中的MeterUsage操作。 AWS Marketplace Metering Service 当在买方部署 AWS Marketplace 具有自定义计量的AMI产品时 AWS 账户,买方MeterUsage内部AMI的 AWS 账户 软件会每小时报告使用情况。此 CloudTrail 日志条目记录在买家的日志中 AWS 账户。

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "EX_PRINCIPAL_ID:i-exampled859aa775c", "arn": "arn:aws:sts::123456789012:assumed-role/Alice/i-exampled859aa775c", "accountId": "123456789012", "accessKeyId": "EXAMPLE_KEY_ID", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::123456789012:role/Alice", "accountId": "123456789012", "userName": "Alice" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-07-10T23:05:20Z" }, "ec2RoleDelivery": "1.0" } }, "eventTime": "2020-07-10T23:06:42Z", "eventSource": "metering-marketplace.amazonaws.com", "eventName": "MeterUsage", "awsRegion": "us-east-1", "sourceIPAddress": "1.2.3.4", "userAgent": "aws-cli/1.16.102 Python/2.7.16 Linux/4.14.133-113.112.amzn2.x86_64 botocore/1.12.92", "requestParameters": { "productCode": "EXAMPLE_proCode", "timestamp": "Jul 10, 2020 11:06:41 PM", "usageDimension": "Dimension1", "usageQuantity": 1, "dryRun": false }, "responseElements": { "meteringRecordId": "bEXAMPLE-98f0-4e90-8bd2-bf0EXAMPLE1e" }, "requestID": "dEXAMPLE-251d-11e7-8d11-1f3EXAMPLE8b", "eventID": "cEXAMPLE-e6c2-465d-b47f-150EXAMPLE97", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }