How to create s3 bucket using AWS-SDK without enabling cors for created bucket?

0

Access to XMLHttpRequest at 'https://bunchy1.s3.ap-south-1.amazonaws.com/' from origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Neela
已提問 1 年前檢視次數 265 次
1 個回答
0

You can create an S3 with the following code.
Cors is not set in this code.

import boto3

AWS_REGION ="ap-northeast-1"

client = boto3.client('s3',region_name=AWS_REGION)

bucket_name = "bucket_name"

response = client.create_bucket(Bucket=bucket_name,
                                CreateBucketConfiguration={'LocationConstraint': AWS_REGION})
profile picture
專家
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南