記錄容量 封鎖 API呼叫 AWS CloudTrail - Amazon Elastic Compute Cloud

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

記錄容量 封鎖 API呼叫 AWS CloudTrail

Capacity Blocks 與 整合 AWS CloudTrail,這項服務提供 Capacity Blocks. CloudTrail captures AWS 中使用者、角色或服務所採取動作的記錄。 API擷取的呼叫包括從 Capacity Blocks 主控台呼叫,以及對 Capacity Blocks API操作的程式碼呼叫。如果您建立追蹤,則可以啟用 CloudTrail 事件連續交付至 Amazon S3 儲存貯體,包括容量區塊的事件。如果您未設定追蹤,仍然可以在 事件歷史記錄 中檢視 CloudTrail 主控台中的最新事件。 使用 所收集的資訊 CloudTrail,您可以判斷對 Capacity Blocks 提出的請求、提出請求的 IP 地址、提出請求的人員、提出的時間,以及其他詳細資訊。

若要進一步了解 CloudTrail,請參閱 AWS CloudTrail 使用者指南

中的容量封鎖資訊 CloudTrail

CloudTrail 當您建立 帳戶 AWS 帳戶 時, 會在 上啟用 。當活動在容量區塊中發生時,該活動會與 CloudTrail 事件歷史記錄 中的其他 AWS 服務事件一起記錄在事件中。您可以在 中檢視、搜尋和下載最近的事件 AWS 帳戶。如需詳細資訊,請參閱使用事件歷史記錄檢視 CloudTrail 事件。

若要持續記錄 中的事件 AWS 帳戶,包括容量區塊的事件,請建立追蹤。追蹤可讓 CloudTrail 將日誌檔案交付至 Amazon S3 儲存貯體。依預設,當您在主控台中建立追蹤時,該追蹤會套用至所有的 AWS 區域。追蹤會記錄 AWS 分割區中所有 區域的事件,並將日誌檔案傳送至您指定的 Amazon S3 儲存貯體。此外,您可以設定其他服務 AWS ,以進一步分析 CloudTrail 日誌中收集的事件資料並對其採取行動。如需詳細資訊,請參閱下列內容:

所有容量區塊動作都會由 記錄, CloudTrail 並記錄在 Amazon EC2API參考中。例如, 呼叫 CapacityBlockScheduled,而 CapacityBlockActive動作會在 CloudTrail 日誌檔案中產生項目。

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

  • 請求是使用根 還是 AWS Identity and Access Management (IAM) 使用者憑證進行。

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

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

如需詳細資訊,請參閱 CloudTrail userIdentity 元素

了解容量區塊日誌檔案項目

追蹤是一種組態,可讓您將事件作為日誌檔案交付至您指定的 Amazon S3 儲存貯體。 CloudTrail 日誌檔案包含一或多個日誌項目。事件代表來自任何來源的單一請求,並包含所請求動作、動作日期和時間、請求參數等資訊。 CloudTrail log 檔案不是公開API呼叫的有序堆疊追蹤,因此它們不會以任何特定順序顯示。

下列範例顯示 的 CloudTrail 日誌項目:

注意

已修改資料隱私權範例的某些欄位。

TerminateCapacityBlocksInstances

{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "AWS Internal;" }, "eventTime": "2023-10-02T00:06:08Z", "eventSource": "ec2.amazonaws.com", "eventName": "TerminateCapacityBlockInstances", "awsRegion": "us-east-1", "sourceIPAddress": "203.0.113.25", "userAgent": "aws-cli/1.15.61 Python/2.7.10 Darwin/16.7.0 botocore/1.10.60", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-EXAMPLE", "readOnly": false, "resources": [ { "accountId": "123456789012", "type": "AWS::EC2::Instance", "ARN": "arn:aws:ec2:US East (N. Virginia):123456789012:instance/i-1234567890abcdef0" } { "accountId": "123456789012", "type": "AWS::EC2::Instance", "ARN": "arn:aws::ec2:US East (N. Virginia):123456789012:instance/i-0598c7d356eba48d7" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "capacityReservationId": "cr-12345678", } }

