2 Risposte
- Più recenti
- Maggior numero di voti
- Maggior numero di commenti
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.
con risposta 9 mesi fa
Contenuto pertinente
- AWS UFFICIALEAggiornata 2 anni fa
- AWS UFFICIALEAggiornata 3 anni fa
- AWS UFFICIALEAggiornata 3 anni fa
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.