Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 无法设置到专用AWS API网关API的SSH隧道_Amazon Web Services_Aws Api Gateway_Amazon Vpc_Ssh Tunnel - Fatal编程技术网

Amazon web services 无法设置到专用AWS API网关API的SSH隧道

Amazon web services 无法设置到专用AWS API网关API的SSH隧道,amazon-web-services,aws-api-gateway,amazon-vpc,ssh-tunnel,Amazon Web Services,Aws Api Gateway,Amazon Vpc,Ssh Tunnel,我有一个专用的AWS API网关REST API,这意味着它只能在我的VPC内访问。 我有一个bastion SSH实例在VPC中运行,这意味着我可以做这样的事情: ssh -J ec2-user@<bastion> ec2-user@<ip of EC2 instance within my VPC> 这个命令返回的很好,但是当我尝试执行curl localhost:8888/dev/时,首先会得到一个证书错误,这是很自然的,但是当我尝试使用curl-k localh

我有一个专用的AWS API网关REST API,这意味着它只能在我的VPC内访问。 我有一个bastion SSH实例在VPC中运行,这意味着我可以做这样的事情:

ssh -J ec2-user@<bastion> ec2-user@<ip of EC2 instance within my VPC>
这个命令返回的很好,但是当我尝试执行
curl localhost:8888/dev/
时,首先会得到一个证书错误,这是很自然的,但是当我尝试使用
curl-k localhost:8888/dev/
忽略证书时,我只会从AWS得到一个403禁止响应。对于这些请求,我的RESTAPI访问日志中没有任何内容

403与我忽略TLS证书这一事实有关,还是其他原因? 有可能建一条这样的隧道吗?
不幸的是,似乎不可能对API网关REST API:s使用纯HTTP,否则我更希望对这种类型的东西使用纯HTTP。

API网关要求主机头与API端点URL匹配。将主机名添加到您的
/etc/hosts

<api-id>.execute-api.eu-west-1.amazonaws.com 127.0.0.1
或者,如果您的bastion配置为允许,您可以使用
ssh
作为SOCKS5代理,并通过bastion代理您的请求

在一个shell会话中启动代理

ssh -D 8888 ec2-user@<bastion>
ssh-d8888ec2用户@
然后在另一个shell中,使用它

export HTTPS_PROXY=socks5://localhost:8888
curl https://<api-id>.execute-api.eu-west-1.amazonaws.com/dev/<my endpoint>
export HTTPS\u PROXY=socks5://localhost:8888
卷曲https://.execute-api.eu-west-1.amazonaws.com/dev/

您是否有与API网关关联的WAF?@nayem没有,没有WAF!这听起来很有希望,谢谢。我会在假期后试试这个。后期跟进:resolve标志对我不起作用,但是使用/etc/hosts非常有效。这为我省去了很多痛苦,谢谢!(至于这个问题为什么会被否决,我不确定人们是否认为它应该被发布在Serverfault上——我真的不同意。这与AWS的开发有关。)最近遇到了完全相同的问题-
——resolve
flag为我工作,在端口443的两端有一个隧道通过我们的堡垒主机打开。然后curl命令:
curl https://[api id]。执行api.[region]。amazonaws.com/blah--resolve[api id]。执行api.[region]。amazonaws.com:443:127.0.0.1
ssh -D 8888 ec2-user@<bastion>
export HTTPS_PROXY=socks5://localhost:8888
curl https://<api-id>.execute-api.eu-west-1.amazonaws.com/dev/<my endpoint>