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

# AWS IAMユーザーとS3バケットの作成方法

> AWS IAMユーザーとS3バケットの作成方法。

export const Image = ({img, alt, size}) => {
  return <Frame>
      <img src={img} alt={alt} />
    </Frame>;
};

> このガイドでは、AWS で IAM ユーザーと S3 バケットを設定する方法を説明します。
> これは、S3 へのバックアップの取得や、ClickHouse が
> データを S3 に保存するように設定するための前提手順です

<div id="create-an-aws-iam-user">
  ## AWS IAM ユーザーを作成する
</div>

この手順では、ログインユーザーではなく、サービスアカウント用のユーザーを作成します。

1. AWS IAM Management Console にログインします。

2. `Users` タブで、`Create user` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-1.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=8e1fc26dbb4dab887a7fce6bf32aa1c8" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1940" data-path="images/_snippets/s3/2025/s3-1.png" />

3. ユーザー名を入力します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-2.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=b94e71736dbd437cd3be4cc377b805a0" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1408" data-path="images/_snippets/s3/2025/s3-2.png" />

4. `Next` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-3.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=271d5cb6b2674368406b415e5936cdb5" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1860" data-path="images/_snippets/s3/2025/s3-3.png" />

5. `Next` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-4.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=78f7e7d9676a3973d11580ccbeab4974" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1850" data-path="images/_snippets/s3/2025/s3-4.png" />

6. `Create user` を選択します

ユーザーが作成されたら、
新しく作成したユーザーをクリックします

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-5.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=90b1b7102b468021f6703a6c24cd5ca2" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="792" data-path="images/_snippets/s3/2025/s3-5.png" />

7. `Create access key` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-6.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=c712c6d0dc6e815e63bcc535dbd89fd0" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1900" data-path="images/_snippets/s3/2025/s3-6.png" />

8. `Application running outside AWS` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-7.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=5e187a64490aee58eb968752bdaee182" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1942" data-path="images/_snippets/s3/2025/s3-7.png" />

9. `Create access key` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-8.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=130c79d48a3f60719361bd63053da19b" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1080" data-path="images/_snippets/s3/2025/s3-8.png" />

10. 後で使用できるよう、アクセスキーとシークレットアクセスキーを .csv としてダウンロードします

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-9.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=d125ef53e3046c53c4a4ff2540e04486" alt="AWS IAM Management Console - 新しいユーザーの追加" width="3912" height="2036" data-path="images/_snippets/s3/2025/s3-9.png" />

<div id="create-an-s3-bucket">
  ## S3 バケットを作成する
</div>

1. S3 バケットのセクションで、**Create bucket** を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-10.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=2d5cbb9cbe446a7b1f7699c11d47160b" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="2518" data-path="images/_snippets/s3/2025/s3-10.png" />

2. バケット名を入力し、その他のオプションはデフォルトのままにします

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-11.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=c72890ac686c67ec7fd107c3aacaaa8f" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1118" data-path="images/_snippets/s3/2025/s3-11.png" />

<Note>
  バケット名は組織内だけでなく AWS 全体で一意である必要があります。そうでない場合はエラーが発生します。
</Note>

3. `Block all Public Access` は有効のままにします。パブリックアクセスは不要です。

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-12.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=2bc3c1b98854fabe7abb0ee2f5c4aa53" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1106" data-path="images/_snippets/s3/2025/s3-12.png" />

4. ページ下部の **Create Bucket** を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-13.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=1f199c7014d4e7d0c3908c9a88143b97" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1872" data-path="images/_snippets/s3/2025/s3-13.png" />

5. リンクを選択して ARN をコピーし、バケットのアクセスポリシーを構成する際に使用できるよう保存します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-14.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=d043c4ba838e5c3651506eaa2eb74593" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="934" data-path="images/_snippets/s3/2025/s3-14.png" />

6. バケットを作成したら、S3 バケット一覧で新しい S3 バケットを見つけてバケット名を選択します。すると、以下のページが表示されます。

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-15.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=79318f930b6b2336e9e2089dbd89d79a" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1400" data-path="images/_snippets/s3/2025/s3-15.png" />

7. `Create folder` を選択します

8. ClickHouse の S3 ディスクまたは Backup の保存先となるフォルダー名を入力し、ページ下部の `Create folder` を選択します

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-16.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=cf7d31d657ce3e77fa376e2b447d2cc1" alt="AWS IAM Management Console - 新しいユーザーの追加" width="3992" height="1352" data-path="images/_snippets/s3/2025/s3-16.png" />

9. フォルダーがバケット一覧に表示されます

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-17.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=2f6162e999fd3080a5fa1fe929f7881d" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="1330" data-path="images/_snippets/s3/2025/s3-17.png" />

10. 新しいフォルダーのチェックボックスを選択し、`Copy URL` をクリックします。次のセクションで ClickHouse のストレージ構成に使用するため、この URL を保存します。

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-18.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=2c5000018ff02dc52fa1f15951c74917" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="992" data-path="images/_snippets/s3/2025/s3-18.png" />

11. **Permissions** タブを選択し、**Bucket Policy** セクションの **Edit** ボタンをクリックします

<Image size="lg" img="https://mintcdn.com/private-7c7dfe99-mintlify-3a82795f/aRvsybqUpVR5ZXyi/images/_snippets/s3/2025/s3-19.png?fit=max&auto=format&n=aRvsybqUpVR5ZXyi&q=85&s=7b9525fd1ab036ea30b90afadb858d44" alt="AWS IAM Management Console - 新しいユーザーの追加" width="4040" height="954" data-path="images/_snippets/s3/2025/s3-19.png" />

12. バケットポリシーを追加します。以下は例です

```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>
  上記のポリシーを使用すると、バケットに対するすべての操作を実行できます
</Note>

| パラメーター    | 説明                            | 値の例                                                                   |
| --------- | ----------------------------- | --------------------------------------------------------------------- |
| Version   | ポリシーインタープリタのバージョン。このままにしておきます | 2012-10-17                                                            |
| Sid       | ユーザー定義のポリシー ID                | abc123                                                                |
| Effect    | ユーザーからのリクエストを許可するか拒否するか       | Allow                                                                 |
| Principal | 許可するアカウントまたはユーザー              | 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>
  使用する権限については、セキュリティチームと連携して決定してください。ここでは出発点となる例を示しています。
  ポリシーと設定の詳細については、AWS のドキュメントを参照してください。
  [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. ポリシー設定を保存します
