記錄AWS Marketplace計量 API 呼叫 AWS CloudTrail - AWS Marketplace

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

記錄AWS Marketplace計量 API 呼叫 AWS CloudTrail

AWS Marketplace與提供使用者AWS CloudTrail、角色或AWS 服務中所採取之動作記錄的服務整合AWS Marketplace。 CloudTrail 擷取AWS Marketplace做為事件的 API 呼叫。擷取的呼叫包括從 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

下列範例顯示示範的BatchMeterUsage動作的 CloudTrail 記錄項目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對於容器

下列範例顯示示範的RegisterUsage動作的 CloudTrail 記錄項目AWS Marketplace Metering Service。在買方中部署一小時價格的容器產品時AWS 帳戶,容器中的軟體會呼叫買方RegisterUsage內部的軟體,以針對該亞馬遜彈性容器服務 (Amazon ECS) 任務或亞馬遜彈性 Kubernetes 服務 (Amazon EKS) 網繭啟動每小時計量。AWS Marketplace AWS 帳戶此 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 上的容器

下列範例顯示示範 Amazon EKS 上容器的MeterUsage動作AWS Marketplace Metering Service的 CloudTrail 日誌項目。當具有自定義計量的容器產品部署在買方中時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在 AMI 上

下列範例顯示示範AWS Marketplace Metering Service針對 Amazon 機器映像 (AMI) 的MeterUsage動作的 CloudTrail 記錄項目。當具有自定義計量的 AMI 產品部署在買方中時AWS 帳戶,來自 AMI 的軟件會在買方MeterUsage中調用每小時報告使用情況。AWS Marketplace 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" }