> ## Documentation Index
> Fetch the complete documentation index at: https://docs.peerdb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# S3 Setup Guide

1. Create an S3 bucket or ensure an existing bucket is available for use.
2. For PeerDB to access the S3 Peer, you can either use an existing AWS user or create a new AWS user.
3. Create access keys for that user through [AWS Console](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey) or [AWS CLI](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey_CLIAPI) or [AWS API](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html#Using_CreateAccessKey_API). By the end, you should have an access key along with its secret.
4. For the same user, create and attach the policy below using the [JSON editor](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-and-attach-iam-policy.html). Be sure to substitute the bucket name with your own. PeerDB requires `s3:ListAllMyBuckets`, `s3:GetObject`, `s3:PutObject`, `s3:ListBucket` and `s3:DeleteObject` on that bucket.

   ```json theme={null}
      {
          "Version": "2012-10-17",
          "Statement": [
              {
                  "Effect": "Allow",
                  "Action": [
                      "s3:GetObject",
                      "s3:PutObject",
                      "s3:ListBucket",
                      "s3:DeleteObject"
                  ],
                  "Resource": [
                      "arn:aws:s3:::<your-bucket-name>",
                      "arn:aws:s3:::<your-bucket-name>/*"
                  ]
              }
          ]
      }
   ```
5. In the PeerDB UI, select the Peers menu and select the New Peer option on the top right. Select the peer type as S3 and click on continue.

<Frame caption="Create peer drop down">
  <img src="https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/images/setup/s3_gcs_peer.png?fit=max&auto=format&n=wtgPI5cQwjI2FO0m&q=85&s=c8a9eea67952f1211619f3c9e1c733a2" width="1348" height="876" data-path="images/setup/s3_gcs_peer.png" />
</Frame>

6. Choose a peer name, and fill your bucket URL (with optional prefix, in case you want PeerDB's files to be nested within the bucket), access key and secret access key along with the region. Click `Validate` to see if any issues crop up and fix them accordingly. Then click Create peer to finish peer creation.

<Frame caption="Creating S3 peer">
  <img src="https://mintcdn.com/peerdb/wtgPI5cQwjI2FO0m/images/setup/s3_create_peer.png?fit=max&auto=format&n=wtgPI5cQwjI2FO0m&q=85&s=48630de328d7d049879c2edf7cf0ec8a" width="2062" height="1304" data-path="images/setup/s3_create_peer.png" />
</Frame>
