Skip to content

Idempotent Feature - Specify Endpoint URL for DynamoDB Persistence Layer #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kimberlyamandalu opened this issue Aug 24, 2021 · 1 comment
Assignees
Labels
Idempotency Proposed Community submited

Comments

@kimberlyamandalu
Copy link

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

@kimberlyamandalu kimberlyamandalu added Pending/Triage Pending triage Proposed Community submited labels Aug 24, 2021
@to-mc to-mc self-assigned this Oct 1, 2021
@to-mc to-mc added Idempotency and removed Pending/Triage Pending triage labels Oct 1, 2021
@to-mc
Copy link

to-mc commented Oct 1, 2021

Should be addressed by: aws-powertools/powertools-lambda-python#719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idempotency Proposed Community submited
Projects
None yet
Development

No branches or pull requests

3 participants