You can create a dynamic Elastic Compute Service (ECS) secret and manually rotate the ECS secret to reduce the risk of ECS secret leaks. Secrets Manager can also automatically rotate the ECS secret on a regular basis. This topic describes how to create, rotate, delete, and restore a dynamic ECS secret in the Key Management Service (KMS) console.
Prerequisites
- An ECS instance is created. For more information, see Create an ECS instance.
- An Alibaba Cloud account or a RAM user or RAM role that has permissions to manage
dynamic ECS secrets is obtained.
If you use a RAM user or RAM role to manage secrets, you must attach the system policy AliyunKMSSecretAdminAccess to the RAM user or the RAM role. This policy grants the following permissions:
- The permissions to use the features of Secrets Manager.
- The permissions to query ECS instances.
- The permission to create the service-linked role that can create dynamic ECS secrets.
For more information, see Grant permissions to a RAM user and Grant permissions to a RAM role.
Create a dynamic ECS Secret
Rotate a dynamic ECS secret
If a dynamic ECS secret is leaked, you can immediately rotate the ECS secret in the KMS console to eliminate intrusion risks.
- Click the name of the ECS secret that you want to rotate. On the secret details page, click Rotate Immediately in the upper-right corner.
- In the Prompt dialog box, turn on or off Use Custom Secret.
- If you turn on the switch, you must specify a new secret value.
- If you turn off the switch, KMS automatically creates a 32-character random password or a RSA-2048 public-private key pair.
- Click Confirm rotation.
- In the Rotation triggered message, click Close.
Delete a dynamic ECS secret
Before you delete a dynamic ECS secret, make sure that the ECS secret is no longer used.
You can schedule the deletion of a dynamic ECS secret or immediately delete a dynamic ECS secret. If you delete a dynamic ECS secret, the passwords and public-private key pairs that are configured on the ECS instance are not affected.
- Find the dynamic ECS secret that you want to delete and choose Actions column. in the
- In the Delete Secret dialog box, select a method to delete the secret and click OK.
- If you select Plan Deletion Secret, you must configure the Delete In (7-30 days) parameter. Then, the system deletes the secret after the specified number of days.
Before the system deletes the secret, you can restore the secret to cancel deletion. For more information, see Restore a dynamic ECS secret.
- If you select Delete Secret Immediately, the system immediately deletes the secret.
- If you select Plan Deletion Secret, you must configure the Delete In (7-30 days) parameter. Then, the system deletes the secret after the specified number of days.
Restore a dynamic ECS secret
If you schedule a dynamic ApsaraDB RDS secret to be deleted, you can restore the secret to cancel deletion before the system deletes the secret. After the dynamic ECS secret is restored, it can be used as normal.
- Find the dynamic ECS secret that you want to restore and choose Actions column. in the
- In the Restore Secret message, click OK.