AWS S3
The original object storage, used almost everywhere and supported by every tool.
Pick it when You want the standard that every library and service understands, or you already use AWS.
Skip it if You want the simplest setup, or expect heavy downloads, where transfer fees add up.
- Very reliable and works with everything
- Fine-grained access rules
- Presigned URLs are well documented
- Permissions and CORS are confusing at first
- You pay for data going out to the internet
- Quick to set up
- Cheap while small
- Easy to leave
- Room to grow
PricePay per stored amount, request and data sent out
How to connect it
- Create a bucket and keep 'Block public access' switched on.
- Create an access key for a user that can only touch that bucket.
- Add a CORS rule that allows PUT from your site's address.
- Make a route on your server that returns a presigned upload URL.
AWS_REGIONAWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYS3_BUCKET
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
const s3 = new S3Client({ region: process.env.AWS_REGION });
export const uploadUrl = (key: string, type: string) =>
getSignedUrl(
s3,
new PutObjectCommand({ Bucket: process.env.S3_BUCKET, Key: key, ContentType: type }),
{ expiresIn: 60 }
);