Understanding Automatic Index.html Generation Using Lambda

Asked 2 years ago, Updated 2 years ago, 102 views

Understanding Automatic Index.html Generation Using Lambda

You were able to generate index.html in any bucket using python boto3.

However, when you open index.html generated by lambda, the browser does not display the contents and downloads them.

Try uploading a file with the same content manually and performing the same behavior, and HTML will appear in your browser.

Is there a difference in permissions due to the difference in the route to be uploaded?
I'm comparing the properties of the files listed in the above two routes, but I can't find any differences.

Please let me know.

aws lambda amazon-s3

2022-09-30 19:23

1 Answers

Uploads from the management console or through the AWS CLI automatically grant the Content-Type based on the original file extension, but Boto3 does not have such an action and must.

For example, if you use put_object, run it with the argument ContentType='text/html'.

http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.put_object


2022-09-30 19:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.