View a markdown version of this page

使用记录账单和成本管理 API 调用 Amazon CloudTrail - Amazon 计费
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

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

使用记录账单和成本管理 API 调用 Amazon CloudTrail

账单和成本管理已集成到 Amazon CloudTrail,一项提供用户、角色或某人所采取操作记录的服务 Amazon 账单和成本管理服务。 CloudTrail 将账单和成本管理的 API 调用捕获为事件,包括来自账单和成本管理控制台的调用以及从代码调用到账单和成本管理 API 的调用。如需查看完整清单 CloudTrail 与账单相关的事件,请参阅 Amazon Billing CloudTrail 事件。

如果您创建跟踪,则可以启用持续交付 CloudTrail 向 Amazon S3 存储桶发送事件,包括账单和成本管理事件。如果您不配置跟踪记录,则仍可在 CloudTrail 控制台的 Event history(事件历史记录)中查看最新事件。使用收集的信息 CloudTrail,您可以确定向账单和成本管理部门提出的请求、提出请求的 IP 地址、谁提出请求、何时提出请求以及其他详细信息。

要了解更多信息 CloudTrail,包括如何配置和启用它,请参阅 Amazon CloudTrail 用户指南。

Amazon Billing CloudTrail 事件

本节显示了以下内容的完整列表 CloudTrail 与账单和成本管理相关的事件。

事件名称 定义 事件源

AddPurchaseOrder

记录采购订单的创建。

purchase-orders.amazonaws.com

AcceptFxPaymentCurrencyTermsAndConditions

记录接受以美元以外的货币支付的条款和条件。 billingconsole.amazonaws.com

CloseAccount

记录账户的关闭。 billingconsole.amazonaws.com

CreateCustomerVerificationDetails

(仅适用于拥有印度账单或联系地址的客户)

记录账户客户验证详细信息的创建。

customer-verification.amazonaws.com

CreateOrigamiReportPreference

记录成本和使用情况报告的创建;仅限管理账户。 billingconsole.amazonaws.com

DeletePurchaseOrder

记录采购订单的删除。

purchase-orders.amazonaws.com

DeleteOrigamiReportPreferences

记录成本和使用情况报告的删除;仅限管理账户。 billingconsole.amazonaws.com

DownloadCommercialInvoice

记录商业发票的下载。 billingconsole.amazonaws.com

DownloadECSVForBillingPeriod

记录特定账单周期内 eCSV 文件(每月使用情况报告)的下载。 billingconsole.amazonaws.com

DownloadRegistrationDocument

记录税务登记文件的下载。 billingconsole.amazonaws.com

EnableBillingAlerts

记录接收的选择 CloudWatch 预估费用的账单提醒。 billingconsole.amazonaws.com

FindECSVForBillingPeriod

记录特定账单周期内对 ECSV 文件的检索日志。 billingconsole.amazonaws.com

GetAccountEDPStatus

记录对账户 EDP 状态的检索日志。 billingconsole.amazonaws.com

GetAddresses

记录对账户纳税地址、账单地址和联系地址的访问。 billingconsole.amazonaws.com

GetAllAccounts

记录对管理账户所有成员账户的访问。 billingconsole.amazonaws.com

GetBillsForBillingPeriod

记录特定账单周期内账户使用情况和费用的访问。 billingconsole.amazonaws.com

GetBillsForLinkedAccount

记录对管理账户的访问,检索特定账单周期内整合账单系列中任何一个成员账户的使用情况和费用。 billingconsole.amazonaws.com

GetCommercialInvoicesForBillingPeriod

记录对特定账单周期内账户商业发票元数据的访问。 billingconsole.amazonaws.com

GetConsolidatedBillingFamilySummary

记录对检索整个整合账单系列汇总的管理账户的访问。 billingconsole.amazonaws.com

GetCustomerVerificationEligibility

(仅适用于拥有印度账单或联系地址的客户)

记录对账户客户验证资格的检索。

customer-verification.amazonaws.com

GetCustomerVerificationDetails

(仅适用于拥有印度账单或联系地址的客户)

记录账户客户验证详细信息的检索。

customer-verification.amazonaws.com

GetLinkedAccountNames

记录特定账单周期内从管理账户检索属于其整合账单系列的成员账户名称。 billingconsole.amazonaws.com

GetPurchaseOrder

记录采购订单的检索。

purchase-orders.amazonaws.com

GetSupportedCountryCodes

记录对税务控制台支持的所有国家/地区代码的访问。 billingconsole.amazonaws.com

GetTotal

记录对账户总费用的检索日志。 billingconsole.amazonaws.com

GetTotalAmountForForecast

记录对特定账单周期内预测费用的访问。 billingconsole.amazonaws.com

ListCostAllocationTags

记录对成本分配标签的检索和列出。 ce.amazonaws.com

ListCostAllocationTagBackfillHistory

记录成本分配标签回填请求历史记录的检索和列表。 ce.amazonaws.com

ListPurchaseOrders

记录采购订单的检索和列示。

purchase-orders.amazonaws.com

ListPurchaseOrderInvoices

记录与采购订单关联的发票的检索和列示。

purchase-orders.amazonaws.com

ListTagsForResource

列出与资源关联的标签。对于 payments,此操作是指付款方式。对于 purchase-orders,此操作是指采购订单。

purchase-orders.amazonaws.com

RedeemPromoCode

记录账户的促销积分兑换。 billingconsole.amazonaws.com

SetAccountContractMetadata

为公共部门客户记录必要合同信息的创建、删除或更新。 billingconsole.amazonaws.com

SetAccountPreferences

记录账户名称、电子邮件和密码的更新。 billingconsole.amazonaws.com

SetAdditionalContacts

记录用于账单、操作和安全通信的备用联系人的创建、删除或更新。 billingconsole.amazonaws.com

SetContactAddress

记录账户所有者联系信息的创建、删除或更新,包括地址和电话号码。 billingconsole.amazonaws.com

SetCreatedByOptIn

记录选择加入 awscreatedby 成本分配标签首选项的操作。 billingconsole.amazonaws.com

SetCreditSharing

记录管理账户的信用共享首选项的历史记录。 billingconsole.amazonaws.com

SetFreetierBudgetsPreference

记录接收免费套餐使用提醒的首选项(选择加入或选择退出)。 billingconsole.amazonaws.com

SetFxPaymentCurrency

记录用于支付发票的首选币种的创建、删除或更新。 billingconsole.amazonaws.com

SetIAMAccessPreference

记录 IAM 用户访问账单控制台的权限的创建、删除或更新。此设置仅适用于具有 root 访问权限的客户。 billingconsole.amazonaws.com

SetPANInformation

将 PAN 信息的创建、删除或更新记录在下 Amazon 印度。 billingconsole.amazonaws.com

SetPayInformation

记录付款方式历史记录(发票或 credit/debit 卡)用于该帐户。 billingconsole.amazonaws.com

SetRISharing

记录的历史记录 RI/Savings 管理账户的计划共享偏好。 billingconsole.amazonaws.com

SetSecurityQuestions

记录安全挑战问题的创建、删除或更新以提供帮助 Amazon 将您标识为该账户的所有者。 billingconsole.amazonaws.com

StartCostAllocationTagBackfill

记录所有成本分配标签激活状态的回填请求的创建情况。 ce.amazonaws.com

TagResource

记录资源的标记情况。对于 payments,此操作是指付款方式。对于 purchase-orders,此操作是指采购订单。

purchase-orders.amazonaws.com

UntagResource

记录资源的标签删除情况。对于 payments,此操作是指付款方式。对于 purchase-orders,此操作是指采购订单。

purchase-orders.amazonaws.com

UpdateCostAllocationTagsStatus

记录特定成本分配标签的活动或非活动状态。 ce.amazonaws.com

UpdateCustomerVerificationDetails

(仅适用于拥有印度账单或联系地址的客户)

记录账户客户验证详细信息的更新。

customer-verification.amazonaws.com

UpdateOrigamiReportPreference

记录成本和使用情况报告的更新;仅限管理账户。 billingconsole.amazonaws.com

UpdatePurchaseOrder

记录采购订单的更新。

purchase-orders.amazonaws.com

UpdatePurchaseOrderStatus

记录采购订单状态的更新。

purchase-orders.amazonaws.com

ValidateAddress

记录对账户纳税地址的验证。 billingconsole.amazonaws.com

付款 CloudTrail 事件

本节显示了以下内容的完整列表 CloudTrail 的活动 付款 中的功能 Amazon Billing 控制台。这些 CloudTrail 事件的使用 payments.amazonaws.com 而不是 billingconsole.amazonaws.com。

事件名称 定义

ConnectedAccount_CreateConnectedAccount

记录关联账户的创建。

ConnectedAccount_DeleteConnectedAccount

记录关联账户的删除。

ConnectedAccount_GetConnectedAccount

记录已连接账户的检索。

ConnectedAccount_ListConnectedAccounts

记录已连接帐户列表的检索。

Financing_AcceptFinancingApplicationTerms

在融资申请中记录接受条款的情况。

Financing_CreateFinancingApplication

记录融资申请的创建。

Financing_GetFinancingApplication

记录融资申请的访问。

Financing_GetFinancingApplicationDocument

记录与融资申请关联的文档的访问。

Financing_GetFinancingLine

记录融资额度的访问。

Financing_GetFinancingLineWithdrawal

记录融资额度提款的访问。

Financing_GetFinancingLineWithdrawalDocument

记录与融资额度提款关联的文档的访问。

Financing_GetFinancingLineWithdrawalStatements

记录与融资额度提款关联的账单的访问。

Financing_GetFinancingOption

记录融资选项的访问权限。

Financing_ListFinancingApplications

记录融资申请元数据列表。

Financing_ListFinancingLines

记录融资额度元数据列表。

Financing_ListFinancingLineWithdrawals

记录融资额度提款元数据列表。

Financing_UpdateFinancingApplication

记录融资申请的更新。

Instruments_Authenticate

记录付款方式身份验证。

Instruments_Create

记录付款方式的创建。

Instruments_Delete

记录付款方式的删除。

Instruments_Get

记录付款方式的访问权限。

Instruments_List

记录付款方式元数据列表。

Instruments_StartCreate

记录创建付款方式之前的操作。

Instruments_Update

记录付款方式的更新。

ListTagsForResource

记录与付款资源关联的标签列表。

Policy_GetPaymentInstrumentEligibility

记录付款方式资格的访问权限。

Preferences_BatchGetPaymentProfiles

记录付款资料的访问权限。

Preferences_CreatePaymentProfile

记录付款资料的创建。

Preferences_DeletePaymentProfile

记录付款资料的删除。

Preferences_ListPaymentProfiles

记录付款资料元数据列表。

Preferences_UpdatePaymentProfile

记录付款资料的更新。

Programs_ListPaymentProgramOptions

记录付款方式选项列表。

Programs_ListPaymentProgramStatus

记录付款计划资格和注册状态列表。

TagResource

记录付款资源的标记情况。

TermsAndConditions_AcceptTermsAndConditionsForProgramByAccountId

记录已接受的付款条款和条件。

TermsAndConditions_GetAcceptedTermsAndConditionsForProgramByAccountId

记录已接受条款和条件的访问权限。

TermsAndConditions_GetRecommendedTermsAndConditionsForProgram

记录推荐条款和条件的访问权限。

UntagResource

记录付款资源标签的删除情况。

税收设置 CloudTrail 事件

本节显示了以下内容的完整列表 CloudTrail 的活动 税收设置 中的功能 Amazon Billing 控制台。这些 CloudTrail 事件的使用 taxconsole.amazonaws.com 要么 tax.amazonaws.com 而不是 billingconsole.amazonaws.com。

CloudTrail 税收设置控制台的事件
事件名称 定义 事件源

BatchGetTaxExemptions

记录某账户以及任何关联账户的美国免税信息访问。 taxconsole.amazon.com

CreateCustomerCase

记录客户支持单的创建以验证账户是否在美国免税。 taxconsole.amazon.com

DownloadTaxInvoice

记录税务发票的下载。 taxconsole.amazon.com

GetTaxExemptionTypes

通过税务控制台记录支持的所有美国免税类型的访问。 taxconsole.amazon.com

GetTaxInheritance

记录对账户遗产税偏好的访问(打开或关闭)。 taxconsole.amazon.com

GetTaxInvoicesMetadata

记录税务发票元数据的检索。 taxconsole.amazon.com

GetTaxRegistration

记录对账户的税务登记号码的访问。 taxconsole.amazon.com

PreviewTaxRegistrationChange

在确认之前记录税务登记变更的预览。 taxconsole.amazon.com

SetTaxInheritance

记录税务继承的首选项(选择加入或选择退出)。 taxconsole.amazon.com
CloudTrail 税务设置 API 的事件
事件名称 定义 事件源

BatchDeleteTaxRegistration

记录多个账户税务登记的批量删除。 tax.amazonaws.com

BatchGetTaxExemptions

记录对一个或多个账户免税信息的访问。 tax.amazonaws.com

BatchPutTaxRegistration

记录多个账户税务登记的设置。

tax.amazonaws.com

DeleteTaxRegistration

记录账户税务登记号的删除情况。

tax.amazonaws.com

GetTaxExemptionTypes

通过税务控制台记录对支持的所有免税类型的访问。 tax.amazonaws.com

GetTaxInheritance

记录对账户遗产税偏好的访问(打开或关闭)。 tax.amazonaws.com

GetTaxRegistration

记录对账户税务登记的访问。 tax.amazonaws.com

GetTaxRegistrationDocument

记录检索账户的税务登记文件。 tax.amazonaws.com

ListTaxExemptions

记录对免税的访问权限 Amazon 组织账户。 tax.amazonaws.com

ListTaxRegistrations

记录对管理账户所有成员账户的税务登记详细信息的访问。

tax.amazonaws.com

PutTaxExemption

记录设置一个或多个账户的免税信息。

tax.amazonaws.com

PutTaxInheritance

记录设置税务继承的首选项(选择加入或选择退出)。 tax.amazonaws.com

PutTaxRegistration

记录账户税务登记的设置。 tax.amazonaws.com

开具发票 CloudTrail 事件

本节显示了以下内容的完整列表 CloudTrail 的活动 开具发票 中的功能 Amazon Billing 控制台。这些 CloudTrail 事件的使用 invoicing.amazonaws.com。

事件名称 定义

CreateInvoiceUnit

记录发票单位的创建。

DeleteInvoiceUnit

记录发票单位的删除。

GetInvoiceProfiles

记录账户发票配置文件的访问。

GetInvoiceUnit

记录发票单位的访问。

ListInvoiceUnits

记录发票单位的检索和列示。

UpdateInvoiceUnit

记录发票单位的更新。

私人定价 CloudTrail 事件

本节显示了以下内容的完整列表 CloudTrail 的活动 私人定价 中的功能 Amazon Billing 控制台。这些 CloudTrail 事件使用 billing.amazonaws.com。

事件名称 定义

AssociateContract

验证私人定价合同访问权限的日志。

CancelContractualInvestmentAttestation

记录投资认证的取消。

CreateContractualInvestmentAttestation

记录基于结果的投资的认证的创建情况。

DisassociateContract

删除私人定价合同访问权限的日志。

GetContractInformation

记录私有定价合同详细信息的检索。

ListContracts

记录账户可用的私有定价合同的检索和清单。

ListContractualInvestmentAttestations

记录私募定价合约的投资证明的检索和清单。

ListContractualInvestments

记录私募定价合约基于结果的投资的检索和清单。

ListContractualInvestmentSummaries

记录私募定价合约的投资摘要的检索和清单。

中的账单和成本管理信息 CloudTrail

CloudTrail 已在您的上启用 Amazon 创建账户时的账户。当账单和成本管理中发生支持的事件活动时,该活动将记录在 CloudTrail 活动以及其他 Amazon 中的服务事件 事件历史。您可以查看、搜索和下载您的近期事件 Amazon 账户。有关更多信息,请参阅 使用以下方式查看活动 CloudTrail 事件历史 在 Amazon CloudTrail 用户指南。

为了持续记录您的事件 Amazon 账户(包括账单和成本管理的事件)可创建跟踪。跟踪启用 CloudTrail 将日志文件传输到亚马逊 S3 存储桶。默认情况下,当您在控制台中创建跟踪时,该跟踪将应用于所有跟踪 Amazon 地区。该跟踪记录了来自所有区域的事件 Amazon 将日志文件分区并传输到您指定的 Amazon S3 存储桶。此外,你可以配置其他 Amazon 服务,用于进一步分析中收集的事件数据并采取行动 CloudTrail 日志。

有关更多信息,请参阅下列内容:

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

  • 请求是使用根用户凭证还是 IAM 用户凭证发出的。

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

  • 请求是否由其他人提出 Amazon 服务。

有关更多信息,请参阅 CloudTrail 用户指南 中的 Amazon CloudTrail userIdentity 元素。

CloudTrail 日志条目示例

以下示例适用于特定的账单和成本管理 CloudTrail 日志条目场景。

账单和成本管理日志文件条目

一个 踪迹 是一种配置,允许将事件作为日志文件传输到您指定的 Amazon S3 存储桶。 CloudTrail 日志文件包含一个或多个日志条目。事件代表来自任何来源的单个请求,包括有关请求的操作、操作的日期和时间、请求参数等的信息。 CloudTrail 日志文件不是公共 API 调用的有序堆栈跟踪,因此它们不按任何特定顺序出现。

