You must configure Serverless Devs before you use it. This topic describes how to run s config commands to add, query, and remove keys used by Serverless Devs. In the following examples, Alibaba Cloud AccessKey pairs are used.
Before you start
Add a key
Run the following command to query the cloud service providers that can be selected:
s config add
Sample command output:
> Alibaba Cloud (alibaba) AWS (aws) Azure (azure) Baidu Cloud (baidu) Google Cloud (google) Huawei Cloud (huawei) Tencent Cloud (tencent) (Move up and down to reveal more choices)
Select a cloud service provider and press the Enter key. In this example,
Alibaba Cloud (alibaba)
is selected.Set the parameters for the key that you want to add by following the on-screen instructions.
Please select a provider: Alibaba Cloud (alibaba) Refer to the document for alibaba key: http://config.devsapp.net/account/alibaba AccountID 188077086902**** AccessKeyID LTAI4G4cwJkK4Rza6xd9**** AccessKeySecret eCc0GxSpzfq1DVspnqqd6nmYNN**** Please create alias for key pair. If not, please enter to skip default Alias: default AccountID: 188077086902**** AccessKeyID: LTAI4G4cwJkK4Rza6xd9**** AccessKeySecret: eCc0GxSpzfq1DVspnqqd6nmYNN**** Configuration successful
ImportantServerless Devs allows you to manage multiple keys. When you add a key, you can specify the feature of the key by setting the aliasName parameter. Scenarios:
You want to isolate environments. In this case, you can set different aliases for the keys of different accounts and deploy resources by account. For example, you can use Account A in the production environment and Account B in the staging environment.
You want to manage permissions by key. In this case, you can grant different permissions to different keys. Examples:
Set the website-access alias for a key that is used for website deployment.
Set the fc-access alias for a key that is used for function deployment.
Query keys
Parameters:
-a or --access: the alias of the key that you want to remove.
-h or --help: returns help information.
Run the following commands to query the information about keys:
Query the information about a key that has a specific alias. For example, set the -a parameter to default.
s config get -a default
Sample command output:
default: AccountID: 188077086902**** AccessKeyID: LTAI4FoAC3JPPWKPZDVg**** AccessKeySecret: gwL7FuveTjmHC7xyvvwOxP6ysI****
Query the information about all keys.
s config get
Sample command output:
default: AccountID: 188077086902**** AccessKeyID: LTAI4G4cwJkK4Rza6xd9**** AccessKeySecret: eCc0GxSpzfq1DVspnqqd6nmYNN**** default-1: AccountID: 188077086902**** AccessKeyID: LTAI4FoAC3JPPWKPZDVg**** AccessKeySecret: gwL7FuveTjmHC7xyvvwOxP6ysI****
You can run the s config get -h
command to query the detailed information about the command.
Remove a key
Parameters:
-a or --access: the alias of the key that you want to remove.
-h or --help: returns help information.
Run the following command to remove a key that is specified by the -a parameter:
s config delete -a aliasName