my image is uploading on s3 bucket and I added parameter ExtraArgs={"ACL":"public-read"}
but my image not available for public view. here is my code:
s3 = boto3.resource(
's3',
aws_access_key_id = "" ,
aws_secret_access_key = ""
)
bucket = s3.Bucket('my_bucket_name')
im_io.seek(0)
unique_uuid = str(uuid.uuid4())
bucket.upload_fileobj(im_io,'ads_image/'+blog_title+unique_uuid +file.filename,ExtraArgs={"ACL":"public-read"})
upload_file_url = "https://{'MY_url'}.s3.us-east-3.amazonaws.com/ads_image/"+blog_title+unique_uuid+file.filename
I also added my bucked policy and enabled public my s3 bucket. here is my bucket policy:
{
"Version": "2012-10-17",
"Id": "Policy16****",
"Statement": [
{
"Sid": "IPAllow",
"Effect": "Deny",
"Principal": "*",
"Action": [
"s3:GetObjectAcl",
"s3:PutObjectAcl",
"s3:DeleteObject",
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::bucket_name/*",
"Condition": {
"NotIpAddress": {
"aws:SourceIp": [
"my ip"
]
}
}
}
]
}