首页 > 解决方案 > AWS API 网关。从 github 更新现有 API。添加新路线

问题描述

我将通过 AWS CodePipeline 的 aws cli 命令 ( https://docs.aws.amazon.com/cli/latest/reference/apigateway/put-rest-api.html ) 更新现有的 Api 网关并遇到 CodeBuild 的问题

An error occurred (AccessDeniedException) when calling the GetRestApis operation: User: arn:aws:sts:<skipped_text> is not authorized to perform: apigateway:GET on resource: arn:aws:apigateway:us-west-2::/restapis

是否可以使用 CodePipeline 和 aws cli 通过代码更新 Api 网关?或者您使用什么作为更新 apigateway 的工具?

标签: amazon-web-servicesaws-api-gatewayaws-code-deployaws-codepipelineaws-codebuild

解决方案


确保向IAM 用户添加以下策略,以允许管理员访问(创建、读取、更新、删除)API 网关,

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "apigateway:*"
            ],
            "Resource": "arn:aws:apigateway:*::/*"
        }
    ]
}

这也存在于亚马逊管理的政策下AmazonAPIGatewayAdministrator

管理员 apigateway 访问


推荐阅读