Frappe S3 Attachment
Frappe app to make file upload automatically upload and read from s3.

Features.
- Upload both public and private files to s3.
- Stream files from S3, when file is viewed everytime.
- Lets you add S3 credentials
(aws key, aws secret, bucket name, folder name) through ui and migrate existing
files.
- Deletes from s3 whenever a file is deleted in ui.
- Files are uploaded categorically in the format.
{s3folderpath}/{year}/{month}/{day}/{doctype}/{file_hash}
Installation.
- bench get-app https://github.com/vijendra-tacten/frappe-attachments-s3.git
- bench install-app frappes3attachment
Configuration Setup.
- Open single doctype "s3 File Attachment"
- Enter (Bucket Name, AWS key, AWS secret, S3 bucket Region name, Folder Name)
Folder Name- folder name is the default folder path in s3.
- Migrate existing files lets all the existing files in private and public folders
to be migrated to s3.
- Delete From Cloud when selected deletes the file form s3 bucket whenever a file
is deleted from ui. By default the Delete from cloud will be unchecked.
S3 Configuration
Permission Overview (Based on requirements)
> When createing the bucket make sure that ACL is enabled
> Objects can be public
>> The bucket is not public but anyone with appropriate permissions can grant public access to objects.
Block public access (bucket settings)
- Block all public Access -
Off
- Block public access to buckets and objects granted through new access control lists (ACLs) -
Off
- Block public access to buckets and objects granted through any access control lists (ACLs) -
Off
- Block public access to buckets and objects granted through any access control lists (ACLs) -
Off
- Block public and cross-account access to buckets and objects through any public bucket or access point policies -
Off
Bucket policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AddCannedAcl",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<xyz>:user/<S3_USERNAME>"
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::<BUCKET_NAME>/*",
"Condition": {
"StringEquals": {
"s3:x-amz-acl": "public-read"
}
}
}
]
}
License
MIT