2 réponses
- Le plus récent
- Le plus de votes
- La plupart des commentaires
1
You're almost there! What you're not doing is setting the content type when uploading the file to S3. The AWS CLI does this for you automatically (and silently) but you need to set it when using boto3. Luckily that's really easy:
s3 = boto3.client('s3')
s3.put_object(Bucket='bucketNameHere', Key='index.html', Body=bodyOfFileGoesHere, ContentType='text/html')
1
Hi,
You have got an issue with your bucket policy,
'Action': 's3:GetObject',
'Resource': f'{BUCKET_ARN}/*'
With Action with *Object, you must add /* meaning all objects.
répondu il y a 9 mois
Contenus pertinents
- demandé il y a 7 mois
- demandé il y a 4 mois
- AWS OFFICIELA mis à jour il y a 3 ans
- AWS OFFICIELA mis à jour il y a un an
- AWS OFFICIELA mis à jour il y a 2 ans
Already did this but still not working. I updated my question to include the source code.
If you do some debugging - what is the
mime_type
variable set to? Is it actuallytext/html
? You can also check the content type in the AWS Console by looking at the object metadata.