Description
Runtime: Python
Is your feature request related to a problem? Please describe
We are unable to use a local DynamoDB image when developing with Idempotent feature locally. This is due to DynamoDB boto3 resource, requiring a separate endpoint_url parameter, instead of it being part of the boto3 config object that is customizable.
Here we see the boto3 DynamoDB resource being created, however, there is no capability to set the endpoint_url
input argument to reference a local running instance.
It appears that the only method to specify a custom endpoint URL for the DynamoDB resource is through the endpoint_url
parameter when creating the resource object. https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GettingStarted.Python.Summary.html
This setting does not seem to be available in the boto3 Config
class either.
This makes it very challenging to develop locally or to do integration testing.
Describe the solution you'd like
Allow us to set the DynamoDB endpoint URL when creating the DynamoDBPersistenceLayer object when implementing the Idempotency utility.
idempotency_persistence_layer = DynamoDBPersistenceLayer(table_name="idem", endpoint_url="http://localhost:8000")
Describe alternatives you've considered
I have tried the following workaround, by setting the url manually in the protected attribute but I end up getting a HTTP 302 error...
idempotency_persistence_layer.table.meta.client._endpoint.host = "http://localhost:8000"
I have also tried creating a Session and Config object. I know that localhost
is not a valid region name but I just tried it to see if it would modify the URL used. It did not.
dynamodb_boto3_session = boto3.session.Session()
boto3_config = botocore.config.Config(region_name="localhost")
dynamodb_boto3_session.resource("dynamodb", endpoint_url="http://localhost:8000", config=boto3_config)
idempotency_persistence_layer = DynamoDBPersistenceLayer(table_name=idempotency_dynamo_table,
boto3_session=dynamodb_boto3_session)
If you provide guidance, is this something you'd like to contribute? Sure