AWS Content Type Settings in S3 Using Boto3

Content-Type isn’t custom metadata, which is what Metadata is used for. It has its own property which can be set like this:

bucket.put_object(Key='index.html', Body=data, ContentType="text/html")

Note: .put_object() can set more than just Content-Type. Check out the Boto3 documentation for the rest.

Leave a Comment