--- layout: docs page_title: AliCloud - Secrets Engines description: >- The AliCloud secrets engine for Vault generates access tokens or STS credentials dynamically based on RAM policies or roles. --- # AliCloud Secrets Engine The AliCloud secrets engine dynamically generates AliCloud access tokens based on RAM policies, or AliCloud STS credentials based on RAM roles. This generally makes working with AliCloud easier, since it does not involve clicking in the web UI. The AliCloud access tokens are time-based and are automatically revoked when the Vault lease expires. STS credentials are short-lived, non-renewable, and expire on their own. ## Setup Most secrets engines must be configured in advance before they can perform their functions. These steps are usually completed by an operator or configuration management tool. 1. Enable the AliCloud secrets engine: ```text $ vault secrets enable alicloud Success! Enabled the alicloud secrets engine at: alicloud/ ``` By default, the secrets engine will mount at the name of the engine. To enable the secrets engine at a different path, use the `-path` argument. 1. [Create a custom policy](https://www.alibabacloud.com/help/doc-detail/28640.htm) in AliCloud that will be used for the access key you will give Vault. See "Example RAM Policy for Vault". 1. [Create a user](https://www.alibabacloud.com/help/faq-detail/28637.htm) in AliCloud with a name like "hashicorp-vault", and directly apply the new custom policy to that user in the "User Authorization Policies" section. 1. Create an access key for that user in AliCloud, which is an action available in AliCloud's UI on the user's page. 1. Configure that access key as the credentials that Vault will use to communicate with AliCloud to generate credentials: ```text $ vault write alicloud/config \ access_key=0wNEpMMlzy7szvai \ secret_key=PupkTg8jdmau1cXxYacgE736PJj4cA ``` Alternatively, the AliCloud secrets engine can pick up credentials set as environment variables, or credentials available through instance metadata. Since it checks current credentials on every API call, changes in credentials will be picked up almost immediately without a Vault restart. If available, we recommend using instance metadata for these credentials as they are the most secure option. To do so, simply ensure that the instance upon which Vault is running has sufficient privileges, and do not add any config. 1. Configure a role describing how credentials will be granted. To generate access tokens using only policies that have already been created in AliCloud: ```text $ vault write alicloud/role/policy-based \ remote_policies='name:AliyunOSSReadOnlyAccess,type:System' \ remote_policies='name:AliyunRDSReadOnlyAccess,type:System' ``` To generate access tokens using only policies that will be dynamically created in AliCloud by Vault: ```text $ vault write alicloud/role/policy-based \ inline_policies=-<