【问题标题】:Amazon Redshift : Acces Denied RestoreClusterSnapshotRequestAmazon Redshift:拒绝访问还原集群快照请求
【发布时间】:2016-07-28 23:03:05
【问题描述】:

我在尝试使用快照还原集群时遇到问题。我将不胜感激。

使用的代码是:

var con = new AmazonRedshiftClient(acess_key_id, secret_acess_key, Amazon.RegionEndpoint.USWest2);

        var restore = new Amazon.Redshift.Model.RestoreFromClusterSnapshotRequest()
        {
            ClusterIdentifier = clusterIdentifier,
            SnapshotIdentifier = snapshotIdentifier,
            AvailabilityZone = "us-west-2a",
        };

        var response = con.RestoreFromClusterSnapshot(restore);

        Console.WriteLine("Cluster Status : {0}", response.Cluster.ClusterStatus);

当它调用 RestoreClusterSnapshotRequest 操作时,我有一个异常: “拒绝访问。请确保您的 IAM 权限允许此操作。”

像这样为 Amazon Redshift 使用基于身份的策略(IAM 策略) 政策:

{
"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": [
            "redshift:CopyClusterSnapshot",
            "redshift:RestoreFromClusterSnapshot",
            "redshift:AuthorizeSnapshotAccess",
            "redshift:RevokeSnapshotAccess"
        ],
        "Resource": [
            "arn:aws:redshift:us-west-2:{AccoundId}:*/backup-20160208-dbrd",
            "arn:aws:redshift:us-west-2: {AccoundId}:cluster:*"
        ]
    },
    {
        "Effect": "Allow",
        "Action": [
            "redshift:DescribeClusterSnapshots"
        ],
        "Resource": [
            "*"
        ]
    }
]

}

任何人都可以帮助我克服这个问题.. 如果我在此过程中犯了任何错误,请纠正我.. .

提前致谢

【问题讨论】:

    标签: amazon-s3 amazon-redshift aws-sdk


    【解决方案1】:

    按照the other answer 中的建议,您应该更改此行:

    "arn:aws:redshift:us-west-2:{AccoundId}:*/backup-20160208-dbrd",
    

    "arn:aws:redshift:us-west-2:{AccoundId}:snapshot:*/backup-20160208-dbrd",
    

    此外,我通过大量试验和错误以及 AWS 支持的帮助发现,您还需要多个 ec2 权限才能从快照恢复 Redshift 集群。此时的名单是:

        {
            "Sid": "",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeAccountAttributes",
                "ec2:DescribeAddresses",
                "ec2:DescribeAvailabilityZones",
                "ec2:DescribeSecurityGroups",
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcs",
                "ec2:DescribeInternetGateways"
            ],
            "Resource": "*"
        }
    

    您可能只想使用ec2:Describe* 来方便和/或防止将来发生这种情况(如果确切的权限集发生更改)。

    Amazon Redshift Snapshots docs(搜索“RestoreFromClusterSnapshot”)应该很快就会使用此信息进行更新。

    【讨论】:

      【解决方案2】:

      我认为您缺少“资源”部分中的快照详细信息部分。 请看下面的更新:

      "Resource": [
                  "arn:aws:redshift:us-west-2:{AccoundId}:*/backup-20160208-dbrd",
                  "arn:aws:redshift:us-west-2: {AccoundId}:cluster:*",
                  "arn:aws:redshift:us-west-2:{AccoundId}:snapshot:*"
              ]
      

      希望这会对你有所帮助。

      【讨论】:

        【解决方案3】:

        疯了,但这就是秘诀。

                "ec2:DescribeAccountAttributes",
                "ec2:DescribeAddresses",
                "ec2:DescribeAvailabilityZones",
                "ec2:DescribeSecurityGroups",
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcs",
                "ec2:DescribeInternetGateways"
        

        【讨论】:

          猜你喜欢
          • 2022-08-05
          • 1970-01-01
          • 2012-04-30
          • 1970-01-01
          • 1970-01-01
          • 2021-02-10
          • 1970-01-01
          • 2017-02-22
          • 2023-03-22
          相关资源
          最近更新 更多