question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AWS Code: AccessDenied, Message:Access Deniedstatus:403

See original GitHub issue

Hello. I’m having an issue when uploading my video from the django admin.

My IAM user has the AmazonS3FullAccess policy attached. I also tried creating a new user with the same policy as the one stated in readme.md.

However I get the same 403 error everytime.

I did eventually get a successful upload when I changed the Block public access in my bucket settings to false. That however ment that everyone could upload to my bucket.

Can you what i’m doing wrong?

In the browser console I get the following errors:

Starting videos/20180718_215611.mp4 reason: first file

initiate getPayloadSha256Content: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
initiate V4 CanonicalRequest: POST
/<my_bucket_name>/videos/20180718_215611.mp4
uploads=
content-type:video/mp4
host:s3.eu-central-1.amazonaws.com
x-amz-acl:public-read
x-amz-date:20190919T140034Z

content-type;host;x-amz-acl;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
V4 stringToSign: AWS4-HMAC-SHA256
20190919T140034Z
20190919/eu-central-1/s3/aws4_request
62bf6ff5089028e97c05451e64077c0b0a3b273186717c8f547dfc7bc0d5b875
initiate signature: f20f0ea3deefa277f5a6ebba7da12a134314d34a52d11e4bfd3c73068b7d5464
initiate getPayloadSha256Content: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
s3.eu-central-1.amazonaws.com/<my_bucket_name>/videos/20180718_215611.mp4?uploads:1 Failed to load resource: the server responded with a status of 403 (Forbidden)
initiate error: <my_bucket_name>/videos/20180718_215611.mp4 AWS Code: AccessDenied, Message:Access Deniedstatus:403

models.py

...
videofile = S3DirectField(dest='video_destination', null=True)

settings.py

AWS_ACCESS_KEY_ID = ...
AWS_SECRET_ACCESS_KEY = ...
AWS_UPLOAD_USERNAME = '...'
AWS_STORAGE_BUCKET_NAME = '...'

AWS_S3_FILE_OVERWRITE = False
AWS_DEFAULT_ACL = None
AWS_S3_REGION_NAME = 'eu-central-1'
AWS_S3_ENDPOINT_URL = 'https://s3.eu-central-1.amazonaws.com'

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
S3DIRECT_DESTINATIONS = {
    'video_destination': {
        'key': '/videos/',
        'content_length_range': (5000, 5000000000), # 0.0000046566 gb to ca. 5 gb
    },
}

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
neilhut42commented, Oct 7, 2019

Having the same issue here, get the 403 unless the “block public access” is disabled.

0reactions
shackercommented, Aug 19, 2021

Changing the ACL between public/private made no difference for me. Just can’t figure out what’s causing the 403s.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve HTTP 403 "Access Denied" AmazonS3Exception in ...
Resolution · First, check the credentials or role specified in your application code · Check the policy for the Amazon EC2 instance profile...
Read more >
Troubleshoot 403 Access Denied errors from Amazon S3
Use the AWS Systems Manager automation documents · Check bucket and object ownership · Check the bucket policy or IAM user policies ·...
Read more >
Access Denied (Service: Amazon S3; Status Code: 403
AmazonS3Exception: Access Denied (Service: Amazon S3; Status Code: 403; Error Code: AccessDenied; Request ID: xxxxxxxxxxxxxx). AWS Collective.
Read more >
Status Code: 403; Error Code: AccessDenied; Request ID
​The status code 403, indicates that the user configured in the Amazon S3 connection does not have access to the specified object. Solution....
Read more >
Error - 'Access Denied Service: Amazon S3; Status Code
So in this scenario there are two options: 1. Confirm your application is able to run the required Read / Write operations within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found