A simple S3 proxy service that generates signed URLs for uploading and downloading files from AWS S3.
You need to set the following environment variables in your Val Town settings:
AWS_ACCESS_KEY_ID - Your AWS access key IDAWS_SECRET_ACCESS_KEY - Your AWS secret access keyAWS_S3_BUCKET - The S3 bucket name to useAWS_REGION - AWS region (optional, defaults to us-east-1)Your AWS credentials need the following S3 permissions:
s3:GetObjects3:PutObjectGenerate a signed URL for uploading a file to S3.
Request:
{ "objectId": "my-file.jpg" }
Response:
{ "signedUrl": "https://bucket.s3.amazonaws.com/my-file.jpg?...", "objectId": "my-file.jpg", "expiresIn": 3600 }
Generate a signed URL for downloading a file from S3.
Request:
{ "objectId": "my-file.jpg" }
Response:
{ "signedUrl": "https://bucket.s3.amazonaws.com/my-file.jpg?...", "objectId": "my-file.jpg", "expiresIn": 3600 }
/upload with the desired object ID/download with the object IDThe API returns appropriate HTTP status codes:
200 - Success400 - Bad request (missing objectId)500 - Server error (missing config, AWS errors)