3
インスタンスの停止および開始のみ許可するAWS IAMポリシーが作成されましたが、特定のインスタンスのARNリソースを指定しても機能しません。EC2のインスタンスレベルのAWS IAMカスタマイズポリシーは機能しません。
サンプルポリシー:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:Describe*",
"ec2:StopInstances",
"ec2:RunInstances",
"ec2:StartInstances"
],
"Effect": "Allow",
"Resource": "*"
This works
"Resource": "arn:aws:ec2:<region>:<account id>:instance/<instance id>"
"Resource": "arn:aws:ec2:<region>:<account id>:instance/*"
"Resource": "arn:aws:ec2:<region>::instance/*"
"Resource": "arn:aws:ec2:::instance/*"
"Resource": "arn:aws:ec2:::*"
を次のようにデフォルトのEC2読み取り専用権限がEC2インスタンスを記述するためにユーザーに与えられ、その上にされていますが、カスタマイズサンプルポリシーを追加しましたThese doesn’t work
}
]
}
1月23日に編集されました。 e done)
目的:単一のEC2インスタンスに対するインスタンスアクセス許可をユーザーに対して開始および停止します。
テスト済みの異なるコンボポリシーそれらのどれも"Resource": "*"
除いて働いた:次のようにインスタンスを作成し ADMIN_USER(フルアクセス)
:
地域でログイン
:オレゴン
アベイラビリティゾーン:米国西部-2C
インスタンスID: I-xxx3dxxx32xxxxxxe
所有者: testec2_user
:ユーザーを作成し xxx23xxx11
ユーザー:
- EC2読み取り専用(使用可能なポリシー)を以下のよう
のみ許可停止し、I-xxx38xxx32xx45インスタンスを起動するポリシーをカスタマイズ:
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "ec2:Describe*", "ec2:RunInstances" ], "Effect": "Allow", "Resource": "*" }, { "Action": [ "ec2:StopInstances", "ec2:StartInstances" ], "Effect": "Allow", "Resource": "arn:aws:ec2:us-west-2c:xxx23xxx11:instance/i-xxx3dxxx32xxxxxxe" } ] }
がtestec2_user
としてログインと試み停止したインスタンスを起動し、次のエラーが発生しました:
You are not authorized to perform this operation. Encoded authorization failure message
AWSのsts decode authorization message
を使用して受信したメッセージのデコード計画があります。