I'm trying to upload images to a Digital Ocean space from my application. These images are public and I am able to upload the images but they are getting uploaded as private
I have tried adding x-amz-acl variable to public-read after I get the presigned POST values but it is still getting uploaded as private.
I have also tried giving the conditions parameter as specified below but got the error as:
policy can not recognise variable acl
Here is my code
session = boto3.session.Session()
# Generate a presigned S3 POST URL
client = session.client('s3',
config=botocore.config.Config(s3={'addressing_style': 'virtual'}),
region_name=os.getenv('DEFAULT_REGION'),
endpoint_url='https://sgp1.digitaloceanspaces.com',
aws_access_key_id=os.getenv('S3_ACCESS_KEY'),
aws_secret_access_key=os.getenv('S3_SECRET_KEY'))
try:
response = client.generate_presigned_post(Bucket=os.getenv('BUCKET_NAME'),
Key=object_name,
# Conditions=[{"ACL": "public-read"}],
ExpiresIn=expiration)
except ClientError as e:
logging.error(e)
return None
# The response contains the presigned URL and required fields
return response
After getting the response from my application I have been adding another multipart/form field:
x-amz-acl: public-read
But still nothing is helping. Would really appreciate if anyone help me solve it!