有没有办法限制 EC2 实例的 IAM 策略它只能运行一个简短的文档列表 - 我尝试像这样限制对 ssm:GetDocument 的访问:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetDocument"
],
"Resource": [
"arn:aws:ssm:ap-southeast-2:*:document/MyCommand"
]
}
]}
Run Code Online (Sandbox Code Playgroud)
但是我可以在实例上运行任何命令,仍然包括 AWS-RunPowershellScript 文档。
此链接显示了如何在 ssm:sendCommand 方面限制用户:http ://docs.aws.amazon.com/AWSEC2/latest/UserGuide/delegate-commands.html