Attach a policy

Attach a managed or custom policy to an IAM user, a group or a role, or detach it again.

Last updated 18 November 2026View as Markdown

Replace user-id and policy-id with the ids of the user and the policy.

Prerequisites

  • To attach to a user, iam:AttachUserPolicy on the user; to a group, iam:AttachGroupPolicy; to a role, iam:AttachRolePolicy.
  • To detach, iam:DetachUserPolicy, iam:DetachGroupPolicy or iam:DetachRolePolicy.
  • In the console, also iam:GetUser, iam:GetGroup or iam:GetRole on the principal to open its page (without it the page is not found).
  • In the console, also iam:ListUsers, iam:ListGroups or iam:ListRoles to open Users, Groups or Roles (without it the list says you do not have permission to list them).

Attach the policy

  1. Open Identity, choose Users, then the user. (For a group or a role, open it under Groups or Roles instead.)
  2. Choose Permissions.
  3. Under Policies, pick the policy from the list. Managed policies are marked managed.
  4. Choose Attach.

To detach a policy, choose the remove control on its row and confirm with Detach policy.

A preset role that ships with Deutsche Cloud offers no attach or detach: its policies are fixed.

Result

The policy counts from the user's next request. Attaching the same policy twice changes nothing. On a group it reaches every member of the group; on a role, everyone assigned the role and every session of the role. Detaching takes the permissions away at once.

A user's Permissions tab lists what is attached to the user directly, and the groups and roles the user has. What comes through a group or a role is attached there.

If the attachment is refused

  • 404 IAM user not found, Policy not found, Group or policy not found, or Role or policy not found when the user, group, role or policy is not in your organization.
  • 403 when you lack the attach action for that kind of principal.
Did this page help you?