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
posta un anno fa265 visualizzazioni
1 Risposta
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
ESPERTO
con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande