I am storing profile pictures for my app in AWS S3. I have it working on my localhost, but when I do it in production, I get the error:
[Wed Nov 04 00:34:53.554807 2020] [:error] [pid 14967] [remote 172.31.2.3:112] botocore.exceptions.ClientError: An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
Below is a portion of my bucket policy pertaining to PutObject:
"Version": "2008-10-17",
"Statement": [
{
"Sid": "*****",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam:::******role/aws-elasticbeanstalk-ec2-role"
},
"Action": [
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": "arn:aws:s3:::******/resources/environments/logs/*"
},
I'm not sure why this would work on my localhost but not when I deploy it. Any help would be appreciated.