Periodic Rotation of Access Keys
Scenario
Enterprise users usually use access keys (AK/SKs) to access cloud resources through APIs. They are advised to make access keys automatically rotate to reduce potential security risks.
This section guides you through rotating access keys by calling APIs. You can also automate rotation of access keys using programmatic methods.
General Procedure
The following steps are involved to periodically rotate your access keys:
- Create an access key.
- Query the time when all of your access keys are created, and determine whether they need to be rotated.
- Create an access key.
- Delete the old access key.
The following APIs will be used in this example:
Step 1: Create a Permanent Access Key
URI: POST /v5/users/{user_id}/access-keys
For details about the API, see Creating a Permanent Access Key.
- Example Request
POST https://{endpoint}/v5/users/07609fb9358010e21f7bc003751.../access-keys
- Example Response
{ "access_key" : { "user_id" : "07609fb9358010e21f7bc003751...", "access_key_id" : "P83EVBZJMXCYTMUII...", "created_at" : "2023-09-13T06:51:20.550Z", "secret_access_key" : "TTqAHPbhWorg9ozx8Dv9MUyzYnOKDppxzHt...", "status" : "active" } }
Step 2: Query the Creation Time of All Access Keys
URI: GET /v5/users/{user_id}/access-keys
For details about the API, see Querying Permanent Access Keys.
- Example Request
GET https://{endpoint}/v5/users/07609fb9358010e21f7bc003751.../access-keys
- Example Response
{ "access_keys" : [ { "user_id" : "07609fb9358010e21f7bc003751...", "access_key_id" : "P83EVBZJMXCYTMUII...", "created_at" : "2023-09-13T06:51:20.550Z", "status" : "active" } ], "page_info" : { "current_count" : 1 } }
Step 3: Create a New Access Key
Step 4: Delete the Old Access Key
URI: DELETE /v5/users/{user_id}/access-keys/{access_key_id}
For details about the API, see Deleting a Permanent Access Key.
- Example Request
DELETE https://{endpoint}/v5/users/07609fb9358010e21f7bc003751.../access-keys/P83EVBZJMXCYTMUII...
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot