Update an existing IAM role in your Vultr organization. Modify the role name, description, or type configuration through the Vultr API or the Console.
Updating a role allows you to change its name, description, type, or session duration. This is useful when you need to adjust access levels or rebrand a role to reflect its current purpose. You can also convert an assignable role to an assumable role or vice versa by changing the role_type field.
This guide explains how to update a role using the Vultr Console and the Vultr API.
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 update.
Send a GET request to the Read Role endpoint to retrieve the current role details. Replace {role-id} with the id you retrieved in the previous step.
$ curl "https://api.vultr.com/v2/roles/{role-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Send a PUT request to the Update Role endpoint to update the role. Replace the values with your updated role details.
$ curl "https://api.vultr.com/v2/roles/{role-id}" \
-X PUT \
-H "Authorization: Bearer ${VULTR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "NEW-ROLE-NAME",
"description": "NEW-ROLE-DESCRIPTION",
"role_type": "assignable",
"max_session_duration": 7200
}'
Send a GET request to the Read Role endpoint to retrieve the updated details.
$ curl "https://api.vultr.com/v2/roles/{role-id}" \
-X GET \
-H "Authorization: Bearer ${VULTR_API_KEY}"
Verify that the role details reflect the new values.