The Serverless Framework needs access to account credentials for your Alibaba Cloud account so that it can create and manage resources on your behalf.
You need a Billing Account to use Alibaba Cloud Function Compute. See Create an Alibaba Cloud account and Add billing information on how to create a Billing Account. For some regions in mainland China (including the plugin's default region of Shanghai) you will also have to go through Real Name Verification. To avoid this, use a region outside of Mainland China such as
ap-southeast-1 by setting the
region option in the
provider section of your
You need to enable the following services so that Serverless can create the corresponding resources.
You need to create credentials Serverless can use to create resources in your Project.
- Create a RAM user and an AccessKey. See Alibaba Cloud's documentation on how to create one. Be sure to save the AccessKey information (Click the dropdown "Access Key Details") in the dialog displaying "Access key successfully created.".
- Attach necessary authorization policies to the RAM user. See Alibaba Cloud's documentation for details. For Serverless to work, following policies are needed:
- Go to the Security Settings page to get the Account ID of your Alibaba Cloud account.
- Create a file containing the credentials that you have collected.
[default] aliyun_access_key_secret = <collected in step 1> aliyun_access_key_id = <collected in step 1> aliyun_account_id = <collected in step 3>
- Save the credentials file somewhere secure. We recommend making a folder in your root folder and putting it there, like
~/.aliyuncli/credentials. Remember the path you saved it to.
Open up your
serverless.yml file and update the
provider section with
the path to your credentials file (this path needs to be absolute!). It should look something like this:
provider: name: aliyun runtime: nodejs8 credentials: ~/.aliyuncli/credentials