Attach an IAM policy to a group on Vultr. Grant all members of the group the permissions defined in the policy document through the Vultr API or Console.
Attaching a policy to a group grants all members of the group the permissions defined in the policy's document. This simplifies access management by allowing you to control permissions at the group level rather than attaching policies to individual users.
This guide explains how to attach a policy to a group using the Vultr Console and the Vultr API.
Log in to the Vultr Console.
Click the organization name in the top navigation bar.
Click Manage Organization.
Click the Permission Policies tab.
Click the name of the policy you want to attach.
In the Attached Entities section, click the + button.
Search for and select the groups you want to attach to this policy.
Click Attach Entities.
The selected groups appear in the Attached Entities list and all group members inherit the policy's permissions.
Send a GET request to the List Policies endpoint to retrieve all policies in your organization.
$ curl "https://api.vultr.com/v2/policies" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Note the id of the policy you want to attach.
Send a GET request to the List Groups endpoint to retrieve all groups.
$ curl "https://api.vultr.com/v2/groups" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Note the id of the group to which you want to attach the policy.
Send a POST request to the Attach Policy to Group endpoint to attach the policy. Replace {policy-id} with the policy id and {group-id} with the group id.
$ curl "https://api.vultr.com/v2/policies/{policy-id}/groups/{group-id}" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}"
A successful request returns an HTTP 201 Created response.