Auditing user access in CloudTrail logs
With enhanced trusted identity propagation, CloudTrail events for Lake Formation and Amazon S3 data access include the
user's identity in the onBehalfOf element of userIdentity, next to the carrier
role. You don't need to turn on additional settings. Because the carrier role stays in the event, your
existing CloudTrail queries continue to work.
The onBehalfOf element contains the following fields:
subjectThe user's subject, such as the user's email address.
issuerThe IdP that authenticated the user.
subjectTypeThe type of identity, such as
user.federatedProviderArnThe ARN of the IAM identity provider or IAM Identity Center instance that the user signed in through.
The following is an excerpt from a GetDataAccess event for a user who signed in through IAM
federation.
{ "eventVersion": "1.09", "userIdentity": { "type": "AssumedRole", "arn": "arn:aws:sts::111122223333:assumed-role/DataAnalystRole/session-name", "accountId": "111122223333", "sessionContext": { "sessionIssuer": { "type": "Role", "arn": "arn:aws:iam::111122223333:role/DataAnalystRole", "accountId": "111122223333", "userName": "DataAnalystRole" } }, "onBehalfOf": { "subject": "mary_major@example.com", "issuer": "https://idp.example.com", "subjectType": "user", "federatedProviderArn": "arn:aws:iam::111122223333:saml-provider/Okta" } }, "eventSource": "lakeformation.amazonaws.com", "eventName": "GetDataAccess", ... }
In the example, the following values are placeholders for the values in your environment:
111122223333– Your AWS account ID.DataAnalystRole– The name of the carrier role.session-name– The role session name.mary_major@example.com– The user's subject.https://idp.example.com– The issuer URL of your IdP.Okta– The name of the SAML identity provider in IAM.
Enable data events in CloudTrail for your Amazon S3 buckets and objects that form your data lake. For more information, see Enabling CloudTrail event logging for Amazon S3 buckets and objects in the Amazon S3 User Guide.
Auditing with legacy trusted identity propagation
With legacy trusted identity propagation, CloudTrail events identify the user by Identity Store user ID, and you must opt in to include the user's context. If you use a user-defined role to register the Amazon S3 data location with Lake Formation, you can opt in to include the IAM Identity Center user's context in the CloudTrail events.
To enable credential vending auditing on data lake locations registered with user-defined roles
-
Sign in to the Lake Formation console at https://eusc-de-east-1.console.amazonaws-eusc.eu/lakeformation/
. -
In the left-side navigation, expand Administration, and choose Data Catalog settings.
-
Under Enhanced auditing, choose Propagate provided context.
-
Choose Save.
You can also enable the enhanced auditing option by setting the Parameters attribute in the
PutDataLakeSettings
operation. By default, the SET_CONTEXT parameter value is set to true.
{ "DataLakeSettings": { "Parameters": {"SET_CONTEXT": "true"} } }
With this option, the onBehalfOf element contains the Identity Store user ID and the Identity
Store ARN.
"onBehalfOf": { "userId": "identity-store-user-id", "identityStoreArn": "arn:aws:identitystore::111122223333:identitystore/d-1234567890" }