As the question asks, what are the minimum required permissions for a locked down s3 IAM user to use django-storages successfully? At the present time I've used something like
{
"Statement": [
{
"Effect": "Allow",
"Action": ["s3:ListAllMyBuckets"],
"Resource": "arn:aws:s3:::*"
},
{
"Effect": "Allow",
"Action": ["s3:ListBucket",
"s3:GetBucketLocation",
"s3:ListBucketMultipartUploads",
"s3:ListBucketVersions"],
"Resource": "arn:aws:s3:::bucket-name"
},
{
"Effect": "Allow",
"Action": ["s3:*Object*",
"s3:ListMultipartUploadParts",
"s3:AbortMultipartUpload"],
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}
Which may actually be overkill. Any further ideas?
that works for me:
Fiver's answer is not enough to run collectstatic in django-storages. I used everything jvc26 did except for s3:ListAllMyBuckets. I would assume s3:ListBucketVersions is not needed either.
I'm not 100% sure about django-storages, as I use cuddly-buddly which is based on the S3 portion of django-storages. I just found cuddlybuddly simpler to use and worked better, plus the name is awesome!
Anyway, I have a project using Django+S3 and found the following AWS policy as the minimum required for my project:
I have Django views that need to upload, retrieve, and delete so those corresponding actions can be used/omitted based on your needs. Obviously, anyone will need to change the user and bucket name.
Also, just for completeness as it wasn't obvious to me, note the following restrictions regarding AWS policies:
Finally, to anyone tempted to do so, don't change the date value in the
Version
key, Amazon uses this value to parse the policy format.Hope this helps!