2016-04-12 30 views
1

スポットリクエストを作成できるポリシーを作成する必要がありますが、特定のサブネットとセキュリティグループのみが必要です。これは私がやったことです:AWS EC2:ec2:RequestSpotInstancesのIAMポリシー

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Effect": "Allow", 
      "Action": "ec2:RequestSpotInstances", 
      "Resource": [ 
       "arn:aws:ec2:us-east-1:123456789012:image/ami-*", 
       "arn:aws:ec2:us-east-1:123456789012:subnet/subnet-af016c92", 
       "arn:aws:ec2:us-east-1:123456789012:subnet/subnet-12a34d3c", 
       "arn:aws:ec2:us-east-1:123456789012:subnet/subnet-f0e844cd", 
       "arn:aws:ec2:us-east-1:123456789012:subnet/subnet-026ae728", 
       "arn:aws:ec2:us-east-1:123456789012:key-pair/*", 
       "arn:aws:ec2:us-east-1:123456789012:security-group/sg-b5dd94cd", 
       "arn:aws:ec2:us-east-1:123456789012:security-group/sg-3bda8c42" 
      ] 
     } 
    ] 
} 

しかし、私のスポットリクエストの作成がまだ失敗:

botocore.exceptions.ClientError: An error occurred (UnauthorizedOperation) when calling the RequestSpotInstances operation: You are not authorized to perform this operation. 

RequestSpotInstancesアクションの権限の最小サブセットとは何ですか?

これをデバッグする可能性はありますか?

答えて

0

EC2の文書(here)によると、ec2:RequestSpotInstancesは、「サポートされていないリソースレベルの権限」カテゴリに該当するアクションです。残念ながら、あなたはこのように、すべてのリソースにリソースタグを設定する必要があります:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Effect": "Allow", 
      "Action": "ec2:RequestSpotInstances", 
      "Resource": [ "*" ] 
     } 
    ] 
} 

限りデバッグが行くように、> = AWSコンソールからアクセスできるIAMポリシーシミュレータ、忘れてはいけませんIAM =>ユーザーページ。

1

私はこれが古い問題だと知っていますが、私は自分の環境で同じ問題に遭遇しました。私の解決策は、 "PassRole"のIAM許可を追加することでした。

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
    { 
     "Sid": "Stmt1479335761363", 
     "Action": [ 
     "ec2:DescribeInstances", 
     "ec2:RequestSpotInstances", 
     "ec2:RunInstances", 
     "iam:PassRole" 
     ], 
     "Effect": "Allow", 
     "Resource": "*" 
    } 
} 
関連する問題