Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services AWS redshift创建群集的带有EC2实例凭据的AWS SDK/CLI访问错误_Amazon Web Services_Amazon Ec2_Amazon Redshift_Aws Sdk_Amazon Iam - Fatal编程技术网

Amazon web services AWS redshift创建群集的带有EC2实例凭据的AWS SDK/CLI访问错误

Amazon web services AWS redshift创建群集的带有EC2实例凭据的AWS SDK/CLI访问错误,amazon-web-services,amazon-ec2,amazon-redshift,aws-sdk,amazon-iam,Amazon Web Services,Amazon Ec2,Amazon Redshift,Aws Sdk,Amazon Iam,我有一个与我的EC2实例关联的IAM角色,具有以下关于红移的策略: { "Version": "2012-10-17", "Statement": [ { "Action": [ "redshift:*" ], "Resource": "*", "Effect": "Allow" } ] } 但是,从带有AWS

我有一个与我的EC2实例关联的IAM角色,具有以下关于红移的策略:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": [
                "redshift:*"
            ],
            "Resource": "*",
            "Effect": "Allow"
        }
    ]
}
但是,从带有AWS SDK或CLI的EC2实例中,我无法创建集群

两者

结果:

An error occurred (UnauthorizedOperation) when calling the CreateCluster operation: Access Denied. Please ensure that your IAM Permissions allow this operation.
使用IAM策略模拟工具,我能够确认我的实例角色具有创建红移群集的权限


理解这一点的任何帮助都将不胜感激。

如果您能够调用其他红移操作,而它只是在
createCluster()
上失败,那么错误可能是由传递给红移的IAM角色引起的

你需要这样做

其背后的逻辑是:

  • 假设您没有访问S3 bucket X的权限
  • 假设您的帐户中有一个角色确实可以访问bucket X
  • 您可以使用角色启动一个红移集群,然后使用它访问bucket X
  • 为了防止人们像这样作弊,他们需要
    PassRole
    权限来说明是否允许他们将角色传递给Redshift,甚至允许他们传递哪些角色

这同样适用于向Amazon EC2实例传递角色。

检查是否可以调用
aws红移描述集群。如果这也给出了一个错误,那么您没有使用与上述策略关联的凭据。如果上述策略与IAM角色关联,并且该角色与EC2实例关联,并且您正在EC2实例上运行该命令,但该命令失败,则您可能在EC2实例上存储了备用凭据(例如在
.aws/credentials
中)。我可以调用descripe clusters,以及与角色的其他策略关联的各种其他命令。我将检查其他凭证可能是您没有权限将
PassRole
转换为红移,但这并不能解释您没有传递角色的命令行失败。您的CLI命令对我有效,因此它既不是语法问题,也不是任何缺少的参数。是的,这是IAM设置。请参阅:您可以通过在没有角色的情况下启动红移来测试该理论,并查看它是否有效。
aws redshift create-cluster --cluster-identifier identifier --master-username username --master-user-password Password1 --node-type dc1.8xlarge --region us-west-2 --number-of-nodes 2
An error occurred (UnauthorizedOperation) when calling the CreateCluster operation: Access Denied. Please ensure that your IAM Permissions allow this operation.