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
preguntada hace un año265 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace un año

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas