Export Audit Logs to Amazon S3
Public preview: This feature is available to all accounts.
Requirements:
Immuta permission
AUDITIf you will use the Immuta CLI instead of GraphQL API, install and configure the Immuta CLI. Must be CLI v1.4.0 or newer.
An S3 bucket you want to use to store the exported audit logs.
Use the following how-to to configure a periodical export of your Immuta audit logs to an S3 bucket. This export configuration requires access to your S3 bucket to add objects using one of the following authentication methods:
How to export using an IAM user with access key
Configure your Immuta audit logs to export to your S3 bucket and allow Immuta to authenticate using your AWS access key ID and secret access key. Here's a visual representation of the authentication flow:

1 - Configure an IAM user and policy
Access keys are tied to IAM users, which must be allowed to deposit objects in the target bucket via an attached IAM policy. Immuta requires that the user it authenticates as has the following permissions:
s3:PutObject: Allows Immuta to upload objects to the bucket.
If your S3 bucket is encrypted, the following permissions must also be granted to the role:
kms:Decrypt: Allows Immuta to verify the integrity of the new data key before using it.
kms:GenerateDataKey: Allows Immuta to generate a key that is used to encrypt the audit objects that are exported to S3 using your KMS key.
To begin, create an IAM user and attach a policy with the above permissions.
Follow AWS documentation to create a new user for Immuta to authenticate as and add objects to your S3 bucket.
Follow AWS documentation for creating IAM policies in the Amazon S3 console for the new policy.
Here is an example IAM policy that contains the required permissions for a KMS encrypted bucket. If you use this example, replace the content in angle brackets with the Amazon Resource Names (ARNs) for your S3 bucket and KMS key:
Follow AWS documentation to attach the policy to your newly created user.
Follow AWS documentation to generate the credentials that will be used to configure the export.
2 - Create an S3 bucket policy for the export
Before Immuta can export audit events to your S3 bucket using your configured IAM user, you need to create a bucket policy that allows that IAM user to add objects to your specified S3 bucket. The following Amazon S3 actions must be granted in the bucket policy:
s3:PutObject: Allows Immuta to upload objects to the bucket.
To create the policy for the bucket, you must be the bucket owner.
Follow AWS documentation for adding a bucket policy in the Amazon S3 console.
Edit the JSON in the Policy section to include a bucket policy like the example below.
In this example, the policy allows an IAM user (the principal) to add objects to the bucket. If you use this example, replace the content in angle brackets with the Amazon Resource Names (ARNs) for your IAM user and S3 bucket.
Save your changes.
Example policy
The example policy may block bucket access for other services, which then need to be configured via separate statements. Configure bucket policies with caution.
3 - Configure the audit export to S3
Configure the audit export to S3 using the Immuta CLI or GraphQL API with the following fields:
interval: The interval at which audit logs will be exported to your S3 bucket. They can be sent at 2-, 4-, 6-, 12-, or 24-hour intervals.
bucket name: Name of the bucket your audit logs will be sent to that you added the policy to above.
bucket path: The name of the folder within the bucket to put the audit logs in. This field is optional.
region: AWS region (such as "us-east-1").
accessKeyId: AWS access key ID for authentication. See the AWS documentation for information about using an access key ID and secret access key.
secretAccessKey: AWS secret access key for authentication.
Run the following command with the above fields in a JSON file:
Example ./exportConfig.json file
For additional CLI commands, see the audit CLI reference guide.
Run the following mutation to this URL, https://your-immuta.com/api/audit/graphql, with the above fields passed directly:
Example response
For additional GraphQL API commands, see the GraphQL API reference guide.
4 - Verify the export configuration connection
If the configuration is successful, you will see an .immuta.export.log file in your bucket.
How to export using an AWS IAM role
Configure your Immuta audit logs to export to your S3 bucket and allow Immuta to authenticate using an AWS role. With this option, you provide Immuta with an IAM role from your AWS account that is granted a trust relationship with Immuta’s IAM role for adding objects to your S3 bucket. Immuta will assume this IAM role from Immuta’s AWS account in order to perform operations in your AWS account. Here's a visual representation of the authentication flow:

