[英]AWS API Gateway Method Authentication using AWS_IAM
I've created an API Gateway and added AWS_IAM for Authorization.我创建了一个 API 网关并添加了 AWS_IAM 进行授权。 I've launched an EC2 instance with the below role attached,
我已经启动了一个附有以下角色的 EC2 实例,
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"execute-api:Invoke"
],
"Resource": [
"arn:aws:execute-api:ap-south-1:123456789123:abcd12345/*/*/myresource"
]
}
]
}
When I tried to do CURL to my API gateway endpoint, the request failed with 403 and message "Missing Authentication Token".当我尝试对我的 API 网关端点执行 CURL 时,请求失败并显示 403 和消息“缺少身份验证令牌”。
Is it not possible to use role with IAM authorization in API Gateway?不能在 API 网关中使用具有 IAM 授权的角色吗?
It is possible, but regular curl
does not create a signed request with AWS credentials .这是可能的,但常规
curl
不会使用 AWS 凭证创建签名请求。 You need to contract such signature and call your API endpoint with that signature.您需要签订此类签名并使用该签名调用您的 API 端点。
If you work with python you can do this using aws-requests-auth on your instance.如果您使用 python,您可以在您的实例上使用aws-requests-auth来执行此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.