小编Abh*_*mar的帖子

Cloudformation 无法为 apigateway 创建资源策略

当我直接将资源策略传递到控制台时,资源策略工作正常。以下是资源政策示例:-

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "execute-api:Invoke",
            "Resource": "arn:aws:execute-api:us-west-2:339159142535:ooxmwl6q4e/*",
            "Condition": {
                "IpAddress": {
                    "aws:SourceIp": [
                        ""14.98.8.190/32""
                    ]
                }
            }
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

现在如何创建一个 cloudformation 模板来创建它并附加到 apigateway

我尝试创建一项政策,但根据新政策,“Principal”已被废弃。

我也创建了一个角色但没有帮助。以下是角色片段:-

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Resources": {
        "Apifirewall": {
            "Type": "AWS::IAM::Role",
            "Properties": {
                "AssumeRolePolicyDocument": {
                    "Version": "2012-10-17",
                    "Statement": [
                        {
                            "Effect": "Allow",
                            "Principal": {
                                "Service": [
                                    "apigateway.amazonaws.com"
                                ]
                            },
                            "Action": [
                                "sts:AssumeRole"
                            ]
                        }
                    ]
                },
                "Policies": [
                    {
                        "PolicyName": "Apifirewall",
                        "PolicyDocument": {
                            "Version": "2012-10-17",
                            "Statement": [
                                { …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-cloudformation amazon-iam aws-api-gateway

5
推荐指数
2
解决办法
1万
查看次数