使用 記錄 Macie API 呼叫 AWS CloudTrail - Amazon Macie

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

使用 記錄 Macie API 呼叫 AWS CloudTrail

Amazon Macie 與 整合AWS CloudTrail,此服務提供使用者、角色或 所採取動作的記錄 AWS 服務。CloudTrail 會將 Macie 的所有 API 呼叫擷取為管理事件。擷取的呼叫包括來自 Amazon Macie 主控台的呼叫,以及對 Amazon Macie API 操作的程式設計呼叫。透過使用 CloudTrail 收集的資訊,您可以判斷向 Macie 提出的請求、提出請求的 IP 地址、提出請求的時間,以及其他詳細資訊。

每一筆事件或日誌專案都會包含產生請求者的資訊。身分資訊可協助您判斷下列事項:

  • 該請求是使用根使用者還是使用者憑證提出。

  • 是否代表 AWS IAM Identity Center 使用者提出請求。

  • 提出該請求時,是否使用了特定角色或聯合身分使用者的暫時安全憑證。

  • 該請求是否由另一項 AWS 服務服務提出。

當您建立帳戶 AWS 帳戶 時,CloudTrail 會在 中處於作用中狀態,而且您會自動存取 CloudTrail 事件歷史記錄。CloudTrail 事件歷史記錄為 AWS 區域中過去 90 天記錄的管理事件,提供可檢視、可搜尋、可下載且不可變的記錄。如需詳細資訊,請參閱AWS CloudTrail 《 使用者指南》中的使用 CloudTrail 事件歷史記錄。檢視事件歷史記錄不會產生 CloudTrail 費用。

如需 AWS 帳戶 過去 90 天在您的 中持續記錄事件,請建立追蹤或 CloudTrail Lake 事件資料存放區。

CloudTrail 追蹤

線索能讓 CloudTrail 將日誌檔案交付至 Amazon S3 儲存貯體。使用 建立的所有線索 AWS Management Console 都是多區域。您可以使用 AWS CLI建立單一或多區域追蹤。建議您建立多區域追蹤,因為您擷取 AWS 區域 帳戶中所有 的活動。如果您建立單一區域追蹤,您只能檢視追蹤 AWS 區域中記錄的事件。如需追蹤的詳細資訊,請參閱《AWS CloudTrail 使用者指南》中的為您的 AWS 帳戶建立追蹤為組織建立追蹤

您可以透過建立追蹤,免費將持續管理事件的一個複本從 CloudTrail 傳遞至您的 Amazon S3 儲存貯體,但這樣做會產生 Amazon S3 儲存費用。如需 CloudTrail 定價的詳細資訊,請參閱 AWS CloudTrail 定價。如需 Amazon S3 定價的相關資訊,請參閱 Amazon S3 定價

CloudTrail Lake 事件資料存放區

CloudTrail Lake 讓您能夠對事件執行 SQL 型查詢。CloudTrail Lake 會將分列式 JSON 格式的現有事件轉換為 Apache ORC 格式。ORC 是一種單欄式儲存格式,針對快速擷取資料進行了最佳化。系統會將事件彙總到事件資料存放區中,事件資料存放區是事件的不可變集合,其依據為您透過套用進階事件選取器選取的條件。套用在事件資料存放區的選擇器,控制哪些事件持續存在並可供您查詢。如需 CloudTrail Lake 的詳細資訊,請參閱AWS CloudTrail 《 使用者指南》中的使用 AWS CloudTrail Lake

CloudTrail Lake 事件資料存放區和查詢會產生費用。建立事件資料存放區時,您可以選擇用於事件資料存放區的定價選項。此定價選項將決定擷取和儲存事件的成本,以及事件資料存放區的預設和最長保留期。如需 CloudTrail 定價的詳細資訊,請參閱 AWS CloudTrail 定價

中的 Macie 管理事件 AWS CloudTrail

管理事件提供有關在 資源上執行的管理操作的資訊 AWS 帳戶。這些也稱為控制平面操作。根據預設,CloudTrail 記錄管理事件。

Amazon Macie 會將所有 Macie 控制平面操作記錄為 CloudTrail 中的管理事件。例如,對 ListFindingsDescribeBucketsCreateClassificationJob操作的呼叫會在 CloudTrail 中產生管理事件。每個事件都包含 eventSource 欄位。此欄位表示已向 提出 AWS 服務 請求。對於 Macie 事件,此欄位的值為:macie2.amazonaws.com

如需 Macie 在 CloudTrail 中記錄的控制平面操作清單,請參閱《Amazon Macie API 參考》中的操作

中的 Macie 事件範例 AWS CloudTrail

