I am using fastAPI endpoint with code below :
import logging
import boto3
import botocore
from botocore.exceptions import ClientError
def create_presigned_url(bucket_name, object_name, expiration=600):
# Choose AWS CLI profile, If not mentioned, it would take default
boto3.setup_default_session(profile_name='personal')
# Generate a presigned URL for the S3 object
s3_client = boto3.client('s3',region_name="ap-south-1",config=boto3.session.Config(signature_version='s3v4',))
try:
response = s3_client.generate_presigned_url('get_object',
Params={'Bucket': bucket_name,
'Key': object_name},
ExpiresIn=expiration)
except Exception as e:
print(e)
logging.error(e)
return "Error"
# The response contains the presigned URL
print(response)
return response
also using S3 plugin for strapi to upload the images for blogs. Strapi is unable to use this presigned url. Any help is appreciated.