Logging FSx for Lustre API calls with Amazon CloudTrail
Amazon FSx for Lustre is integrated with Amazon CloudTrail, a service that provides a record of actions taken by a user, role, or an Amazon service in Amazon FSx for Lustre. CloudTrail captures all API calls for Amazon FSx for Lustre as events. Captured calls include calls from the Amazon FSx for Lustre console and from code calls to Amazon FSx for Lustre API operations.
If you create a trail, you can enable continuous delivery of CloudTrail events to an Amazon S3 bucket, including events for Amazon FSx for Lustre. If you don't configure a trail, you can still view the most recent events in the CloudTrail console in Event history. Using the information collected by CloudTrail, you can determine the request that was made to Amazon FSx for Lustre. You can also determine the IP address from which the request was made, who made the request, when it was made, and additional details.
To learn more about CloudTrail, see the Amazon CloudTrail User Guide.
Amazon FSx for Lustre information in CloudTrail
CloudTrail is enabled on your Amazon account when you create the account. When API activity occurs in Amazon FSx for Lustre, that activity is recorded in a CloudTrail event along with other Amazon service events in Event history. You can view, search, and download recent events in your Amazon account. For more information, see Viewing Events with CloudTrail Event History.
For an ongoing record of events in your Amazon account, including events for Amazon FSx for Lustre, create a trail. A trail enables CloudTrail to deliver log files to an Amazon S3 bucket. By default, when you create a trail in the console, the trail applies to all Amazon Regions. The trail logs events from all Amazon Regions in the Amazon partition and delivers the log files to the Amazon S3 bucket that you specify. Additionally, you can configure other Amazon services to further analyze and act upon the event data collected in CloudTrail logs. For more information, see the following topics in the Amazon CloudTrail User Guide:
All Amazon FSx for Lustre API
calls are logged by CloudTrail. For example, calls to the CreateFileSystem
and TagResource
operations generate entries in the CloudTrail log files.
Every event or log entry contains information about who generated the request. The identity information helps you determine the following:
-
Whether the request was made with root or Amazon Identity and Access Management (IAM) user credentials.
-
Whether the request was made with temporary security credentials for a role or federated user.
-
Whether the request was made by another Amazon service.
For more information, see the CloudTrail userIdentity Element in the Amazon CloudTrail User Guide.
Understanding Amazon FSx for Lustre log file entries
A trail is a configuration that enables delivery of events as log files to an Amazon S3 bucket that you specify. CloudTrail log files contain one or more log entries. An event represents a single request from any source and includes information about the requested action, the date and time of the action, request parameters, and so on. CloudTrail log files aren't an ordered stack trace of the public API calls, so they don't appear in any specific order.
The following example shows a CloudTrail log entry that demonstrates the
TagResource
operation when a tag for a file system is created from the
console.
{ "eventVersion": "1.05", "userIdentity": { "type": “Root”, "principalId": “111122223333”, "arn": "arn:aws:sts::111122223333:root”, "accountId": “111122223333”, "accessKeyId": "AKIAIOSFODNN7EXAMPLE”, "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2018-11-14T22:36:07Z" } } }, "eventTime": "2018-11-14T22:36:07Z", "eventSource": "fsx.amazonaws.com", "eventName": "TagResource", "awsRegion": "us-east-1", "sourceIPAddress": “192.0.2.0”, "userAgent": “console.amazonaws.com”, "requestParameters": { "resourceARN": "arn:aws:fsx:us-east-1:111122223333:file-system/fs-ab12cd34ef56gh789” }, "responseElements": null, "requestID": “aEXAMPLE-abcd-1234-56ef-b4cEXAMPLE51”, "eventID": “bEXAMPLE-gl12-3f5h-3sh4-ab6EXAMPLE9p”, "eventType": "AwsApiCall", "apiVersion": "2018-03-01", "recipientAccountId": “111122223333” }
The following example shows a CloudTrail log entry that demonstrates the
UntagResource
action when a tag for a file system is deleted from the
console.
{ "eventVersion": "1.05", "userIdentity": { "type": “Root”, "principalId": "111122223333", "arn": "arn:aws:sts::111122223333:root", "accountId": "111122223333", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "attributes": { "mfaAuthenticated": "false", "creationDate": "2018-11-14T23:40:54Z" } } }, "eventTime": "2018-11-14T23:40:54Z", "eventSource": "fsx.amazonaws.com", "eventName": "UntagResource", "awsRegion": "us-east-1", "sourceIPAddress": "192.0.2.0", "userAgent": "console.amazonaws.com", "requestParameters": { "resourceARN": "arn:aws:fsx:us-east-1:111122223333:file-system/fs-ab12cd34ef56gh789" }, "responseElements": null, "requestID": "aEXAMPLE-abcd-1234-56ef-b4cEXAMPLE51", "eventID": "bEXAMPLE-gl12-3f5h-3sh4-ab6EXAMPLE9p", "eventType": "AwsApiCall", "apiVersion": "2018-03-01", "recipientAccountId": "111122223333" }