duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #04680
[Question #664107]: Support all AWS regions
New question #664107 on Duplicity:
https://answers.launchpad.net/duplicity/+question/664107
Hi!
Currently the design of S3 backend doesn't allow for using all available regions which is a bad thing. I reviewed the code and the changes needed to enable multiple regions are really minor.
Here is a minimal version of patch:
++++++
diff --git a/duplicity/backends/_boto_single.py b/duplicity/backends/_boto_single.py
index 0fb40b2..b3e8313 100644
--- a/duplicity/backends/_boto_single.py
+++ b/duplicity/backends/_boto_single.py
@@ -165,6 +165,13 @@ class BotoBackend(duplicity.backend.Backend):
parsed_url.path.lstrip('/')))
if globals.s3_european_buckets:
self.my_location = Location.EU
+ elif globals.s3_region:
+ if globals.s3_region == "eu-west-1":
+ self.my_location = "EU"
+ elif globals.s3_region == "us-east-1":
+ self.my_location = ""
+ else:
+ self.my_location = globals.s3_region
else:
self.my_location = ''
self.resetConnection()
diff --git a/duplicity/commandline.py b/duplicity/commandline.py
index 45909ba..ce89a1e 100644
--- a/duplicity/commandline.py
+++ b/duplicity/commandline.py
@@ -527,6 +527,7 @@ def parse_cmdline_options(arglist):
# Whether to create European buckets (sorry, hard-coded to only
# support european for now).
parser.add_option("--s3-european-buckets", action="store_true")
+ parser.add_option("--s3-region", type="string")
# Whether to use S3 Reduced Redudancy Storage
parser.add_option("--s3-use-rrs", action="store_true")
diff --git a/duplicity/globals.py b/duplicity/globals.py
index 5882a70..d364fcb 100644
--- a/duplicity/globals.py
+++ b/duplicity/globals.py
@@ -183,6 +183,7 @@ s3_use_new_style = False
# Whether to create European buckets (sorry, hard-coded to only
# support european for now).
s3_european_buckets = False
+s3_region = ""
# File owner uid keeps number from tar file. Like same option in GNU tar.
numeric_owner = False
++++++
This is basically all what is needed. And then it can be used like that:
/usr/local/bin/duplicity --s3-use-new-style full /home/ec2-user --s3-region ap-southeast-1 s3://s3.amazonaws.com/s3bucket
Is it possible to include it in duplicity? For now I will use patched version but would be cool if this can be in upstream duplicity!
--
You received this question notification because your team duplicity-team
is an answer contact for Duplicity.