CapacityBlockPaymentFailed

{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "AWS Internal;" }, "eventTime": "2023-10-02T00:06:08Z", "eventSource": "ec2.amazonaws.com", "eventName": "CapacityBlockPaymentFailed", "awsRegion": "us-east-1", "sourceIPAddress": "203.0.113.25", "userAgent": "aws-cli/1.15.61 Python/2.7.10 Darwin/16.7.0 botocore/1.10.60", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-EXAMPLE", "readOnly": false, "resources": [ { "ARN": "arn:aws:ec2:US East (N. Virginia):123456789012:capacity-reservation/cr-12345678", "accountId": "123456789012", "type": "AWS::EC2::CapacityReservation" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "capacityReservationId": "cr-12345678", "capacityReservationState": "payment-failed" } }

CapacityBlockScheduled

{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "AWS Internal;" }, "eventTime": "2023-10-02T00:06:08Z", "eventSource": "ec2.amazonaws.com", "eventName": "CapacityBlockScheduled", "awsRegion": "us-east-1", "sourceIPAddress": "203.0.113.25", "userAgent": "aws-cli/1.15.61 Python/2.7.10 Darwin/16.7.0 botocore/1.10.60", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-EXAMPLE", "readOnly": false, "resources": [ { "ARN": "arn:aws:ec2:US East (N. Virginia):123456789012:capacity-reservation/cr-12345678", "accountId": "123456789012", "type": "AWS::EC2::CapacityReservation" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "capacityReservationId": "cr-12345678", "capacityReservationState": "scheduled" } }

CapacityBlockActive

{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "AWS Internal;" }, "eventTime": "2023-10-02T00:06:08Z", "eventSource": "ec2.amazonaws.com", "eventName": "CapacityBlockActive", "awsRegion": "us-east-1", "sourceIPAddress": "203.0.113.25", "userAgent": "aws-cli/1.15.61 Python/2.7.10 Darwin/16.7.0 botocore/1.10.60", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-EXAMPLE", "readOnly": false, "resources": [ { "ARN": "arn:aws:ec2:US East (N. Virginia):123456789012:capacity-reservation/cr-12345678", "accountId": "123456789012", "type": "AWS::EC2::CapacityReservation" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "capacityReservationId": "cr-12345678", "capacityReservationState": "active" } }

CapacityBlockFailed

{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "AWS Internal;" }, "eventTime": "2023-10-02T00:06:08Z", "eventSource": "ec2.amazonaws.com", "eventName": "CapacityBlockFailed", "awsRegion": "us-east-1", "sourceIPAddress": "203.0.113.25", "userAgent": "aws-cli/1.15.61 Python/2.7.10 Darwin/16.7.0 botocore/1.10.60", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-EXAMPLE", "readOnly": false, "resources": [ { "ARN": "arn:aws:ec2:US East (N. Virginia):123456789012:capacity-reservation/cr-12345678", "accountId": "123456789012", "type": "AWS::EC2::CapacityReservation" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "capacityReservationId": "cr-12345678", "capacityReservationState": "failed" } }

CapacityBlockExpired

{ "eventVersion": "1.05", "userIdentity": { "accountId": "123456789012", "invokedBy": "AWS Internal;" }, "eventTime": "2023-10-02T00:06:08Z", "eventSource": "ec2.amazonaws.com", "eventName": "CapacityBlockExpired", "awsRegion": "us-east-1", "sourceIPAddress": "203.0.113.25", "userAgent": "aws-cli/1.15.61 Python/2.7.10 Darwin/16.7.0 botocore/1.10.60", "requestParameters": null, "responseElements": null, "eventID": "a1b2c3d4-EXAMPLE", "readOnly": false, "resources": [ { "ARN": "arn:aws:ec2:US East (N. Virginia):123456789012:capacity-reservation/cr-12345678", "accountId": "123456789012", "type": "AWS::EC2::CapacityReservation" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "123456789012", "serviceEventDetails": { "capacityReservationId": "cr-12345678", "capacityReservationState": "expired" } }