使用記錄 Amazon EFS API 呼叫 AWS CloudTrail - Amazon Elastic File System

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

使用記錄 Amazon EFS API 呼叫 AWS CloudTrail

Amazon EFS 與這項服務整合在一起 AWS CloudTrail,該服務可提供 Amazon EFS 中使用者、角色或 AWS 服務所採取的動作記錄。 CloudTrail 以事件形式擷取 Amazon EFS 的所有 API 呼叫,包括來自 Amazon EFS 主控台的呼叫,以及從程式碼呼叫到 Amazon EFS API 操作。

如果您建立追蹤,您可以啟用持續交付 CloudTrail 事件到 Amazon S3 儲存貯體,包括 Amazon EFS 的事件。如果您未設定追蹤,您仍然可以在 [事件歷程記錄] 中檢視 CloudTrail 主控台中最近的事件。使用收集的資訊 CloudTrail,您可以判斷向 Amazon EFS 發出的請求、提出請求的來源 IP 地址、提出請求的人員、提出請求的時間以及其他詳細資訊。

如需詳細資訊,請參閱 AWS CloudTrail 使用者指南

Amazon EFS 信息 CloudTrail

CloudTrail 在您創建帳戶 AWS 帳戶 時啟用。Amazon EFS 中發生活動時,該活動會與事件歷史記錄中的其他 AWS 服務 CloudTrail 事件一起記錄在事件中。您可以檢視、搜尋和下載 AWS 帳戶的最新事件。如需詳細資訊,請參閱檢視具有事 CloudTrail 件記錄的事件

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

所有 Amazon EFS API 呼叫都由記錄 CloudTrail。例如,呼叫CreateMountTargetCreateTags作業會CreateFileSystem在 CloudTrail 記錄檔中產生項目。

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

  • 請求是以根使用者還是 AWS Identity and Access Management (IAM) 使用者登入資料提出。

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

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

若要取得更多資訊,請參閱《AWS CloudTrail 使用者指南》中的使用者 CloudTrail userIdentity 元素

了解 Amazon EFS 日誌檔案項目

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

下列範例會示範從主控台建立檔案系統標籤時的CreateTags作業 CloudTrail 記錄項目。

