---
description: >-
  Create and configure an S3 bucket to store deduplicated files with versioning,
  encryption, and secure access for Lambda.
---

# S3 Bucket Setup

**Amazon S3 (Simple Storage Service)** is used to store deduplicated files in this project. Each uploaded file is stored **only once** in S3, regardless of how many users upload it, thanks to **SHA-256**–based file hashing and metadata management.

&#x49;_&#x6E; this chapter, you’ll create the necessary S3 bucket and configure it for versioning, encryption, and Lambda access._

<figure><img src="https://rhinosecuritylabs.com/wp-content/uploads/2019/06/s3-Buckets.png" alt="" width="375"><figcaption></figcaption></figure>

### Step 1: Create a New S3 Bucket

1. Go to the **AWS Console → S3**
2. Click **Create bucket**
3. Set:
   * **Bucket name**: `owncloud-dedup-files` (or any unique name)
   * **Region**: Same as your Lambda functions
4. Uncheck **“Block all public access”** only if your application requires public file access (⚠️ generally keep this enabled for security)

***

### Step 2: Enable Versioning (Recommended)

* Scroll to the **Bucket Versioning** section
* Choose **Enable**
* This allows S3 to keep multiple versions of the same object (useful for future file versioning support)

***

### Step 3: Enable Default Encryption

1. Scroll to **Default Encryption**
2. Choose **Enable** encryption
3.  Select:

    * **SSE-S3 (Amazon S3 key)** – for simple encryption
    * Or **SSE-KMS** – for advanced, key-managed encryption (recommended for production)



    <figure><img src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdZ8zqyUo1poCSMzjb5UhKuqEZ1iQHec0mRHzEek0zloMPy-yWPr01P7mn0ksubxRgcMyrQXTmjiZ2xtLit97Hn90pUkkYQlODgDyGakcTf0eCntw-FCRZsTcGpWNvoT0S3Izhl?key=_DKrN84QTTX8VNbKVBwhLxv-" alt=""><figcaption><p>S3 Buckets created will be displayed on the dashboard.</p></figcaption></figure>

***

### Step 4: Test Upload (Optional)

You can test uploading a file using the AWS CLI:

```bash
aws s3 cp test.txt s3://owncloud-dedup-files/
```

> You should see the file appear in your bucket.

***

### You’re Done✅

Your **S3 bucket** is now ready to **store deduplicated files**. The Lambda functions will interact with this bucket to:

* **Upload** new unique files
* **Reuse** existing files
* **Delete** files when no users are linked
