的身分和存取管理 WorkSpaces - Amazon WorkSpaces

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

的身分和存取管理 WorkSpaces

根據預設,IAM使用者沒有 WorkSpaces 資源和操作的許可。若要允許使用者IAM管理 WorkSpaces 資源,您必須建立明確授予許可IAM的政策,並將政策連接到需要這些許可IAM的使用者或群組。

注意

Amazon WorkSpaces 不支援將IAM登入資料佈建至 WorkSpace (例如使用執行個體設定檔)。

若要提供存取權,請新增權限至您的使用者、群組或角色:

以下是 的其他資源IAM:

政策範例

下列範例顯示政策陳述式,您可以用來控制IAM使用者對 Amazon 的許可 WorkSpaces。

下列政策陳述式授予IAM使用者執行 WorkSpaces個人和集區任務的許可。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ds:*", "workspaces:*", "application-autoscaling:DeleteScalingPolicy", "application-autoscaling:DeleteScheduledAction", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingActivities", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DescribeScheduledActions", "application-autoscaling:PutScalingPolicy", "application-autoscaling:PutScheduledAction", "application-autoscaling:RegisterScalableTarget", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:PutMetricAlarm", "ec2:AssociateRouteTable", "ec2:AttachInternetGateway", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateInternetGateway", "ec2:CreateNetworkInterface", "ec2:CreateRoute", "ec2:CreateRouteTable", "ec2:CreateSecurityGroup", "ec2:CreateSubnet", "ec2:CreateTags", "ec2:CreateVpc", "ec2:DeleteNetworkInterface", "ec2:DeleteSecurityGroup", "ec2:DescribeAvailabilityZones", "ec2:DescribeInternetGateways", "ec2:DescribeNetworkInterfaces", "ec2:DescribeRouteTables", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "iam:AttachRolePolicy", "iam:CreatePolicy", "iam:CreateRole", "iam:GetRole", "iam:ListRoles", "iam:PutRolePolicy", "kms:ListAliases", "kms:ListKeys", "secretsmanager:ListSecrets", "tag:GetResources", "workdocs:AddUserToGroup", "workdocs:DeregisterDirectory", "workdocs:RegisterDirectory", "sso-directory:SearchUsers", "sso:CreateApplication", "sso:DeleteApplication", "sso:DescribeApplication", "sso:DescribeInstance", "sso:GetApplicationGrant", "sso:ListInstances", "sso:PutApplicationAssignment", "sso:PutApplicationAssignmentConfiguration", "sso:PutApplicationAuthenticationMethod", "sso:PutApplicationGrant" ], "Resource": "*" }, { "Sid": "iamPassRole", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "*", "Condition": { "StringEquals": { "iam:PassedToService": "workspaces.amazonaws.com" } } } ] }

下列政策陳述式授予IAM使用者執行所有 WorkSpaces 個人任務的許可。

雖然 Amazon 在使用 Action和 命令列工具時 WorkSpaces 完全支援 API和 Resource元素,但若要 WorkSpaces 從 使用 Amazon AWS Management Console,IAM使用者必須具有下列動作和資源的許可:

  • 動作:workspaces:*""ds:*"

  • 資源:"Resource": "*"

下列範例政策說明如何允許使用者 WorkSpaces 從 IAM使用 Amazon AWS Management Console。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "workspaces:*", "ds:*", "iam:GetRole", "iam:CreateRole", "iam:PutRolePolicy", "iam:CreatePolicy", "iam:AttachRolePolicy", "iam:ListRoles", "kms:ListAliases", "kms:ListKeys", "ec2:CreateVpc", "ec2:CreateSubnet", "ec2:CreateNetworkInterface", "ec2:CreateInternetGateway", "ec2:CreateRouteTable", "ec2:CreateRoute", "ec2:CreateTags", "ec2:CreateSecurityGroup", "ec2:DescribeInternetGateways", "ec2:DescribeSecurityGroups", "ec2:DescribeRouteTables", "ec2:DescribeVpcs", "ec2:DescribeSubnets", "ec2:DescribeNetworkInterfaces", "ec2:DescribeAvailabilityZones", "ec2:AttachInternetGateway", "ec2:AssociateRouteTable", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:DeleteSecurityGroup", "ec2:DeleteNetworkInterface", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "workdocs:RegisterDirectory", "workdocs:DeregisterDirectory", "workdocs:AddUserToGroup", "secretsmanager:ListSecrets", "sso-directory:SearchUsers", "sso:CreateApplication", "sso:DeleteApplication", "sso:DescribeApplication", "sso:DescribeInstance", "sso:GetApplicationGrant", "sso:ListInstances", "sso:PutApplicationAssignment", "sso:PutApplicationAssignmentConfiguration", "sso:PutApplicationAuthenticationMethod", "sso:PutApplicationGrant" ], "Resource": "*" }, { "Sid": "iamPassRole", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "*", "Condition": { "StringEquals": { "iam:PassedToService": "workspaces.amazonaws.com" } } } ] }

