I am trying to find an efficient way to check whether a bucket exist in aws S3 service. I don't want to use the list bucket function of s3 go sdk 'listBuckets' I tried using 'headBucket' function but I think i am using it in the wrong way. any help would be appreciated!
headBucket is the right method if it is your bucket. This way you can check if the bucket exists.
If you mean globally I would try to create the bucket with a uuid at the end. If the bucket already exists you will get the error:
ErrCodeBucketAlreadyExists "BucketAlreadyExists".
Does this help?
Greetings
Dominik