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
feita há um ano265 visualizações
1 Resposta
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
ESPECIALISTA
respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas