amazon-bedrock-workshop icon indicating copy to clipboard operation
amazon-bedrock-workshop copied to clipboard

S3 bucket creation for Regions other than us-east-1

Open bengruher opened this issue 1 year ago • 0 comments

In 07_Agents/insurance_claims_agent notebooks (and possibly others), we make a call to the S3 boto3 client to create a bucket. However, if we are running the notebook in a Region other than us-east-1, we will receive the following error: A client error (IllegalLocationConstraintException) occurred when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

To fix this error, we must specify the desired Region in the API call. For example, in the with_kb/create_and_invoke_agent notebook, we would change the S3 bucket creation cell to: # Create S3 bucket for Open API schema s3bucket = s3_client.create_bucket( Bucket=bucket_name, CreateBucketConfiguration={'LocationConstraint': region} )

bengruher avatar Jan 22 '24 17:01 bengruher