一個事件代表任何來源提出的單一請求,並包含請求 API 操作的相關資訊、操作的日期和時間、請求參數等。CloudTrail 日誌檔案不是公有 API 呼叫的已排序堆疊追蹤,因此事件不會以任何特定順序顯示。

下列範例顯示示範 Amazon Macie 操作的 CloudTrail 事件。如需事件可能包含的資訊詳細資訊,請參閱AWS CloudTrail 《 使用者指南》中的 CloudTrail 記錄內容

範例:列出問題清單

下列範例顯示 Amazon Macie ListFindings操作的 CloudTrail 事件。在此範例中, AWS Identity and Access Management (IAM) 使用者 (Mary_Major) 使用 Amazon Macie 主控台來擷取其帳戶目前政策調查結果的相關資訊子集。

{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:user/Mary_Major", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "Mary_Major", "sessionContext":{ "attributes": { "creationdate": "2024-11-14T15:49:57Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-11-14T16:09:56Z", "eventSource": "macie2.amazonaws.com", "eventName": "ListFindings", "awsRegion": "us-east-1", "sourceIPAddress": "198.51.100.1", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", "requestParameters": { "sortCriteria": { "attributeName": "updatedAt", "orderBy": "DESC" }, "findingCriteria": { "criterion": { "archived": { "eq": [ "false" ] }, "category": { "eq": [ "POLICY" ] } } }, "maxResults": 25, "nextToken": "" }, "responseElements": null, "requestID": "d58af6be-1115-4a41-91f8-ace03example", "eventID": "ad97fac5-f7cf-4ff9-9cf2-d0676example", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

範例:擷取問題清單的敏感資料範例

此範例顯示 CloudTrail 事件,用於擷取和顯示 Amazon Macie 在調查結果中報告的敏感資料範例。在此範例中,IAM 使用者 (JohnDoe) 使用 Amazon Macie 主控台來擷取和揭露敏感資料範例。使用者的 帳戶設定為擔任 IAM 角色 (MacieReveal),以從受影響的 Amazon Simple Storage Service (Amazon S3) 物件擷取和顯示敏感資料範例。

下列事件顯示使用者使用 Amazon Macie GetSensitiveDataOccurrences操作擷取和顯示敏感資料範例之請求的詳細資訊。

{ "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "UU4MH7OYK5ZCOAEXAMPLE:JohnDoe", "arn": "arn:aws:sts::111122223333:assumed-role/Admin/JohnDoe", "accountId": "111122223333", "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "UU4MH7OYK5ZCOAEXAMPLE", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "creationDate": "2024-12-12T14:40:23Z", "mfaAuthenticated": "false" } } }, "eventTime": "2024-12-12T17:04:47Z", "eventSource": "macie2.amazonaws.com", "eventName": "GetSensitiveDataOccurrences", "awsRegion": "us-east-1", "sourceIPAddress": "198.51.100.252", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", "requestParameters": { "findingId": "3ad9d8cd61c5c390bede45cd2example" }, "responseElements": null, "requestID": "c30cb760-5102-47e7-88d8-ff2e8example", "eventID": "baf52d92-f9c3-431a-bfe8-71c81example", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }

下一個事件顯示 Macie 的詳細資訊,然後使用 (MacieReveal) AssumeRole操作來擔任指定的 IAM 角色 AWS Security Token Service (AWS STS)。

