Contact Us
Webflow Premium Partner Ehab Fayez
Back to Agent Skills
Data & Analytics

AWS S3 File Storage

Store and serve files with AWS S3 using presigned URLs, multipart uploads, and lifecycle policies.

Claude Code Cursor Copilot Windsurf Gemini CLI Codex

Overview

AWS S3 (Simple Storage Service) is the most widely used object storage service, providing virtually unlimited storage with 99.999999999% durability. The AWS SDK v3 for JavaScript provides a modular client (@aws-sdk/client-s3) that supports all S3 operations including uploading, downloading, listing, copying, and deleting objects with fine-grained access control.

For web applications, presigned URLs are essential. They allow clients to upload files directly to S3 from the browser without exposing AWS credentials, and enable time-limited access to private objects. The @aws-sdk/s3-request-presigner package generates these URLs. Multipart uploads handle large files by splitting them into parts that are uploaded in parallel and assembled server-side.

S3 provides storage classes for cost optimization (Standard, Infrequent Access, Glacier, Intelligent-Tiering), lifecycle policies for automatic transitions and expirations, event notifications for triggering Lambda functions on upload, and S3 Select for running SQL queries directly on stored CSV/JSON/Parquet files. The S3-compatible API is also implemented by services like Cloudflare R2, MinIO, and DigitalOcean Spaces.

Who Is This For?

  • Upload user files with presigned URLs from the browser
  • Serve static assets and media through S3 with CloudFront CDN
  • Implement multipart uploads for large file handling
  • Set up lifecycle policies for log archival to Glacier

Installation

Setup for Claude Code
npm install @aws-sdk/client-s3 @aws-sdk/s3-request-presigner

Configuration

import { S3Client, PutObjectCommand, GetObjectCommand } from "@aws-sdk/client-s3"
import { getSignedUrl } from "@aws-sdk/s3-request-presigner"

const s3 = new S3Client({ region: "us-east-1" })

// Generate upload presigned URL
const uploadUrl = await getSignedUrl(s3,
  new PutObjectCommand({ Bucket: "my-bucket", Key: "uploads/photo.jpg" }),
  { expiresIn: 3600 }
)

// Upload from server
await s3.send(new PutObjectCommand({
  Bucket: "my-bucket",
  Key: "uploads/file.pdf",
  Body: fileBuffer,
  ContentType: "application/pdf",
}))