in aws/s3.go [23:45]
func CreateS3Bucket(client S3Client, bucketName *string, accountId *string) *string {
if *bucketName == "" {
*bucketName = fmt.Sprintf("sagemaker-edgemanager-%s", *accountId)
}
_, err := client.CreateBucket(context.TODO(), &s3.CreateBucketInput{
Bucket: bucketName,
CreateBucketConfiguration: &types.CreateBucketConfiguration{
LocationConstraint: types.BucketLocationConstraintUsWest2,
},
})
if err != nil {
var bne *types.BucketAlreadyOwnedByYou
var be *types.BucketAlreadyExists
if errors.As(err, &bne) || errors.As(err, &be) {
return bucketName
}
log.Fatalf("Failed to create bucket %s. Encountered error %s\n", *bucketName, err)
}
return bucketName
}