下列政策陳述式授予IAM使用者執行所有 WorkSpaces 集區任務的許可。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "VisualEditor0", "Effect": "Allow", "Action": [ "workspaces:*", "application-autoscaling:DeleteScalingPolicy", "application-autoscaling:DeleteScheduledAction", "application-autoscaling:DeregisterScalableTarget", "application-autoscaling:DescribeScalableTargets", "application-autoscaling:DescribeScalingActivities", "application-autoscaling:DescribeScalingPolicies", "application-autoscaling:DescribeScheduledActions", "application-autoscaling:PutScalingPolicy", "application-autoscaling:PutScheduledAction", "application-autoscaling:RegisterScalableTarget", "cloudwatch:DeleteAlarms", "cloudwatch:DescribeAlarms", "cloudwatch:PutMetricAlarm", "ec2:CreateSecurityGroup", "ec2:CreateTags", "ec2:DescribeInternetGateways", "ec2:DescribeRouteTables", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "iam:AttachRolePolicy", "iam:CreatePolicy", "iam:CreateRole", "iam:GetRole", "iam:ListRoles", "iam:PutRolePolicy", "secretsmanager:ListSecrets", "tag:GetResources" ], "Resource": "*" }, { "Sid": "iamPassRole", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "*", "Condition": { "StringEquals": { "iam:PassedToService": "workspaces.amazonaws.com" } } } { "Action": "iam:CreateServiceLinkedRole", "Effect": "Allow", "Resource": "arn:aws:iam::*:role/aws-service-role/workspaces.application-autoscaling.amazonaws.com/AWSServiceRoleForApplicationAutoScaling_WorkSpacesPool", "Condition": { "StringLike": { "iam:AWSServiceName": "workspaces.application-autoscaling.amazonaws.com" } } } ] }

下列政策陳述式授予IAM使用者執行所有 WorkSpaces任務的許可,包括建立自帶授權 (BYOL) 所需的 Amazon EC2任務 WorkSpaces。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ds:*", "workspaces:*", "ec2:AssociateRouteTable", "ec2:AttachInternetGateway", "ec2:AuthorizeSecurityGroupEgress", "ec2:AuthorizeSecurityGroupIngress", "ec2:CreateInternetGateway", "ec2:CreateNetworkInterface", "ec2:CreateRoute", "ec2:CreateRouteTable", "ec2:CreateSecurityGroup", "ec2:CreateSubnet", "ec2:CreateTags", "ec2:CreateVpc", "ec2:DeleteNetworkInterface", "ec2:DeleteSecurityGroup", "ec2:DescribeAvailabilityZones", "ec2:DescribeImages", "ec2:DescribeInternetGateways", "ec2:DescribeNetworkInterfaces", "ec2:DescribeRouteTables", "ec2:DescribeSecurityGroups", "ec2:DescribeSubnets", "ec2:DescribeVpcs", "ec2:ModifyImageAttribute", "ec2:RevokeSecurityGroupEgress", "ec2:RevokeSecurityGroupIngress", "iam:CreateRole", "iam:GetRole", "iam:PutRolePolicy", "kms:ListAliases", "kms:ListKeys", "workdocs:AddUserToGroup", "workdocs:DeregisterDirectory", "workdocs:RegisterDirectory" ], "Resource": "*" }, { "Sid": "iamPassRole", "Effect": "Allow", "Action": "iam:PassRole", "Resource": "*", "Condition": { "StringEquals": { "iam:PassedToService": "workspaces.amazonaws.com" } } } ] }

在IAM政策中指定 WorkSpaces 資源

若要在政策陳述式的 Resource元素中指定 WorkSpaces 資源,請使用 資源的 Amazon Resource Name (ARN)。您可以允許或拒絕許可,以使用IAM政策陳述式 Action元素中指定的API動作,來控制對 WorkSpaces 資源的存取。 WorkSpaces 定義 ARNs WorkSpaces、 套件、IP 群組和目錄。

WorkSpace ARN 具有下列範例中顯示的語法。

arn:aws:workspaces:region:account_id:workspace/workspace_identifier
region

WorkSpace 所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

workspace_identifier

WorkSpace (例如,) 的 IDws-a1bcd2efg

以下是識別特定 之政策陳述式的 Resource元素格式 WorkSpace。

"Resource": "arn:aws:workspaces:region:account_id:workspace/workspace_identifier"

您可以使用*萬用字元來指定屬於特定區域中特定帳戶的所有 WorkSpaces 。

WorkSpace 集區ARN具有下列範例中顯示的語法。

arn:aws:workspaces:region:account_id:workspacespool/workspacespool_identifier
region

WorkSpace 所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

workspacespool_identifier

WorkSpace 集區的 ID (例如 ws-a1bcd2efg)。

以下是識別特定 之政策陳述式的 Resource元素格式 WorkSpace。

"Resource": "arn:aws:workspaces:region:account_id:workspacespool/workspacespool_identifier"

您可以使用*萬用字元來指定屬於特定區域中特定帳戶的所有 WorkSpaces 。

WorkSpace 影像ARN具有下列範例中顯示的語法。

arn:aws:workspaces:region:account_id:workspaceimage/image_identifier
region

WorkSpace 映像所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

bundle_identifier

WorkSpace 映像的 ID (例如,wsi-a1bcd2efg)。

以下是識別特定映象之政策陳述式 Resource 元素的格式。

"Resource": "arn:aws:workspaces:region:account_id:workspaceimage/image_identifier"

您可使用 * 萬用字元來指定屬於特定區域中特定帳戶的所有映像。

套件ARN的語法如下列範例所示。

arn:aws:workspaces:region:account_id:workspacebundle/bundle_identifier
region

WorkSpace 所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

bundle_identifier

WorkSpace 套件的 ID (例如 wsb-a1bcd2efg)。

以下是識別特定套件之政策陳述式 Resource 元素的格式。

"Resource": "arn:aws:workspaces:region:account_id:workspacebundle/bundle_identifier"

您可使用 * 萬用字元來指定屬於特定區域中特定帳戶的所有套件。

IP 群組ARN的語法如下列範例所示。

arn:aws:workspaces:region:account_id:workspaceipgroup/ipgroup_identifier
region

WorkSpace 所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

ipgroup_identifier

IP 群組的 ID (例如 wsipg-a1bcd2efg)。

以下是識別特定 IP 群組之政策陳述式 Resource 元素的格式。

"Resource": "arn:aws:workspaces:region:account_id:workspaceipgroup/ipgroup_identifier"

您可使用 * 萬用字元來指定屬於特定區域中特定帳戶的所有 IP 群組。

目錄ARN具有下列範例中顯示的語法。

arn:aws:workspaces:region:account_id:directory/directory_identifier
region

WorkSpace 所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

directory_identifier

目錄的 ID (例如 d-12345a67b8)。

以下是識別特定目錄之政策陳述式 Resource 元素的格式。

"Resource": "arn:aws:workspaces:region:account_id:directory/directory_identifier"

您可使用 * 萬用字元來指定屬於特定區域中特定帳戶的所有目錄。

連線別名ARN具有下列範例中顯示的語法。

arn:aws:workspaces:region:account_id:connectionalias/connectionalias_identifier
region

連線別名所在的區域 (例如 us-east-1)。

account_id

AWS 帳戶 ID,不含連字號 (例如 123456789012)。

connectionalias_identifier

連線別名的 ID (例如 wsca-12345a67b8)。

以下是識別特定連線別名之政策陳述式 Resource 元素的格式。

"Resource": "arn:aws:workspaces:region:account_id:connectionalias/connectionalias_identifier"

您可使用 * 萬用字元來指定屬於特定區域中特定帳戶的所有連線別名。

您無法ARN指定具有下列API動作的資源:

  • AssociateIpGroups

  • CreateIpGroup

  • CreateTags

  • DeleteTags

  • DeleteWorkspaceImage

  • DescribeAccount

  • DescribeAccountModifications

  • DescribeIpGroups

  • DescribeTags

  • DescribeWorkspaceDirectories

  • DescribeWorkspaceImages

  • DescribeWorkspaces

  • DescribeWorkspacesConnectionStatus

  • DisassociateIpGroups

  • ImportWorkspaceImage

  • ListAvailableManagementCidrRanges

  • ModifyAccount

對於不支援資源層級許可API的動作,您必須指定下列範例中顯示的資源陳述式。

"Resource": "*"

對於下列API動作,您無法在資源中指定帳戶 ID,ARN當該資源不是帳戶所擁有:

  • AssociateConnectionAlias

  • CopyWorkspaceImage

  • DisassociateConnectionAlias

對於這些API動作,您只能在資源中指定帳戶 ID,ARN前提是該帳戶擁有要採取動作的資源。當帳戶並未擁有資源時,您必須針對帳戶 ID 指定 *,如以下範例所示。

"arn:aws:workspaces:region:*:resource_type/resource_identifier"

建立 workspaces_DefaultRole Role

您必須先驗證名為 的角色workspaces_DefaultRole是否存在API,才能使用 註冊目錄。此角色是由 Quick Setup 建立,或者如果您 WorkSpace 使用 啟動 AWS Management Console,則會授予 Amazon 代表您存取特定 AWS 資源的 WorkSpaces 許可。如果此角色不存在,您可以使用下列程序加以建立。

建立 workspaces_DefaultRole role
  1. 登入 AWS Management Console 並在 開啟IAM主控台https://console.aws.amazon.com/iam/

  2. 在左側導覽窗格中,選擇 Roles (角色)。

  3. 選擇建立角色

  4. Select type of trusted entity (選取信任的實體類型) 下,選擇 Another AWS account (另一個 帳戶)。

  5. 針對帳戶 ID,輸入不含連字號或空格的帳戶 ID。

  6. 針對選項,請勿指定多重要素驗證 (MFA)。

  7. 選擇下一步:許可

  8. 連接許可政策頁面上,選取 AWS 受管政策 AmazonWorkSpacesServiceAccessAmazonWorkSpacesSelfServiceAccessAmazonWorkSpacesPoolServiceAccess。如需這些受管政策的詳細資訊,請參閱 AWS 的 受管政策 WorkSpaces

  9. 設定許可界限之下,建議您不要使用許可界限,因為附加至此角色的政策可能發生衝突。這類衝突可能會封鎖角色的某些必要許可。

  10. 選擇下一步:標籤

  11. 新增標籤 (選用) 頁面上,視需要新增標籤。

  12. 選擇 Next:Review (下一步:檢閱)

  13. Review (檢閱) 頁面,針對 Role name (角色名稱) 輸入 workspaces_DefaultRole

  14. (選用) 針對 Role description (角色描述),輸入描述。

  15. 選擇建立角色

  16. 在 workspaces_DefaultRole role 的摘要頁面上,選擇信任關係索引標籤。

  17. Trust relationships (信任關係) 標籤上,選擇 Edit trust relationship (編輯信任關係)

  18. 編輯信任關係頁面上,以下列陳述式取代現有的政策陳述式。

    { "Statement": [ { "Effect": "Allow", "Principal": { "Service": "workspaces.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
  19. 選擇 Update Trust Policy (更新信任政策)。

建立 AmazonWorkSpacesPCAAccess 服務角色

您必須先確認名為 AmazonWorkSpacesPCAAccess 的角色是否存在,使用者才能使用憑證型驗證進行登入。當您使用 在目錄上啟用憑證型身分驗證時,會建立此角色 AWS Management Console,並授予 Amazon WorkSpaces 代表您存取 AWS Private CA 資源的許可。如果因為您未使用主控台來管理憑證型驗證而不存在此角色,您可以使用下列程序加以建立。

使用 建立 AmazonWorkSpacesPCAAccess服務角色 AWS CLI
  1. AmazonWorkSpacesPCAAccess.json 使用下列文字建立名為 JSON的檔案。

    { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "prod.euc.ecm.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }
  2. 視需要調整AmazonWorkSpacesPCAAccess.json路徑,並執行下列 AWS CLI 命令來建立服務角色並連接AmazonWorkspacesPCAAccess受管政策。

    aws iam create-role --path /service-role/ --role-name AmazonWorkSpacesPCAAccess --assume-role-policy-document file://AmazonWorkSpacesPCAAccess.json
    aws iam attach-role-policy —role-name AmazonWorkSpacesPCAAccess —policy-arn arn:aws:iam::aws:policy/AmazonWorkspacesPCAAccess