Attach an IAM role to a group on Vultr. All members of the group inherit the permissions from the role's attached policies through the Vultr IAM system.
Attaching a role to a group grants all members of the group the permissions defined by the policies within that role. This simplifies access management by allowing you to control permissions at the group level.
This guide explains how to attach a role 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 Groups tab.
Click the name of the group to which you want to attach the role.
In the Roles section, click the + button.
Search and select the roles you want to attach.
Click Add Selected.
The selected roles appear in the Roles section and all group members inherit the associated permissions.
Send a GET request to the List Roles endpoint to retrieve all roles in your organization.
$ curl "https://api.vultr.com/v2/roles" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Note the id of the role 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 role.
Send a POST request to the Attach Role to Group endpoint to attach the role. Replace {role-id} with the role id and {group-id} with the group id.
$ curl "https://api.vultr.com/v2/roles/{role-id}/groups/{group-id}" \
-X POST \
-H "Authorization: Bearer ${VULTR_API_KEY}"
A successful request returns an HTTP 201 Created response.