> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://uploadcare.com/docs/llms.txt.

# AWS S3 storage

> Store files directly in AWS S3 and manage them seamlessly with Uploadcare processing tools.

Uploadcare allows you to upload files directly to your AWS S3 storage.

> **Note**
>
> **Note:** Adaptive bitrate streaming is not supported for files uploaded directly to AWS S3 buckets.

You may want to choose this option when you:

* Implement custom file workflows that are integrated deeply
  into your system.
* Follow company storage policies pointing at specific buckets.

## How it works

You need an [Amazon Web Services](http://aws.amazon.com/) account
with creating a new or selecting an existing bucket
in [S3 bucket management](https://console.aws.amazon.com/s3/home).

> **Info**
>
> Only one S3 bucket can be connected to one Uploadcare project.

1. Files are uploaded to the AWS S3 storage directly.
2. Files will be served from your storage or a third-party CDN,
   and image processing operations can be applied to them.

Note: AWS S3 storage is available on the Enterprise plan.
Contact [our sales](https://uploadcare.com/schedule-demo/).

## Setting up S3 bucket \[#S3-recommendations]

Enter your [AWS S3 console](https://console.aws.amazon.com/s3/home)
and configure your S3 bucket:

1. Open **Buckets** section.
2. Open an existing bucket or create a new one.
   Use DNS-compliant lowercase bucket names such as `johnsbucket1`.
3. Check **Block public access settings** if you need to give public
   access to copied files (all checkboxes are checked by default).
4. Go to the **Permissions** tab on your bucket's properties pane
   and add the following settings to your **Bucket Policy**
   (where replace `<bucket>` with the name of your AWS S3 bucket):
   ```json
   {
   "Version": "2008-10-17",
   "Statement": [
       {
           "Sid": "AllowUploadcareWriteAccess",
           "Effect": "Allow",
           "Principal": {
               "AWS": "arn:aws:iam::899746369614:user/bucket-consumer"
           },
           "Action": [
               "s3:GetBucketLocation",
               "s3:ListBucket",
               "s3:PutObject",
               "s3:GetObject",
               "s3:GetObjectVersion",
               "s3:DeleteObject",
               "s3:DeleteObjectVersion",
               "s3:GetBucketAcl",
               "s3:ListMultipartUploadParts",
               "s3:ListBucketMultipartUploads"
           ],
           "Resource": [
               "arn:aws:s3:::<bucket>",
               "arn:aws:s3:::<bucket>/*"
           ]
       },
       {
           "Sid": "AllowUploadcareReadAccess",
           "Effect": "Allow",
           "Principal": {
               "AWS": "arn:aws:iam::899746369614:user/s3reader"
           },
           "Action": [
               "s3:GetBucketLocation",
               "s3:ListBucket",
               "s3:GetObject",
               "s3:GetObjectVersion",
               "s3:GetBucketAcl"
           ],
           "Resource": [
               "arn:aws:s3:::<bucket>",
               "arn:aws:s3:::<bucket>/*"
           ]
       }
     ]
   }
   ```
5. Click **Edit** in the **Cross-origin resource sharing (CORS)** section.
6. Add the CORS policy configuration:
   ```json
   [
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "PUT",
            "POST"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
   ]
   ```
   You can specify exact hostnames in the **AllowedOrigins** section for extra security. \

   Learn more about [CORS configuration](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html).
7. **Save** your Bucket settings and **Connect**.

## Connecting AWS S3 bucket

Connect the S3 bucket to Uploadсare in the following ways:

* Create a new project.
* Add the S3 bucket to an existing project without any uploaded files.

### Сreate a new project

To connect your own AWS S3 bucket to the new Uploadcare project:

1. Сreate a new project in the [Dashboard](https://app.uploadcare.com/).
2. Select the option **Your own AWS S3 bucket**.
3. Add S3 bucket name.
4. Check that the S3 bucket settings comply with the
   [recommendations](#S3-recommendations) given above.

Uploadcare will run tests to ensure it can connect and upload the files
to the bucket.

### Add to an existing project

Add the S3 bucket to an existing project without uploaded files:

1. Open a [Storage settings section](https://app.uploadcare.com/projects/-/settings/#storage).
2. Go to **Connect S3 bucket** and click
   **Connect bucket** to connect your S3 bucket to Uploadcare project.
3. Add S3 bucket name.
4. Click **Connect**.

Note: Uploadcare only handles files uploaded through our service.
We recommend starting with an empty bucket.

### Setting CSP for multipart uploads

When uploading bigger files, we're using multipart uploading and upload
file chunks to S3 directly. If you're using CSP, add the appropriate CSP
to your webpage(s):

```txt
# path addressing style
connect-src: https://s3.<region>.amazonaws.com/

# virtual addressing style (recommended)
connect-src: https://<bucket>.s3.<region>.amazonaws.com/
```

You can change addressing style for your S3 bucket via Support.

## Delete files

When you delete a file via Uploadcare, the file disappears from the Dashboard and is marked as removed. You can delete a file in the [Dashboard](https://app.uploadcare.com/) or via the [REST API Delete file method](https://uploadcare.com/api-refs/rest-api/v0.7.0/#tag/File/operation/deleteFileStorage).

The file metadata may still be accessible via the API until the final cleanup process runs.

The object stored in your AWS S3 bucket is permanently deleted 90 days after the file is marked as removed.

Unstored files are automatically marked as removed 1 day after upload and disappear from the Dashboard and API responses at that time. They then follow the same deletion lifecycle.

> **Note**
>
> **Note:** Uploadcare deletes only objects created through Uploadcare. Objects stored in the bucket by other systems are not affected. We recommend using the connected bucket exclusively for Uploadcare-managed files.