{ "eventVersion": "1.08", "userIdentity": { "type": "AWSService", "invokedBy": "reveal-samples.macie.amazonaws.com" }, "eventTime": "2024-12-12T17:04:47Z", "eventSource": "sts.amazonaws.com", "eventName": "AssumeRole", "awsRegion": "us-east-1", "sourceIPAddress": "reveal-samples.macie.amazonaws.com", "userAgent": "reveal-samples.macie.amazonaws.com", "requestParameters": { "roleArn": "arn:aws:iam::111122223333:role/MacieReveal", "roleSessionName": "RevealCrossAccount" }, "responseElements": { "credentials": { "accessKeyId": "AKIAI44QH8DHBEXAMPLE", "sessionToken": "XXYYaz... EXAMPLE_SESSION_TOKEN XXyYaZAz", "expiration": "Dec 12, 2024, 6:04:47 PM" }, "assumedRoleUser": { "assumedRoleId": "AROAXOTKAROCSNEXAMPLE:RevealCrossAccount", "arn": "arn:aws:sts::111122223333:assumed-role/MacieReveal/RevealCrossAccount" } }, "requestID": "d905cea8-2dcb-44c1-948e-19419example", "eventID": "74ee4d0c-932d-3332-87aa-8bcf3example", "readOnly": true, "resources": [ { "accountId": "111122223333", "type": "AWS::IAM::Role", "ARN": "arn:aws:iam::111122223333:role/MacieReveal" } ], "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "111122223333", "eventCategory": "Management" }

範例:刪除成員資格邀請

下列範例顯示 Amazon Macie DeleteInvitations 操作的 CloudTrail 事件。在此範例中,當成員取消其帳戶與管理員帳戶的關聯,並刪除管理員加入組織的邀請時,Macie 會在組織的委派 Macie 管理員帳戶中記錄事件。在此範例中,管理員的帳戶 ID AWS 帳戶 為 777788889999。成員帳戶的帳戶 ID 為 111122223333

{ "eventVersion": "1.11", "userIdentity": { "type": "AWSAccount", "accountId": "111122223333", "invokedBy": "macie2.amazonaws.com" }, "eventTime": "2025-09-20T18:44:58Z", "eventSource": "macie2.amazonaws.com", "eventName": "MacieMemberUpdated", "awsRegion": "us-east-2", "sourceIPAddress": "macie2.amazonaws.com", "userAgent": "macie2.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "2f08152c-66b9-35f8-8a10-6fe1bexample", "readOnly": false, "resources": [{ "accountId": "777788889999", "type": "AWS::Macie::Member", "ARN": "arn:aws:macie2:us-east-2:777788889999:member/111122223333" }], "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "777788889999", "sharedEventID": "2bff2ad0-f233-48c6-8720-ca9dbexample", "serviceEventDetails": { "memberAccount": "111122223333", "memberResourceStatus": "DELETED", "apiOperation": "DeleteInvitations" }, "eventCategory": "Management" }

範例:停用 Macie

此範例顯示停用 Amazon Macie 的 CloudTrail 事件 AWS 帳戶。在此範例中,IAM 使用者 (JohnDoe) 已停用其帳戶的 Macie。然後,除了刪除帳戶的其他 Macie 資源和資料之外,Macie 還取消並刪除帳戶的所有敏感資料探索任務。

下列事件顯示有關使用者使用 Amazon Macie DisableMacie操作停用 Macie 帳戶之請求的詳細資訊。

{ "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "principalId": "AROAXYKJR2G5JXEXAMPLE:JohnDoe", "arn": "arn:aws:sts::123456789012:assumed-role/Admin/JohnDoe", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AROAXYKJR2G5JXEXAMPLE", "arn": "arn:aws:iam::123456789012:role/Admin", "accountId": "123456789012", "userName": "Admin" }, "attributes": { "creationDate": "2025-09-18T21:54:42Z", "mfaAuthenticated": "true" } } }, "eventTime": "2025-09-18T21:57:06Z", "eventSource": "macie2.amazonaws.com", "eventName": "DisableMacie", "awsRegion": "us-east-2", "sourceIPAddress": "198.51.100.1", "userAgent": "aws-cli/2.17.9 md/awscrt#0.20.11 ua/2.0 os/macos#24.4.0 md/arch#x86_64 lang/python#3.11.8 md/pyimpl#CPython cfg/retry-mode#standard md/installer#exe md/prompt#off md/command#macie2.disable-macie", "requestParameters": null, "responseElements": null, "requestID": "941d1d6c-c1b2-4db5-845f-1250cexample", "eventID": "06554dba-417b-4a65-90b8-4e5d5example", "readOnly": false, "eventType": "AwsApiCall", "managementEvent": true, "recipientAccountId": "123456789012", "eventCategory": "Management" }

下一個事件顯示 Macie 的詳細資訊,然後取消和刪除帳戶的其中一個敏感資料探索任務。

{ "eventVersion": "1.11", "userIdentity": { "type": "Root", "accountId": "123456789012", "invokedBy": "macie2.amazonaws.com" }, "eventTime": "2025-09-18T21:57:18Z", "eventSource": "macie2.amazonaws.com", "eventName": "MacieClassificationJobCancelled", "awsRegion": "us-east-2", "sourceIPAddress": "macie2.amazonaws.com", "userAgent": "macie2.amazonaws.com", "requestParameters": null, "responseElements": null, "eventID": "df39ea1d-cd4e-4130-8cd5-cd33cexample", "readOnly": false, "resources": [{ "accountId": "123456789012", "type": "AWS::Macie::ClassificationJob", "ARN": "arn:aws:macie2:us-east-2:123456789012:classification-job/f252cbe854ae0a1a47d8304f4example" }], "eventType": "AwsServiceEvent", "managementEvent": true, "recipientAccountId": "123456789012", "serviceEventDetails": { "macieStatus": "DISABLED", "classificationJobStatus": "CANCELLED" }, "eventCategory": "Management" }