Movatterモバイル変換


[0]ホーム

URL:


ContentsMenuExpandLight modeDark modeAuto light/dark, in light modeAuto light/dark, in dark modeClose MenuSkip to content
Boto3 1.39.8 documentation
Light LogoDark Logo
Boto3 1.39.8 documentation

Feedback

Do you have a suggestion to improve this website or boto3?Give us feedback.

Back to top

Using an Amazon S3 bucket as a static web host

An S3 bucket can be configured to host a static website.

Retrieve a website configuration

Retrieve a bucket’s website configuration by calling the AWS SDK for Pythonget_bucket_website method.

importboto3# Retrieve the website configurations3=boto3.client('s3')result=s3.get_bucket_website(Bucket='amzn-s3-demo-website-bucket')

Set a website configuration

A bucket’s website configuration can be set by calling theput_bucket_website method.

# Define the website configurationwebsite_configuration={'ErrorDocument':{'Key':'error.html'},'IndexDocument':{'Suffix':'index.html'},}# Set the website configurations3=boto3.client('s3')s3.put_bucket_website(Bucket='amzn-s3-demo-website-bucket',WebsiteConfiguration=website_configuration)

Delete a website configuration

A bucket’s website configuration can be deleted by calling thedelete_bucket_website method.

# Delete the website configurations3=boto3.client('s3')s3.delete_bucket_website(Bucket='amzn-s3-demo-website-bucket')
On this page

[8]ページ先頭

©2009-2025 Movatter.jp