> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-detect-table-modification.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How to create an AWS IAM user and S3 bucket

> How to create an AWS IAM user and S3 bucket.

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

> This guide shows you how you can set up an IAM user and S3 bucket in AWS,
> a prerequisite step for taking backups to S3 or configuring ClickHouse to
> store data on S3

<h2 id="create-an-aws-iam-user">
  Create an AWS IAM user
</h2>

In this procedure, we'll be creating a service account user, not a login user.

1. Log into the AWS IAM Management Console.

2. In the `Users` tab, select `Create user`

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-1.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=8215062a2076ba0765f4bd997b99d077" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1940" data-path="images/_snippets/s3/2025/s3-1.webp" />

3. Enter a user-name

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-2.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=132e9e71b52502291e089ab0ac6041c5" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1408" data-path="images/_snippets/s3/2025/s3-2.webp" />

4. Select `Next`

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-3.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=bf48abd92f2a8ce23037b85e9e6b5730" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1860" data-path="images/_snippets/s3/2025/s3-3.webp" />

5. Select `Next`

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-4.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=ec3de6e3b9f65293a211ed316b5abedc" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1850" data-path="images/_snippets/s3/2025/s3-4.webp" />

6. Select `Create user`

The user is now created.
Click on the newly created user

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-5.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=acfb098027f5abefb5edb6c2a036bed0" alt="AWS IAM Management Console - Adding a new user" width="4040" height="792" data-path="images/_snippets/s3/2025/s3-5.webp" />

7. Select `Create access key`

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-6.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=04148ae5c875f7fafbd6e011abfba79c" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1900" data-path="images/_snippets/s3/2025/s3-6.webp" />

8. Select `Application running outside AWS`

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-7.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=eaad4763d5d1cf87ab275bb8843c67c0" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1942" data-path="images/_snippets/s3/2025/s3-7.webp" />

9. Select `Create access key`

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-8.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=0c056c2a23dadafa64a77cfb3b3376b2" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1080" data-path="images/_snippets/s3/2025/s3-8.webp" />

10. Download your access key and secret as a .csv for use later

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-9.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=706a69134aefeb193042afcf1da6154b" alt="AWS IAM Management Console - Adding a new user" width="3912" height="2036" data-path="images/_snippets/s3/2025/s3-9.webp" />

<h2 id="create-an-s3-bucket">
  Create an S3 bucket
</h2>

1. In the S3 bucket section, select **Create bucket**

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-10.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=ffa0e0ac4c8d78d9d2331d88a05d7b63" alt="AWS IAM Management Console - Adding a new user" width="4040" height="2518" data-path="images/_snippets/s3/2025/s3-10.webp" />

2. Enter a bucket name, leave other options default

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-11.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=2bfd75a5c6faf627cf21533e0564e73d" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1118" data-path="images/_snippets/s3/2025/s3-11.webp" />

<Note>
  The bucket name must be unique across AWS, not just the organization, or it will emit an error.
</Note>

3. Leave `Block all Public Access` enabled; public access isn't needed.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-12.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=bdadd901a59df71646232388055d73a7" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1106" data-path="images/_snippets/s3/2025/s3-12.webp" />

4. Select **Create Bucket** at the bottom of the page

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-13.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=a69a6b1aa79a32699425ec435f53abad" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1872" data-path="images/_snippets/s3/2025/s3-13.webp" />

5. Select the link, copy the ARN, and save it for use when configuring the access policy for the bucket

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-14.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=438c082c21f84e3afcb3ba8dc8fbc926" alt="AWS IAM Management Console - Adding a new user" width="4040" height="934" data-path="images/_snippets/s3/2025/s3-14.webp" />

6. Once the bucket has been created, find the new S3 bucket in the S3 buckets list and select the bucket name which will take you to the page shown below:

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-15.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=cc825f1a4162cd88a42c9a3b63ec7564" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1400" data-path="images/_snippets/s3/2025/s3-15.webp" />

7. Select `Create folder`

8. Enter a folder name that will be the target for the ClickHouse S3 disk or backup and select `Create folder` at the bottom of the page

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-16.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=d9937c67d4c35357488120437df7f97d" alt="AWS IAM Management Console - Adding a new user" width="3992" height="1352" data-path="images/_snippets/s3/2025/s3-16.webp" />

9. The folder should now be visible on the bucket list

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-17.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=4892dcadfb23485db8f5fc4e9fc84bff" alt="AWS IAM Management Console - Adding a new user" width="4040" height="1330" data-path="images/_snippets/s3/2025/s3-17.webp" />

10. Select the checkbox for the new folder and click on `Copy URL`. Save the URL for use in the ClickHouse storage configuration in the next section.

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-18.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=63fa0cd1e5c6095827715a58b77cc236" alt="AWS IAM Management Console - Adding a new user" width="4040" height="992" data-path="images/_snippets/s3/2025/s3-18.webp" />

11. Select the **Permissions** tab and click on the **Edit** button in the **Bucket Policy** section

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-detect-table-modification/0yJtAU6cqYAQlCWC/images/_snippets/s3/2025/s3-19.webp?fit=max&auto=format&n=0yJtAU6cqYAQlCWC&q=85&s=6fa0f7147ecdc7090b8406eb9bbef1bc" alt="AWS IAM Management Console - Adding a new user" width="4040" height="954" data-path="images/_snippets/s3/2025/s3-19.webp" />

12. Add a bucket policy, example below

```json theme={null}
{
    "Version": "2012-10-17",
    "Id": "Policy123456",
    "Statement": [
        {
            "Sid": "abc123",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::782985192762:user/docs-s3-user"
            },
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::ch-docs-s3-bucket",
                "arn:aws:s3:::ch-docs-s3-bucket/*"
            ]
        }
    ]
}
```

<Note>
  The policy above makes it possible to perform all actions on the bucket
</Note>

| Parameter | Description                                                 | Example Value                                                         |
| --------- | ----------------------------------------------------------- | --------------------------------------------------------------------- |
| Version   | Version of the policy interpreter, leave as-is              | 2012-10-17                                                            |
| Sid       | User-defined policy id                                      | abc123                                                                |
| Effect    | Whether user requests will be allowed or denied             | Allow                                                                 |
| Principal | The accounts or user that will be allowed                   | arn:aws:iam::782985192762:user/docs-s3-user                           |
| Action    | What operations are allowed on the bucket                   | s3:\*                                                                 |
| Resource  | Which resources in the bucket will operations be allowed in | "arn:aws:s3:::ch-docs-s3-bucket", "arn:aws:s3:::ch-docs-s3-bucket/\*" |

<Note>
  You should work with your security team to determine the permissions to be used, consider these as a starting point.
  For more information on Policies and settings, refer to AWS documentation:
  [https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-policy-language-overview.html](https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-policy-language-overview.html)
</Note>

13. Save the policy configuration