Immuta requires a role with the following allowed action to the S3 bucket you want the audit logs exported to:
s3:PutObject which allows the role to add an object to a bucket.
If your S3 bucket is encrypted, the following permissions must also be granted to the role:
kms:Decrypt: Allows Immuta to verify the integrity of the new data key before using it.
kms:GenerateDataKey: Allows Immuta to generate a key that is used to encrypt the audit objects that are exported to S3 using your KMS key.
1 - Configure an IAM role and policy
Follow AWS documentation to create a new role for Immuta to assume and add objects to your S3 bucket.
Follow AWS documentation for creating IAM policies in the Amazon S3 console for the new role.
Here is an example IAM Policy that contains the required permissions for a KMS encrypted bucket. If you are not using KMS encryption, you may omit the second statement. If you use this example, replace the content in angle brackets with the Amazon Resource Names (ARNs) for your S3 bucket and KMS key:
Follow AWS documentation to attach the policy to your newly created role.
2 - Create an S3 bucket policy for the export
Before Immuta can export audit events to your S3 bucket using your configured IAM role, you need to create a bucket policy that allows that IAM role to add objects to your specified S3 bucket. The following Amazon S3 actions must be granted in the bucket policy:
s3:PutObject: Allows Immuta to upload objects to the bucket.
To create the policy for the bucket, you must be the bucket owner.
Follow AWS documentation for adding a bucket policy in the Amazon S3 console.
Edit the JSON in the Policy section to include a bucket policy like the example below.
In this example, the policy allows an IAM user (the principal) to add objects to the bucket.
If you use this example, replace the content in angle brackets with the Amazon Resource Names (ARNs) for your IAM role and S3 bucket.
Save your changes.
Example policy
The example policy may block bucket access for other services, which then need to be configured via separate statements. Configure bucket policies with caution.
3 - Configure the audit export to S3
Response error
When creating the export configuration, this step will return an error. Take the returned export configuration ID and continue with step 4 and 5 to create a trust relationship and verify the connection between Immuta and S3.
Configure the audit export to S3 using the Immuta CLI or GraphQL API with the following fields:
interval: The interval at which audit logs will be exported to your S3 bucket. They can be sent at 2-, 4-, 6-, 12-, or 24-hour intervals.
bucket name: Name of the bucket your audit logs will be sent to.
bucket path: The name of the folder within the bucket to put the audit logs in. This field is optional.
region: AWS region (such as "us-east-1").
roleArn: AWS role ARN for authentication that you added the policies to above. Immuta will assume this role when exporting audit logs to S3.
Run the following command with the above fields in a JSON file:
Example ./exportConfig.json file
Example response:
For additional CLI commands, see the audit CLI reference guide.
Run the following mutation to this URL, https://your-immuta.com/api/audit/graphql, with the above fields passed directly:
Example response
For additional GraphQL API commands, see the GraphQL API reference guide.
4 - Create a trust relationship and assume role policy
Follow AWS documentation for creating IAM trust relationships and assume role polices in the Amazon IAM console. Use the example JSON below to create a trust policy between Immuta and your AWS bucket.
Fill in the content in angle brackets with the following:
Immuta AWS Account ID: Contact your Immuta representative for this ID.
Export Configuration ID: Insert the ID from step 3's response.
5 - Verify the export configuration connection
Now that the configuration and the trust relationship have been created, test the connection from Immuta to S3 to ensure your audit logs are exported to your S3 bucket. Additionally, if the configuration is successful, you will see an .immuta.export.log file in your bucket.
If connectionStatus returns SUCCESS, your export configuration has been successfully set up.
Run the following command
Run the following mutation to this URL, https://your-immuta.com/api/audit/graphql:
Troubleshooting
Last updated
Was this helpful?

