diff --git a/README.md b/README.md index c04ffa4..777b56c 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,9 @@ seconds to sleep between retries ##### `-c NUM_THREADS, --num-threads=NUM_THREADS` number of concurrent threads +##### `--endpoint-url` +endpoint url used in boto3 client + ##### `-d, --show-directory` show directory instead of its content diff --git a/s4cmd.py b/s4cmd.py index 4090c86..a39f73f 100755 --- a/s4cmd.py +++ b/s4cmd.py @@ -385,9 +385,10 @@ def __init__(self, opt, aws_access_key_id=None, aws_secret_access_key=None): if (aws_access_key_id is not None) and (aws_secret_access_key is not None): self.client = self.boto3.client('s3', aws_access_key_id=aws_access_key_id, - aws_secret_access_key=aws_secret_access_key) + aws_secret_access_key=aws_secret_access_key, + endpoint_url=opt.endpoint_url) else: - self.client = self.boto3.client('s3') + self.client = self.boto3.client('s3', endpoint_url=opt.endpoint_url) # Cache the result so we don't have to recalculate. self.legal_params = {} @@ -1838,6 +1839,9 @@ def check_dict(self, opt, value): parser.add_option( '--ignore-empty-source', help='ignore empty source from s3', dest='ignore_empty_source', action='store_true', default=False) + parser.add_option( + '--endpoint-url', help='configure boto3 to use a different s3 endpoint', + dest='endpoint_url', type='string', default=None) parser.add_option( '--use-ssl', help='(obsolete) use SSL connection to S3', dest='use_ssl', action='store_true', default=False)