Skip to content

Instantly share code, notes, and snippets.

@davidmukiibi
Last active January 1, 2020 22:48
Show Gist options
  • Save davidmukiibi/9e3f2af05bb3b2a16155edb0303284e2 to your computer and use it in GitHub Desktop.
Save davidmukiibi/9e3f2af05bb3b2a16155edb0303284e2 to your computer and use it in GitHub Desktop.
def create_bucket(self, bucket_name, region=None):
speak_output = ""
try:
s3_client.create_bucket(Bucket=bucket_name)
except ClientError as e:
logging.error(e)
if e.response['Error']['Code'] == "BucketAlreadyExists":
speak_output = "The requested bucket name is either not available, already \
exists or not unique to AWS, please select a different name and try again."
return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment