Skip to content

Commit be53b4a

Browse files
authored
Resolve #156 Incompatible with Localstack (#180)
* Making it so alternative hosts are used when the host parameter is used instead of only when the region is set to local. This will improve compatibility with other methods of mocking AWS services while maintaining compatbility with existing scripts since the host parameter was only used for this mode anyway. * Update dynamodump.py Updating help text per requested change.
1 parent 9cedd33 commit be53b4a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ dynamodump -a tar -b some_s3_bucket -m restore -r us-east-1 -p profile -d destin
201201
## Local example
202202

203203
The following assumes your local DynamoDB is running on localhost:8000 and is accessible via 'a' as access/secret keys.
204+
You must specify the host to get local behavior.
204205

205206
```
206207
dynamodump -m backup -r local -s testTable --host localhost --port 8000 --accessKey a --secretKey a

dynamodump/dynamodump.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
DEFAULT_PREFIX_SEPARATOR = "-"
3737
CURRENT_WORKING_DIR = os.getcwd()
3838
JSON_INDENT = 2
39-
LOCAL_REGION = "local"
4039
LOCAL_SLEEP_INTERVAL = 1 # seconds
4140
LOG_LEVEL = "INFO"
4241
MAX_BATCH_WRITE = 25 # DynamoDB limit
@@ -1121,12 +1120,11 @@ def main():
11211120
"-r",
11221121
"--region",
11231122
help="AWS region to use, e.g. 'us-west-1'. "
1124-
"Can use AWS_DEFAULT_REGION for local testing. Use '"
1125-
+ LOCAL_REGION
1126-
+ "' for local DynamoDB testing",
1123+
"Can use any region for local testing",
11271124
)
11281125
parser.add_argument(
1129-
"--host", help="Host of local DynamoDB [required only for local]"
1126+
"--host",
1127+
help="Host of local DynamoDB. This parameter initialises dynamodump for local DynamoDB testing [required only for local]",
11301128
)
11311129
parser.add_argument(
11321130
"--port", help="Port of local DynamoDB [required only for local]"
@@ -1250,7 +1248,7 @@ def main():
12501248
sys.exit(1)
12511249

12521250
# instantiate connection
1253-
if args.region == LOCAL_REGION:
1251+
if args.host:
12541252
conn = _get_aws_client(
12551253
service="dynamodb",
12561254
access_key=args.accessKey,

0 commit comments

Comments
 (0)