我有一个Amazon API Gateway 中的私有 API https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-private-apis.html我想通过具有 VPC 支持的 lambda 从另一个帐户使用它。我修改了 API ResourcePolicy 以允许基于指定的源 VPC 的私有 API 流量here https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-resource-policies-examples.html#apigateway-resource-policies-source-vpc-example,在最后一个例子中。这就是我的 ResourcePolicy 的样子:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": "arn:aws:execute-api:my-region:my-account:api-id/*",
"Condition": {
"StringEquals": {
"aws:sourceVpce": "my-vpce"
}
}
},
{
"Effect": "Allow",
"Principal": "*",
"Action": "execute-api:Invoke",
"Resource": ""arn:aws:execute-api:my-region:my-account:api-id/*",
"Condition": {
"StringEquals": {
"aws:SourceVpc": "my-vpc-from-another-account"
}
}
}
]
}
现在,当我尝试使用 API 时https://my-api-id.execute-api.us-west-2.amazonaws.com/my-stage/
端点,我得到getaddrinfo ENOTFOUND
错误。这是公开私有 API 以便从另一个帐户从 VPC 访问的适当方法吗?
问了AWS的人,答案是你可以指定源VPC,但前提是它位于同一个账户中。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)