onnela-lab / beiwe-backend

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe backend code
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
64 stars 46 forks source link

Error creating S3 bucket in us-east-1 with LocationConstraint option #28

Closed zagorsky closed 6 years ago

zagorsky commented 6 years ago
  1. Error report from Zhe, relating to Deployment Instructions for Robust Setup: Configure your application, Step 7:

    Configure Step 7 (creating an S3 bucket). If setting up in us-east-1 AWS region, the current code didn't work. This issue has been mentioned elsewhere (https://github.com/boto/boto3/issues/811 and https://github.com/heptio/ark/issues/284); I don't fully understand it, but it seems that when creating an S3 bucket in us-east-1, the code should not specify the region. To fix this, I had to make a minor change to the s3_create_bucket() function, and get rid of the "LocationConstraint" option (since I'm using us-east-1).

  2. This stack trace from Hanyu is probably the same issue:

    File "launch_script.py", line 521, in <module>
        do_create_environment()
    File "launch_script.py", line 313, in do_create_environment
        create_finalized_configuration(name)
    File ".../beiwe-backend/cluster_management/deployment_helpers/configuration_utils.py", line 203, in create_finalized_configuration
        config["S3_BUCKET"] = create_data_bucket(eb_environment_name)
    File ".../beiwe-backend/cluster_management/deployment_helpers/aws/s3.py", line 24, in create_data_bucket
        s3_create_bucket(name)
    File ".../beiwe-backend/cluster_management/deployment_helpers/aws/s3.py", line 10, in s3_create_bucket
        CreateBucketConfiguration = {'LocationConstraint': GLOBAL_CONFIGURATION["AWS_REGION"]})
    File ".../python2.7/site-packages/botocore/client.py", line 312, in _api_call
        return self._make_api_call(operation_name, kwargs)
    File ".../python2.7/site-packages/botocore/client.py", line 601, in _make_api_call
        raise error_class(parsed_response, operation_name)
    botocore.exceptions.ClientError: An error occurred (InvalidLocationConstraint) when calling the CreateBucket operation: The specified location-constraint is not valid
zagorsky commented 6 years ago

Fixed in 1311d62.