when i try to create a Bucket. I'm getting "bucket...
# help
s
when i try to create a Bucket. I'm getting "bucket is already exists error". Is there any way to create a bucket if not exists?
r
Bucket names need to be globally unique could be that someone else has already taken that name?
s
Thanks
l
You can always check for the name prior to bucket creation with a
Copy code
const element = s3.Bucket.fromBucketName(this, 'bucketCheck', '<YOUR-BUCKET-NAME>');
    if (element && element.bucketArn) {
      <fancy stuff goes here>
    }
then do some randomization of the name
s
thanks