{ "eventVersion": "1.06", "userIdentity": { "type": "Root", "principalId": "111122223333", "arn": "arn:aws:iam::111122223333:root", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2017-03-01T18:02:37Z" } } }, "eventTime": "2017-03-01T19:25:47Z", "eventSource": "elasticfilesystem.amazonaws.com", "eventName": "CreateTags", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.amazonaws.com", "requestParameters": { "fileSystemId": "fs-00112233", "tags": [{ "key": "TagName", "value": "AnotherNewTag" } ] }, "responseElements": null, "requestID": "dEXAMPLE-feb4-11e6-85f0-736EXAMPLE75", "eventID": "eEXAMPLE-2d32-4619-bd00-657EXAMPLEe4", "eventType": "AwsApiCall", "apiVersion": "2015-02-01", "recipientAccountId": "111122223333" }

下列範例顯示 CloudTrail 記錄項目,示範從主控台刪除檔案系統標籤時所DeleteTags採取的動作。

{ "eventVersion": "1.06", "userIdentity": { "type": "Root", "principalId": "111122223333", "arn": "arn:aws:iam::111122223333:root", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2017-03-01T18:02:37Z" } } }, "eventTime": "2017-03-01T19:25:47Z", "eventSource": "elasticfilesystem.amazonaws.com", "eventName": "DeleteTags", "awsRegion": "us-west-2", "sourceIPAddress": "192.0.2.0", "userAgent": "console.amazonaws.com", "requestParameters": { "fileSystemId": "fs-00112233", "tagKeys": [] }, "responseElements": null, "requestID": "dEXAMPLE-feb4-11e6-85f0-736EXAMPLE75", "eventID": "eEXAMPLE-2d32-4619-bd00-657EXAMPLEe4", "eventType": "AwsApiCall", "apiVersion": "2015-02-01", "recipientAccountId": "111122223333" }

EFS 服務連結角色的日誌項目

Amazon EFS 服務連結角色可對 AWS 資源進行 API 呼叫。您會看到 EFS 服務連結角色呼叫的 CloudTrail 記錄項目。username: AWSServiceRoleForAmazonElasticFileSystem如需 EFS 和服務連結角色的詳細資訊,請參閱 使用 Amazon EFS 的服務連結角色

下列範例顯示示範 Amazon EFS 建立 AWSServiceRoleForAmazonElasticFileSystem 服務連結角色時所CreateServiceLinkedRole採取的動作的 CloudTrail 記錄項目。

{     "eventVersion": "1.05",     "userIdentity": {         "type": "IAMUser",         "principalId": "111122223333",         "arn": "arn:aws:iam::111122223333:user/user1",         "accountId": "111122223333",         "accessKeyId": "A111122223333",         "userName": "user1",         "sessionContext": {             "attributes": {                 "mfaAuthenticated": "false",                 "creationDate": "2019-10-23T22:45:41Z"             }         },         "invokedBy": "elasticfilesystem.amazonaws.com”     },     "eventTime": "2019-10-23T22:45:41Z",     "eventSource": "iam.amazonaws.com",     "eventName": "CreateServiceLinkedRole",     "awsRegion": "us-east-1",     "sourceIPAddress": "192.0.2.0",     "userAgent": "user_agent",     "requestParameters": {         "aWSServiceName": "elasticfilesystem.amazonaws.com”     },     "responseElements": {         "role": {             "assumeRolePolicyDocument": "111122223333-10-111122223333Statement111122223333Action111122223333AssumeRole111122223333Effect%22%3A%20%22Allow%22%2C%20%22Principal%22%3A%20%7B%22Service%22%3A%20%5B%22 elasticfilesystem.amazonaws.com%22%5D%7D%7D%5D%7D",             "arn": "arn:aws:iam::111122223333:role/aws-service-role/elasticfilesystem.amazonaws.com/AWSServiceRoleForAmazonElasticFileSystem",             "roleId": "111122223333",             "createDate": "Oct 23, 2019 10:45:41 PM",             "roleName": "AWSServiceRoleForAmazonElasticFileSystem",             "path": "/aws-service-role/elasticfilesystem.amazonaws.com/“         }     },     "requestID": "11111111-2222-3333-4444-abcdef123456",     "eventID": "11111111-2222-3333-4444-abcdef123456",     "eventType": "AwsApiCall",     "recipientAccountId": "111122223333" }

下列範例顯示示範由 AWSServiceRoleForAmazonElasticFileSystem服務連結角色所執行之CreateNetworkInterface動作的 CloudTrail 記錄項目,如中所述。sessionContext

{     "eventVersion": "1.05",     "userIdentity": {         "type": "AssumedRole",         "principalId": "AIDACKCEVSQ6C2EXAMPLE",         "arn": "arn:aws:sts::0123456789ab:assumed-role/AWSServiceRoleForAmazonElasticFileSystem/0123456789ab",         "accountId": "0123456789ab",         "sessionContext": {             "sessionIssuer": {                 "type": "Role",                 "principalId": "AIDACKCEVSQ6C2EXAMPLE",                 "arn": "arn:aws:iam::0123456789ab:role/aws-service-role/elasticfilesystem.amazonaws.com/AWSServiceRoleForAmazonElasticFileSystem",                 "accountId": "0123456789ab",                 "userName": "AWSServiceRoleForAmazonElasticFileSystem"             },             "webIdFederationData": {},             "attributes": {                 "mfaAuthenticated": "false",                 "creationDate": "2019-10-23T22:50:05Z"             }         },         "invokedBy": "AWS Internal"     },     "eventTime": "20You 19-10-23T22:50:05Z",     "eventSource": "ec2.amazonaws.com",     "eventName": "CreateNetworkInterface",     "awsRegion": "us-east-1",     "sourceIPAddress": "elasticfilesystem.amazonaws.com”,     "userAgent": "elasticfilesystem.amazonaws.com",     "requestParameters": {         "subnetId": "subnet-71e2f83a",         "description": "EFS mount target for fs-1234567 (fsmt-1234567)",         "groupSet": {},         "privateIpAddressesSet": {}     },     "responseElements": {         "requestId": "0708e4ad-03f6-4802-b4ce-4ba987d94b8d",         "networkInterface": {             "networkInterfaceId": "eni-0123456789abcdef0",             "subnetId": "subnet-12345678",             "vpcId": "vpc-01234567",             "availabilityZone": "us-east-1b",             "description": "EFS mount target for fs-1234567 (fsmt-1234567)",             "ownerId": "666051418590",             "requesterId": "0123456789ab",             "requesterManaged": true,             "status": "pending",             "macAddress": "00:bb:ee:ff:aa:cc",             "privateIpAddress": "192.0.2.0",             "privateDnsName": "ip-192-0-2-0.ec2.internal",             "sourceDestCheck": true,             "groupSet": {                 "items": [                     {                         "groupId": "sg-c16d65b6",                         "groupName": "default"                     }                 ]             },             "privateIpAddressesSet": {                 "item": [                     {                         "privateIpAddress": "192.0.2.0",                         "primary": true                     }                 ]             },             "tagSet": {}         }     },     "requestID": "11112222-3333-4444-5555-666666777777",     "eventID": "aaaabbbb-1111-2222-3333-444444555555",     "eventType": "AwsApiCall",     "recipientAccountId": "111122223333" }

EFS 身分驗證的日誌項目

適用於 NFS 用戶端的 Amazon EFS 授權會發出NewClientConnectionUpdateClientConnection CloudTrail 事件。在初始連線之後和重新連線之後立即授權連連線時,就會發出 NewClientConnection 事件。系統重新授權鏈接且已更改允許的動作時,將發出 UpdateClientConnection。允許的動作新清單不包含 ClientMount 時,也會發出該事件。如需 EFS 授權的詳細資訊,請參閱 使用 IAM 控制檔案系統資料存取

下列範例顯示示範NewClientConnection事件的 CloudTrail 記錄項目。

{ "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:sts::0123456789ab:assumed-role/abcdef0123456789", "accountId": "0123456789ab", "accessKeyId": "AKIAIOSFODNN7EXAMPLE ", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AIDACKCEVSQ6C2EXAMPLE", "arn": "arn:aws:iam::0123456789ab:role/us-east-2", "accountId": "0123456789ab", "userName": "username" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2019-12-23T17:50:16Z" }, "ec2RoleDelivery": "1.0" } }, "eventTime": "2019-12-23T18:02:12Z", "eventSource": "elasticfilesystem.amazonaws.com", "eventName": "NewClientConnection", "awsRegion": "us-east-2", "sourceIPAddress": "AWS Internal", "userAgent": "elasticfilesystem", "requestParameters": null, "responseElements": null, "eventID": "27859ac9-053c-4112-aee3-f3429719d460", "readOnly": true, "resources": [ { "accountId": "0123456789ab", "type": "AWS::EFS::FileSystem", "ARN": "arn:aws:elasticfilesystem:us-east-2:0123456789ab:file-system/fs-01234567" }, { "accountId": "0123456789ab", "type": "AWS::EFS::AccessPoint", "ARN": "arn:aws:elasticfilesystem:us-east-2:0123456789ab:access-point/fsap-0123456789abcdef0" } ], "eventType": "AwsServiceEvent", "recipientAccountId": "0123456789ab", "serviceEventDetails": { "permissions": { "ClientRootAccess": true, "ClientMount": true, "ClientWrite": true }, "sourceIpAddress": "10.7.3.72" } }

適用於檔案系統的 Amazon EFS 日誌 encrypted-at-rest檔項目

Amazon EFS 提供下列檔案系統的選項:使用靜態加密、傳輸中加密或兩者。如需詳細資訊,請參閱 Amazon EFS 的資料加密

Amazon EFS 會在發出 AWS KMS API 請求以產生資料金鑰和解密 Amazon EFS 資料時傳送加密內容。檔案系統 ID 是靜態加密之所有檔案系統的加密內容。在 CloudTrail 記錄項目requestParameters欄位中,加密內容看起來類似下列內容。

"EncryptionContextEquals": {} "aws:elasticfilesystem:filesystem:id" : "fs-4EXAMPLE"