Configuring AWS credentials

In order to make the Wazuh AWS module pull log data from the different services, it will be necessary to provide access credentials so it can connect to them.

There are multiple ways to configure the AWS credentials:

Create an IAM User

Wazuh will need a user with permissions to pull log data from the S3 bucket. The easiest way to accomplish this is by creating a new IAM user for your account. We will only allow it to read data from the bucket.

  1. Create new user:

    Navigate to Services > IAM > Users

    Click on "Next: Permissions" to continue.

  2. Create policy:

    We will attach this policy later to the user we are creating.

    Check that your new policy looks like this:

    Raw output for the example policy:

      "Version": "2012-10-17",
      "Statement": [
          "Sid": "VisualEditor0",
          "Effect": "Allow",
          "Action": [
          "Resource": [


    The s3:DeleteObject action is only required if the logs will be removed from the S3 bucket by the aws-s3 module.

  3. Attach policy:

  4. Confirm user creation and get credentials:

Save the credentials, you will use them later to configure the module.

Authenticating options

Credentials can be loaded from different locations, you can either specify the credentials as they are in the previous block of configuration, assume an IAM role, or load them from other Boto3 supported locations.


You can define profiles in your credentials file (~/.aws/credentials) and specify those profiles on the bucket configuration.


A region must be also specified on the credentials file in order to make it work.

For example, the following credentials file defines three different profiles: default, dev and prod.




To use the prod profile in the AWS integration you would use the following bucket configuration:

<bucket type="cloudtrail">

IAM Roles


This authentication method requires some credentials to be previously added to the configuration using any other authentication method.

IAM Roles can also be used to access the S3 bucket. Follow these steps to create one:

  1. Go to Services > Security, Identity & Compliance > IAM.

  2. Select Roles in the right menu and click on the Create role button:

  3. Select S3 service and click on Next: Permissions button:

  4. Select the previously created policy:

  5. Click on Create role button:

  6. Access to role summary and click on its policy name:

  7. Add permissions so the new role can do sts:AssumeRole action:

  8. Come back to the role's summary, go to Trust relationships tab and click on Edit trust relationship button:

  9. Add your user to the Principal tag and click on Update Trust Policy button:

Once your role is created, just paste it on the bucket configuration:

 <bucket type="cloudtrail">

IAM roles for EC2 instances

You can use IAM roles and assign them to EC2 instances so there's no need to insert authentication parameters on the ossec.conf file. This is the recommended configuration. Find more information about IAM roles on EC2 instances in the official Amazon AWS documentation.

This is an example configuration:

<bucket type="cloudtrail">

Environment variables

If you're using a single AWS account for all your buckets this could be the most suitable option for you. You just have to define the following environment variables:



Insert the credentials into the configuration

Another available option to set up credentials is writing them right into the Wazuh configuration file (/var/ossec/etc/ossec.conf), inside of the <bucket> block on the module configuration.

This is an example configuration:

<bucket type="cloudtrail">