google / cloud-forensics-utils

Python library to carry out DFIR analysis on the Cloud
Apache License 2.0
452 stars 89 forks source link

CreateBucket throws BucketAlreadyOwnedByYou exception #442

Open ramo-j opened 2 years ago

ramo-j commented 2 years ago

From a jenkins e2e test:

Traceback (most recent call last):
  File "/tmp/workspace/libcloudforensics-e2e-aws/libcloudforensics/providers/aws/internal/s3.py", line 94, in CreateBucket
    bucket = client.create_bucket(
  File "/usr/local/lib/python3.8/dist-packages/botocore/client.py", line 401, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.8/dist-packages/botocore/client.py", line 731, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.BucketAlreadyOwnedByYou: An error occurred (BucketAlreadyOwnedByYou) when calling the CreateBucket operation: Your previous request to create the named bucket succeeded and you already own it.

If the bucket exists and is already owned by the user, we probably shouldn't throw an error but allow them to continue. We can return a created value to indicate whether the bucket was created or already existed.