Search code examples
djangoamazon-s3django-storageamazon-iam

What permissions does django-storages require for an s3 IAM user?


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?


Solution

  • 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.

    {
      "Statement": [
        {
          "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/*"
        }
      ]
    }