description | labels |
---|---|
HTTP File Upload (Amazon AWS S3) |
Stage-Alpha |
This module implements XEP-0363, which lets clients upload files over HTTP directly to an Amazon AWS S3 bucket. No extra server-side code is required.
This module generates URLs that are signed using AWS Signature Version 4 to upload to S3. To download/GET files, the S3 bucket must be made public. A random UUID is used in the URL for each uploaded file to prevent filename collisions.
- Choose an AWS region to store your files, note the region id
for this example we choose
eu-west-2
- Create the bucket in the S3 console
for this example we choose
the_best_bucket
- Choose a path inside the root of the bucket uploads should land in
for this example we choose
http_uploads
- Create a Bucket Policy (Bucket > Permissions > Bucket Policy) that marks all objects in this path as public:
{
"Id": "Policy153727464300",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt153727464300",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::the_best_bucket/http_uploads/*",
"Principal": "*"
}
]
}
Add "http_upload_s3"
to modules_enabled
in your global section, or under the host(s) you wish
to use it on.
-- Your AWS access key id
http_upload_s3_access_id = "AKTESTKEY";
-- Your AWS secret access key
http_upload_s3_secret_key = "YUNOCHANGEDMEKEY";
-- The region your bucket is located in
http_upload_s3_region = "eu-west-2";
-- The full name of your bucket
http_upload_s3_bucket = "the_best_bucket";
-- The directory under the bucket root to store files in
http_upload_s3_path = "http_uploads";
-- A maximum file size can be set by:
-- default: 100MB (100\*1024\*1024)
http_upload_s3_file_size_limit = 123 -- bytes
Works with Prosody 0.10.x and later.