以下示例显示了 CloudTrail 显示以下内容的日志条目 SetContactAddress 行动。

{ "eventVersion": "1.05", "userIdentity": { "accountId": "111122223333", "accessKeyId": "AIDACKCEVSQ6C2EXAMPLE" }, "eventTime": "2018-05-30T16:44:04Z", "eventSource": "billingconsole.amazonaws.com", "eventName": "SetContactAddress", "awsRegion": "us-east-1", "sourceIPAddress": "100.100.10.10", "requestParameters": { "website": "https://amazon.com", "city": "Seattle", "postalCode": "98108", "fullName": "Jane Doe", "districtOrCounty": null, "phoneNumber": "206-555-0100", "countryCode": "US", "addressLine1": "Nowhere Estates", "addressLine2": "100 Main Street", "company": "AnyCompany", "state": "Washington", "addressLine3": "Anytown, USA", "secondaryPhone": "206-555-0101" }, "responseElements": null, "eventID": "5923c499-063e-44ac-80fb-b40example9f", "readOnly": false, "eventType": "AwsConsoleAction", "recipientAccountId": "1111-2222-3333" }

税务控制台

以下示例显示了 CloudTrail 日志条目使用 CreateCustomerCase 行动。

{ "eventVersion":"1.05", "userIdentity":{ "accountId":"111122223333", "accessKeyId":"AIDACKCEVSQ6C2EXAMPLE" }, "eventTime":"2018-05-30T16:44:04Z", "eventSource":"taxconsole.amazonaws.com", "eventName":"CreateCustomerCase", "awsRegion":"us-east-1", "sourceIPAddress":"100.100.10.10", "requestParameters":{ "state":"NJ", "exemptionType":"501C", "exemptionCertificateList":[ { "documentName":"ExemptionCertificate.png" } ] }, "responseElements":{ "caseId":"case-111122223333-iris-2022-3cd52e8dbf262242" }, "eventID":"5923c499-063e-44ac-80fb-b40example9f", "readOnly":false, "eventType":"AwsConsoleAction", "recipientAccountId":"1111-2222-3333" }

付款

以下示例显示了 CloudTrail 日志条目使用 Instruments_Create 行动。

{ "eventVersion": "1.08", "userIdentity": { "type": "Root", "principalId": "111122223333", "arn": "arn:aws:iam::111122223333:<iam>", "accountId": "111122223333", "accessKeyId": "AIDACKCEVSQ6C2EXAMPLE", "sessionContext": { "sessionIssuer": {}, "webIdFederationData": {}, "attributes": { "creationDate": "2024-05-01T00:00:00Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-05-01T00:00:00Z", "eventSource": "payments.amazonaws.com", "eventName": "Instruments_Create", "awsRegion": "us-east-1", "sourceIPAddress": "100.100.10.10", "userAgent": "AWS", "requestParameters": { "accountId": "111122223333", "paymentMethod": "CreditCard", "address": "HIDDEN_DUE_TO_SECURITY_REASONS", "accountHolderName": "HIDDEN_DUE_TO_SECURITY_REASONS", "cardNumber": "HIDDEN_DUE_TO_SECURITY_REASONS", "cvv2": "HIDDEN_DUE_TO_SECURITY_REASONS", "expirationMonth": "HIDDEN_DUE_TO_SECURITY_REASONS", "expirationYear": "HIDDEN_DUE_TO_SECURITY_REASONS", "tags": { "Department": "Finance" } }, "responseElements": { "paymentInstrumentArn": "arn:aws:payments::111122223333:payment-instrument:4251d66c-1b05-46ea-890c-6b4acf6b24ab", "paymentInstrumentId": "111122223333", "paymentMethod": "CreditCard", "consent": "NotProvided", "creationDate": "2024-05-01T00:00:00Z", "address": "HIDDEN_DUE_TO_SECURITY_REASONS", "accountHolderName": "HIDDEN_DUE_TO_SECURITY_REASONS", "expirationMonth": "HIDDEN_DUE_TO_SECURITY_REASONS", "expirationYear": "HIDDEN_DUE_TO_SECURITY_REASONS", "issuer": "Visa", "tail": "HIDDEN_DUE_TO_SECURITY_REASONS" }, "requestID": "7c7df9c2-c381-4880-a879-2b9037ce0573", "eventID": "c251942f-6559-43d2-9dcd-2053d2a77de3", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management", "sessionCredentialFromConsole": "true" }