使用以下方式記錄 EBS 直接 API 的 API 呼叫 AWS CloudTrail - Amazon EBS

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

使用以下方式記錄 EBS 直接 API 的 API 呼叫 AWS CloudTrail

EBS 直接 API 服務已與 AWS CloudTrail. CloudTrail 是提供使用者、角色或服務所採取之動作記錄的 AWS 服務。 CloudTrail 擷取 EBS 直接 API 中執行的所有 API 呼叫做為事件。如果您建立追蹤,您可以啟用連續交付 CloudTrail 事件到 Amazon Simple Storage Service (Amazon S3) 儲存貯體。如果您未設定追蹤,您仍然可以在 [事件歷程記錄] 的 CloudTrail 主控台中檢視最近的管理事件事件歷史記錄中不會擷取資料事件。您可以使用收集的資訊 CloudTrail 來判斷向 EBS Direct API 提出的要求、提出要求的 IP 位址、提出要求的人員、提出要求的時間以及其他詳細資訊。

若要取得有關的更多資訊 CloudTrail,請參閱AWS CloudTrail 使用者指南

EBS 直接 API 資訊 CloudTrail

CloudTrail 在您創建 AWS 帳戶時,您的帳戶已啟用。當 EBS Direct API 中發生受支援的事件活動時,該活動會與事件歷史記錄中的其他 AWS 服務 CloudTrail 事件一起記錄在事件中。您可以在帳戶中查看,搜索和下載最近的事 AWS 件。如需詳細資訊,請參閱檢視具有事 CloudTrail 件記錄的事件

如需 AWS 帳戶中持續的事件記錄 (包括 EBS 直接 API 的事件),請建立追蹤。追蹤可 CloudTrail 將日誌檔傳遞至 S3 儲存貯體。根據預設,當您在主控台中建立追蹤時,追蹤會套用至所有 AWS 區域。追蹤記錄來自 AWS 分割區中所有區域的事件,並將日誌檔傳送到您指定的 S3 儲存貯體。此外,您還可以設定其他 AWS 服務,以進一步分析 CloudTrail 記錄中收集的事件資料並採取行動。如需詳細資訊,請參閱下列內容:

支援的 API 動作

對於 EBS 直接 API,您可以使用 CloudTrail 記錄兩種類型的事件

  • 管理事件 — 管理事件可讓您檢視在 AWS 帳戶中針對快照執行的管理作業。下列 API 動作預設會記錄為追蹤中的管理事件:

    如需有關記錄管理事件的詳細資訊,請參閱《CloudTrail 使用指南》的記錄追蹤的管理事件

  • 資料事件 – 這些事件可讓您深入了解對快照執行或在快照中執行的快照操作。您可以選擇性地將下列 API 動作記錄為追蹤中的資料事件:

    根據預設,在您建立追蹤時,不會記錄資料事件。您只能使用進階事件選取器來記錄 EBS 直接 API 呼叫的資料事件。如需詳細資訊,請參閱《CloudTrail 使用指南》的記錄追蹤的資料事件

    注意

    如果您對與您共用的快照執行動作,資料事件不會傳送至擁有該快照的 AWS 帳戶。

身分資訊

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

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

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

  • 請求是否由其他 AWS 服務提出。

如需詳細資訊,請參閱CloudTrail userIdentityElement

了解 EBS 直接 API 記錄檔案項目

追蹤是一種組態,可讓事件以日誌檔的形式傳遞至您指定的 S3 儲存貯體。 CloudTrail 記錄檔包含一或多個記錄項目。事件代表來自任何來源的單一請求,包括有關請求的操作,動作的日期和時間,請求參數等信息。 CloudTrail 日誌文件不是公共 API 調用的有序堆棧跟踪,因此它們不會以任何特定順序顯示。

以下是範例 CloudTrail 記錄項目。

StartSnapshot
{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2020-07-03T23:27:26Z", "eventSource": "ebs.amazonaws.com", "eventName": "StartSnapshot", "awsRegion": "eu-west-1", "sourceIPAddress": "192.0.2.0", "userAgent": "PostmanRuntime/7.25.0", "requestParameters": { "volumeSize": 8, "clientToken": "token", "encrypted": true }, "responseElements": { "snapshotId": "snap-123456789012", "ownerId": "123456789012", "status": "pending", "startTime": "Jul 3, 2020 11:27:26 PM", "volumeSize": 8, "blockSize": 524288, "kmsKeyArn": "HIDDEN_DUE_TO_SECURITY_REASONS" }, "requestID": "be112233-1ba5-4ae0-8e2b-1c302EXAMPLE", "eventID": "6e12345-2a4e-417c-aa78-7594fEXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }
CompleteSnapshot
{ "eventVersion": "1.05", "userIdentity": { "type": "IAMUser", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2020-07-03T23:28:24Z", "eventSource": "ebs.amazonaws.com", "eventName": "CompleteSnapshot", "awsRegion": "eu-west-1", "sourceIPAddress": "192.0.2.0", "userAgent": "PostmanRuntime/7.25.0", "requestParameters": { "snapshotId": "snap-123456789012", "changedBlocksCount": 5 }, "responseElements": { "status": "completed" }, "requestID": "be112233-1ba5-4ae0-8e2b-1c302EXAMPLE", "eventID": "6e12345-2a4e-417c-aa78-7594fEXAMPLE", "eventType": "AwsApiCall", "recipientAccountId": "123456789012" }
ListSnapshotBlocks
{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "AIDAT4HPB2AO3JEXAMPLE", "arn": "arn:aws:iam::123456789012:user/user", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2021-06-03T00:32:46Z", "eventSource": "ebs.amazonaws.com", "eventName": "ListSnapshotBlocks", "awsRegion": "us-east-1", "sourceIPAddress": "111.111.111.111", "userAgent": "PostmanRuntime/7.28.0", "requestParameters": { "snapshotId": "snap-abcdef01234567890", "maxResults": 100, "startingBlockIndex": 0 }, "responseElements": null, "requestID": "example6-0e12-4aa9-b923-1555eexample", "eventID": "example4-218b-4f69-a9e0-2357dexample", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::EC2::Snapshot", "ARN": "arn:aws:ec2:us-west-2::snapshot/snap-abcdef01234567890" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data", "tlsDetails": { "tlsVersion": "TLSv1.2", "cipherSuite": "ECDHE-RSA-AES128-SHA", "clientProvidedHostHeader": "ebs.us-west-2.amazonaws.com" } }
ListChangedBlocks
{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "AIDAT4HPB2AO3JEXAMPLE", "arn": "arn:aws:iam::123456789012:user/user", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2021-06-02T21:11:46Z", "eventSource": "ebs.amazonaws.com", "eventName": "ListChangedBlocks", "awsRegion": "us-east-1", "sourceIPAddress": "111.111.111.111", "userAgent": "PostmanRuntime/7.28.0", "requestParameters": { "firstSnapshotId": "snap-abcdef01234567890", "secondSnapshotId": "snap-9876543210abcdef0", "maxResults": 100, "startingBlockIndex": 0 }, "responseElements": null, "requestID": "example0-f4cb-4d64-8d84-72e1bexample", "eventID": "example3-fac4-4a78-8ebb-3e9d3example", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::EC2::Snapshot", "ARN": "arn:aws:ec2:us-west-2::snapshot/snap-abcdef01234567890" }, { "accountId": "123456789012", "type": "AWS::EC2::Snapshot", "ARN": "arn:aws:ec2:us-west-2::snapshot/snap-9876543210abcdef0" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data", "tlsDetails": { "tlsVersion": "TLSv1.2", "cipherSuite": "ECDHE-RSA-AES128-SHA", "clientProvidedHostHeader": "ebs.us-west-2.amazonaws.com" } }
GetSnapshotBlock
{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "AIDAT4HPB2AO3JEXAMPLE", "arn": "arn:aws:iam::123456789012:user/user", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2021-06-02T20:43:05Z", "eventSource": "ebs.amazonaws.com", "eventName": "GetSnapshotBlock", "awsRegion": "us-east-1", "sourceIPAddress": "111.111.111.111", "userAgent": "PostmanRuntime/7.28.0", "requestParameters": { "snapshotId": "snap-abcdef01234567890", "blockIndex": 1, "blockToken": "EXAMPLEiL5E3pMPFpaDWjExM2/mnSKh1mQfcbjwe2mM7EwhrgCdPAEXAMPLE" }, "responseElements": null, "requestID": "examplea-6eca-4964-abfd-fd9f0example", "eventID": "example6-4048-4365-a275-42e94example", "readOnly": true, "resources": [ { "accountId": "123456789012", "type": "AWS::EC2::Snapshot", "ARN": "arn:aws:ec2:us-west-2::snapshot/snap-abcdef01234567890" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data", "tlsDetails": { "tlsVersion": "TLSv1.2", "cipherSuite": "ECDHE-RSA-AES128-SHA", "clientProvidedHostHeader": "ebs.us-west-2.amazonaws.com" } }
PutSnapshotBlock
{ "eventVersion": "1.08", "userIdentity": { "type": "IAMUser", "principalId": "AIDAT4HPB2AO3JEXAMPLE", "arn": "arn:aws:iam::123456789012:user/user", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "userName": "user" }, "eventTime": "2021-06-02T21:09:17Z", "eventSource": "ebs.amazonaws.com", "eventName": "PutSnapshotBlock", "awsRegion": "us-east-1", "sourceIPAddress": "111.111.111.111", "userAgent": "PostmanRuntime/7.28.0", "requestParameters": { "snapshotId": "snap-abcdef01234567890", "blockIndex": 1, "dataLength": 524288, "checksum": "exampleodSGvFSb1e3kxWUgbOQ4TbzPurnsfVexample", "checksumAlgorithm": "SHA256" }, "responseElements": { "checksum": "exampleodSGvFSb1e3kxWUgbOQ4TbzPurnsfVexample", "checksumAlgorithm": "SHA256" }, "requestID": "example3-d5e0-4167-8ee8-50845example", "eventID": "example8-4d9a-4aad-b71d-bb31fexample", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::EC2::Snapshot", "ARN": "arn:aws:ec2:us-west-2::snapshot/snap-abcdef01234567890" } ], "eventType": "AwsApiCall", "managementEvent": false, "recipientAccountId": "123456789012", "eventCategory": "Data", "tlsDetails": { "tlsVersion": "TLSv1.2", "cipherSuite": "ECDHE-RSA-AES128-SHA", "clientProvidedHostHeader": "ebs.us-west-2.amazonaws.com" } }