我正在尝试设置 EC2 角色以允许实例使用 New-SSMAssociation powershell cmdlet 加入域。有谁知道完成此操作所需的最低权限是什么?
我在这里阅读了这篇文章https://aws.amazon.com/premiumsupport/knowledge-center/ec2-systems-manager-dx-domain/但 AmazonEC2RoleforSSM 已被弃用,取而代之的是 AmazonSSMManagedInstanceCore 策略但是在使用该策略时结合 AmazonSSMDirectoryServiceAccess 策略,我收到一个错误:New-SSMAssociation:用户:arn:aws:sts:::assumed-role/MyEC2Role/ 无权执行:ssm:CreateAssociation on resource:arn:aws:ec2:us -east-1::instance/
我能够让它工作的唯一方法是使用ssm:*
,但如果可能的话,我不希望这样做。我使用的组合策略是(不带ssm:*
):
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ec2:DescribeInstanceStatus"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ssm:CreateAssociation"
],
"Resource": "arn:aws:ssm:<region>:<account-id>:document/JoinDomain"
},
{
"Effect": "Allow",
"Action": [
"ds:CreateComputer",
"ds:DescribeDirectories"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ssm:DescribeAssociation",
"ssm:GetDeployablePatchSnapshotForInstance",
"ssm:GetDocument",
"ssm:DescribeDocument",
"ssm:GetManifest",
"ssm:GetParameters",
"ssm:ListAssociations",
"ssm:ListInstanceAssociations",
"ssm:PutInventory",
"ssm:PutComplianceItems",
"ssm:PutConfigurePackageResult",
"ssm:UpdateAssociationStatus",
"ssm:UpdateInstanceAssociationStatus",
"ssm:UpdateInstanceInformation"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"ec2messages:AcknowledgeMessage",
"ec2messages:DeleteMessage",
"ec2messages:FailMessage",
"ec2messages:GetEndpoint",
"ec2messages:GetMessages",
"ec2messages:SendReply"
],
"Resource": "*"
}
]
}