Serverless Framework Docs

#Alibaba Cloud - Credentials

The Serverless Framework needs access to account credentials for your Alibaba Cloud account so that it can create and manage resources on your behalf.

#Create an Alibaba Cloud Account

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 serverless.yml.

#Enable Services

You need to enable the following services so that Serverless can create the corresponding resources.

#Get the Credentials

You need to create credentials Serverless can use to create resources in your Project.

  1. 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.".
  2. Attach necessary authorization policies to the RAM user. See Alibaba Cloud's documentation for details. For Serverless to work, following policies are needed:
  • AliyunOSSFullAccess
  • AliyunRAMFullAccess
  • AliyunLogFullAccess
  • AliyunApiGatewayFullAccess
  • AliyunFCFullAccess
  1. Go to the Security Settings page to get the Account ID of your Alibaba Cloud account.
  2. 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>
  1. 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.

#Update the provider config in serverless.yml

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

Have questions?

Head over to the forums to search for your questions and issues or post a new one.