Hi,
I am getting below error when trying to upload files in S3 bucket. I checked policies and updated them but still getting error.
2023-01-01T16:08:29.758+05:30
Jan 1 10:38:29 ip-172-31-40-199 web: boto3.exceptions.S3UploadFailedError: Failed to upload static/uploads/alexa.wav to myflask/alexa.wav: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
Jan 1 10:38:29 ip-172-31-40-199 web: boto3.exceptions.S3UploadFailedError: Failed to upload static/uploads/alexa.wav to myflask/alexa.wav: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
Jan 1 10:58:40 ip-172-31-40-199 web: ERROR:aws_xray_sdk.core.context:cannot find the current segment/subsegment, please make sure you have a segment open
Bucket is public and policy applied is
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "myflask-allow-permission-for-saving-audios",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::377727317375:role/aws-elasticbeanstalk-ec2-role"
},
"Action": [
"s3:PutObject",
"s3:ListBucket",
"s3:ListBucketVersions",
"s3:GetObject",
"s3:GetObjectVersion"
],
"Resource": [
"arn:aws:s3:::myflask",
"arn:aws:s3:::myflask/*"
]
}
]
}
Hi Kihyeon,
I searched a lot and later found on a forum that "s3:PutObjectAcl" is also needed along with s3:PutObject, once I added this, it worked perfectly.
Thank you for updating the status