无法通过 SSH 隧道 Sigv4 访问 Amazon Neptune



我正在尝试从SSH隧道访问Neptune集群status端点。我可以在我的堡垒主机上毫无问题地命中它,但当通过ssh隧道进行操作时,我会得到:

https://localhost:8182/status

{"detailedMessage":"Bad request.","requestId":"random-request-id-appears-here","code":"BadRequestException"}

我该怎么做?我似乎需要一些sigv4的东西。我希望在浏览器中点击后能看到响应效果。

在设置了env变量后,我也尝试了awscurl,我得到了:

raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='localhost', port=8182): Max retries exceeded with url: /status (Caused by SSLError(SSLCertVerificationError("hostname 'localhost' doesn't match either of '*.id.us-east-2.neptune.amazonaws.com', '*.id.us-east-2.neptune.amazonaws.com', '*.cluster-custom-id.us-east-2.neptune.amazonaws.com', '*.cluster-ro-id.us-east-2.neptune.amazonaws.com'")))

当使用SSH隧道使用localhost访问Neptune时,需要显式地将Neptune端点作为主机头来签名请求。考虑以下awscurl示例:

awscurl -k --service neptune-db --access_key $ACCESS_KEY --secret_key $SECRET_KEY --region <neptune_instance_region> --session_token $SESSION_TOKEN --header 'host: <neptune-cluster-endpoint-withouthttp-withoutport>' https://localhost:8182/status

如果没有明确的主机头,请求将使用";localhost";签名无效。

最新更新