This topic describes how to use configuration items when you initialize Object Storage Service (OSS) SDK for Node.js.

The following table describes the configuration items (options).
Configuration item Type Description
accessKeyId String The AccessKey ID that is created in the Alibaba Cloud Management Console.
accessKeySecret] String The AccessKey secret that is created in the Alibaba Cloud Management Console.
stsToken String The temporary Security Token Service (STS) token used to access OSS. For more information, see Use STS to authorize temporary access.
bucket String The bucket that is created by using the OSS console or by calling the PutBucket operation.
endpoint String The endpoint of the OSS bucket.
region String The region where your bucket is located. Default value: oss-cn-hangzhou.
internal Boolean Specifies whether to use the Alibaba Cloud internal network to access OSS. Default value: false. For example, set this parameter to true if you use an Elastic Compute Service (ECS) instance to access OSS. The ECS instance accesses OSS by using an internal endpoint, which reduces costs.
cname Boolean Specifies whether CNAME can be used to access OSS. Default value: false. If you set this parameter to true, you must map a CNAME to your bucket before you use the CNAME to access the bucket.
isRequestPay Boolean Specifies whether the pay-by-requester mode is enabled for your bucket. Default value: false.
secure Boolean Specifies whether HTTPS is used to access OSS. A value of true indicates that HTTPS is used to access OSS. A value of false indicates that HTTP is used to access OSS. For more information, see FAQ.
timeout String|Number The timeout period. Default value: 60000. Unit: milliseconds.

The following code provides an example on how to configure parameters when you use OSS SDK for Node.js:

var oss = require('ali-oss');

var client = new oss({
 // Set yourRegion to the endpoint of the region where your bucket is located. For example, if your bucket is located in the China (Hangzhou) region, set yourRegion to oss-cn-hangzhou. 
  region: 'yourRegion',
  // Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to access OSS because the account has permissions on all API operations. We recommend that you use a Resource Access Management (RAM) user to call API operations or perform routine O&M. To create a RAM user, log on to the RAM console. 
  accessKeyId: 'yourAccessKeyId',
  accessKeySecret: 'yourAccessKeySecret',
  // Specify the bucket name. 
  bucket: 'examplebucket'
});