Reputation: 31
I deployed my django project using AWS Elastic beanstalk and S3, and I tried to upload the profile avatar but it shows Server Error(500)
My Sentry log shows me, "An error occurred (IllegalLocationConstraintException) when calling the PutObject operation: The eu-south-1 location constraint is incompatible for the region specific endpoint this request was sent to."
I think this error appeared because I put my bucket on eu-south-1 but I try to access it and to create a new object in Seoul, Korea.
Also, the AWS document said IllegalLocationConstraintException indicates that you are trying to access a bucket from a different Region than where the bucket exists. To avoid this error, use the --region option. For example: aws s3 cp awsexample.txt s3://testbucket/ --region ap-east-1. (https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html)
but this solution might be just for when upload a file from AWS CLI...
I tried to change my bucket policy by adding this but doesn't work.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::{BucketName}/*"
}
]
}
I don't know what should I do and why they do not allow access from other regions? How to allow access to create, update and remove an object in my bucket from all around the world? This is my first deployment please help me🥲
Upvotes: 1
Views: 1420