title: How do I make media files display automatically in django using s3 as storage?
body: <p>I configured my s3 settings like so:</p>
  
  <pre><code>DEFAULT_FILE_STORAGE = 'Bonychicken.storage_backends.MediaStorage'
  AWS_STORAGE_BUCKET_NAME = 'bonychicken'
  AWS_S3_REGION_NAME = 'us-east-2'
  AWS_ACCESS_KEY_ID = '&lt;my access key id&gt;'
  AWS_SECRET_ACCESS_KEY = '&lt;my secret access key&gt;'
  AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.{AWS_S3_REGION_NAME}.amazonaws.com"
  AWS_QUERYSTRING_AUTH = False
  AWS_DEFAULT_ACL = None
  STATIC_URL = '/static/'
  MEDIAFILES_LOCATION = 'media'
  MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/media/"
  MEDIA_ROOT = f"https://{AWS_S3_CUSTOM_DOMAIN}/media/"
  AWS_IS_GZIPPED = True
  AWS_S3_OBJECT_PARAMETERS = {
      'CacheControl': 'max-age=86400',
  }
  </code></pre>
  
  <p>My storage class is:</p>
  
  <pre><code>from storages.backends.s3boto3 import S3Boto3Storage
  
  class MediaStorage(S3Boto3Storage):
      bucket_name = 'bonychicken'
      location = 'media'
      file_overwrite = False
  </code></pre>
  
  <p>I added <code>storages</code> to my installed apps and <code>boto3</code> is also installed.</p>
  
  <p>CORS Configuration is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"&gt;
  &lt;CORSRule&gt;
      &lt;AllowedOrigin&gt;*&lt;/AllowedOrigin&gt;
      &lt;AllowedMethod&gt;GET&lt;/AllowedMethod&gt;
      &lt;MaxAgeSeconds&gt;3000&lt;/MaxAgeSeconds&gt;
      &lt;AllowedHeader&gt;Authorization&lt;/AllowedHeader&gt;
  &lt;/CORSRule&gt;
  &lt;/CORSConfiguration&gt;
  </code></pre>
  
  <p><code>block public access</code> has been turned off.
  <code>IAM</code> user has permissions to the bucket.</p>
  
  <p>The problem is, whenever I upload a file, it is uploaded to my s3 bucket but it doesn't show on the html page. Trying to access the image url from the source code yields:</p>
  
  <pre><code>&lt;Error&gt;
      &lt;Code&gt;AccessDenied&lt;/Code&gt;
      &lt;Message&gt;Access Denied&lt;/Message&gt;
      &lt;RequestId&gt;&lt;random letters here&gt;&lt;/RequestId&gt;
      &lt;HostId&gt;
          &lt;random letters here&gt;
      &lt;/HostId&gt;
  &lt;/Error&gt;
  </code></pre>
  
  <p>But if I go to my bucket settings and select <code>actions</code> and click on <code>make public</code> after marking the media files, everything starts working. This means for each image uploaded, I have to mark and repeat over and over again.</p>
  
  <p>How do I solve this?</p>