Even if I uploaded HTML with boto3, it was not recognized as HTML

Event

When I access the HTML uploaded by boto3, which is a library for playing with aws, it becomes a file download.

Solution

import boto3

s3 = boto3.resource('s3')
s3.Bucket(<<bucket_name>>).upload_file(
  'file name',
  'file name',
  ExtraArgs={'ContentType': 'text/html', 'ACL': 'public-read'})

Specify ContentType text / html with ExtraArgs.

Recommended Posts

Even if I uploaded HTML with boto3, it was not recognized as HTML
Even if I converted jpg to png, I managed to do it because the transparency was not tampered with
Check if it was run as root
I wondered if Python 3.4 was faster, but it was slower
If it was Ruby