Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 bucket creation step fails for certain regions #4

Open
arjun289 opened this issue Jun 8, 2023 · 0 comments
Open

S3 bucket creation step fails for certain regions #4

arjun289 opened this issue Jun 8, 2023 · 0 comments

Comments

@arjun289
Copy link

arjun289 commented Jun 8, 2023

In the script create_cfn_stack.py the create_bucket function fails for certain regions with the following error:

A client error (IllegalLocationConstraintException) occurred when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.

Upon searching a bit I landed on this issue aws/aws-cli#2603

For now I have mitigated the issue by modifying the code for my region and adding the LocationConstraint

def create_bucket(bucket_name):
    """Create an S3 bucket in a specified region

    :param bucket_name: Bucket to create
    :return: True if bucket created, else False
    """

    try:
        s3_client.create_bucket(
            Bucket=bucket_name,
            CreateBucketConfiguration={'LocationConstraint': 'ap-southeast-1'}
        )
        logging.info(f'New bucket name: {bucket_name}')
    except ClientError as e:
        logging.info('An error occurred !!', bucket_name)
        logging.error(e)
        return False
    return True

However I think the script can be modified to accommodate for this so it doesn't fail.

@arjun289 arjun289 changed the title S3 bucket creation step fails for some regions S3 bucket creation step fails for certain regions Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant