英文:
Why does DynamoDB have a "DescribeEndpoints" request?
问题
One of the API requests that DynamoDB has is DescribeEndpoints
. According to its documentation, it "Returns the regional endpoint information." Basically it returns something like dynamodb.us-east-1.amazonaws.com
when connected to us-east-1. But, how is this useful? If I'm already connecting to the us-east-1 endpoint to make that request, it means I already know the endpoint address, don't I?
But I'm worried that this request is actually worse than just useless. The thing is, it only returns an address, not a full URL - the endpoint returned does not list a scheme (http or https) or port number. So if a program wants to use the result as an endpoint, it needs to guess the URL scheme and port (e.g., https and 443). This guess would be wrong on, for example, DynamoDB Local or ScyllaDB Alternator - for example the former runs by default on http port 8000. I noticed that, perhaps for this reason, DynamoDB Local does not implement the DescribeEndpoints
request at all.
So my question is: Why does the DescribeEndpoints
request exist in DynamoDB at all, and under which circumstances should a DynamoDB application use it? Also, is it fine that DynamoDB Local decided not to implement this request at all? What sort of application might break by the missing DescribeEndpoints support?
What led me to this question was seeing what the new DynamoDB Shell (which is written using the AWS C++ SDK) does when given an endpoint URL (e.g., DDBSH_ENDPOINT_OVERRIDE=http://localhost:8000/
). The first thing it does is to call DescribeEndpoints
and then use its result to replace the endpoint URL, in a broken way - it takes the new address it gets in the response, together with the port number "8000" from the variable but incorrectly sets the scheme to "https", and unsurprisingly the result mix doesn't have to work... It does work on DynamoDB (without the endpoint override) and DynamoDB Local (which doesn't implement DescribeEndpoints
) but fails on ScyllaDB Alternator.
英文:
One of the API requests that DynamoDB has is DescribeEndpoints
. According to its documentation, it "Returns the regional endpoint information." Basically it returns something like dynamodb.us-east-1.amazonaws.com
when connected to us-east-1. But, how is this useful? If I'm already connecting to the us-east-1 endpoint to make that request, it means I already know the endpoint address, don't I?
But I'm worried that this request is actually worse than just useless. The thing is, it only returns an address, not a full URL - the endpoint returned does not list a scheme (http or https) or port number. So if a program wants to use the result as an endpoint, it needs to guess the URL scheme and port (e.g., https and 443). This guess would be wrong on, for example, DynamoDB Local or ScyllaDB Alternator - for example the former runs by default on http port 8000. I noticed that, perhaps for this reason, DynamoDB Local does not implement the DescribeEndpoints
request at all.
So my question is: Why does the DescribeEndpoints
request exist in DynamoDB at all, and under which circumstances should a DynamoDB application use it? Also, is it fine that DynamoDB Local decided not to implement this request at all? What sort of application might break by the missing DescribeEndpoints support?
What led me to this question was seeing what the new DynamoDB Shell (which is written using the AWS C++ SDK) does when given an endpoint URL (e.g., DDBSH_ENDPOINT_OVERRIDE=http://localhost:8000/
). The first thing it does is to call DescribeEndpoints
and then use its result to replace the endpoint URL, in a broken way - it takes the new address it gets in the response, together with the port number "8000" from the variable but incorrectly sets the scheme to "https", and unsurprisingly the result mix doesn't have to work... It does work on DynamoDB (without the endpoint override) and DynamoDB Local (which doesn't implement DescribeEndpoints
) but fails on ScyllaDB Alternator.
答案1
得分: 1
在DynamoDB中,您不需要指定端点,因为它是根据为您的客户端设置的区域隐式决定的。
我发现DescribeEndpoints
在解决诸如ResourceNotFoundException等问题时非常有价值,它能够突显出我没有连接到我所认为的区域,因为区域在配置类之外被重置。
由于AWS的端点是"实现"细节,它们可能会发生变化,因此在这种情况下,DescribeEndpoints API将会有益处。由于DynamoDB已经存在了12年,很可能这个API是在端点遵循严格的模式之前创建的。
英文:
In DynamoDB you don't need to specify an endpoint as it's implicitly decided based on the region set for you client.
I've found DescribeEndpoints
valuable when troubleshooting issues such as ResourceNotFoundException which was able to highlight that I was not connecting to the region I believed as the region was being reset outside of the config class.
As the endpoints for AWS are "implementation" detail then they can be subject to change, in which the DescribeEndpoints API would be beneficial in that case. As DynamoDB is 12 years old it's highly likely this API was created before the endpoints followed a rigid schema.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论