{"id":15046228,"url":"https://github.com/willin/waliyun","last_synced_at":"2025-10-26T13:31:06.770Z","repository":{"id":143927443,"uuid":"56594836","full_name":"willin/waliyun","owner":"willin","description":"阿里云Node.js Open API SDK（完整版）","archived":false,"fork":false,"pushed_at":"2018-05-15T10:04:02.000Z","size":48,"stargazers_count":39,"open_issues_count":0,"forks_count":12,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-14T04:55:42.797Z","etag":null,"topics":["aliyun","api","cdn","ecs","es6","openapi","oss","proxy","rds","sdk","slb"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/waliyun","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"willin","custom":"https://afdian.net/@willin"}},"created_at":"2016-04-19T12:29:49.000Z","updated_at":"2023-11-06T07:32:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"99841215-fca8-4f22-affc-6906f4444b87","html_url":"https://github.com/willin/waliyun","commit_stats":{"total_commits":55,"total_committers":4,"mean_commits":13.75,"dds":0.07272727272727275,"last_synced_commit":"408efa12d4c612d3c33ed13465971601cfc0f2ab"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fwaliyun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fwaliyun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fwaliyun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willin%2Fwaliyun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willin","download_url":"https://codeload.github.com/willin/waliyun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868860,"owners_count":16555600,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","api","cdn","ecs","es6","openapi","oss","proxy","rds","sdk","slb"],"created_at":"2024-09-24T20:52:53.029Z","updated_at":"2025-10-26T13:31:01.496Z","avatar_url":"https://github.com/willin.png","language":"JavaScript","funding_links":["https://github.com/sponsors/willin","https://afdian.net/@willin"],"categories":[],"sub_categories":[],"readme":"# WAliyun\n\n比官方SDK更好用的阿里云SDK。\n\n[![npm](https://img.shields.io/npm/v/waliyun.svg?style=plastic)](https://npmjs.org/package/waliyun) [![npm](https://img.shields.io/npm/dm/waliyun.svg?style=plastic)](https://npmjs.org/package/waliyun)\n[![npm](https://img.shields.io/npm/dt/waliyun.svg?style=plastic)](https://npmjs.org/package/waliyun)\n\nMinimum, Flexible, Scalable.\n\n支持Lazy Require。\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*\n\n- [安装和使用](#%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8)\n  - [查看接口对应版本](#%E6%9F%A5%E7%9C%8B%E6%8E%A5%E5%8F%A3%E5%AF%B9%E5%BA%94%E7%89%88%E6%9C%AC)\n- [已支持的接口](#%E5%B7%B2%E6%94%AF%E6%8C%81%E7%9A%84%E6%8E%A5%E5%8F%A3)\n  - [CDN](#cdn)\n  - [移动推送 CLOUDPUSH](#%E7%A7%BB%E5%8A%A8%E6%8E%A8%E9%80%81-cloudpush)\n  - [邮件推送 DM](#%E9%82%AE%E4%BB%B6%E6%8E%A8%E9%80%81-dm)\n  - [短信服务 SMS](#%E7%9F%AD%E4%BF%A1%E6%9C%8D%E5%8A%A1-sms)\n  - [新短信服务 DYSMS](#%E6%96%B0%E7%9F%AD%E4%BF%A1%E6%9C%8D%E5%8A%A1-dysms)\n  - [分布式关系型数据库 DRDS](#%E5%88%86%E5%B8%83%E5%BC%8F%E5%85%B3%E7%B3%BB%E5%9E%8B%E6%95%B0%E6%8D%AE%E5%BA%93-drds)\n  - [云服务器 ECS](#%E4%BA%91%E6%9C%8D%E5%8A%A1%E5%99%A8-ecs)\n  - [语音服务 DYVMS](#%E8%AF%AD%E9%9F%B3%E6%9C%8D%E5%8A%A1-dyvms)\n  - [弹性伸缩 ESS](#%E5%BC%B9%E6%80%A7%E4%BC%B8%E7%BC%A9-ess)\n  - [ALIDNS](#alidns)\n  - [HTTPDNS](#httpdns)\n  - [阿里云物联网套件 IOT](#%E9%98%BF%E9%87%8C%E4%BA%91%E7%89%A9%E8%81%94%E7%BD%91%E5%A5%97%E4%BB%B6-iot)\n  - [云监控 METRICS](#%E4%BA%91%E7%9B%91%E6%8E%A7-metrics)\n  - [媒体转码 MTS](#%E5%AA%92%E4%BD%93%E8%BD%AC%E7%A0%81-mts)\n  - [访问控制 RAM](#%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6-ram)\n  - [云数据库 RDS](#%E4%BA%91%E6%95%B0%E6%8D%AE%E5%BA%93-rds)\n  - [负载均衡 SLB](#%E8%B4%9F%E8%BD%BD%E5%9D%87%E8%A1%A1-slb)\n  - [访问控制 STS](#%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6-sts)\n  - [容器服务 CS](#%E5%AE%B9%E5%99%A8%E6%9C%8D%E5%8A%A1-cs)\n- [CHANGELOG](#changelog)\n  - [v2.0.0](#v200)\n  - [v1.0.0](#v100)\n- [License](#license)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n\n## 安装和使用\n\n国际惯例：\n\n```\nnpm install waliyun --save\n```\n\n公共参数：\n\n```js\nvar options = {\n  AccessKeyId: 'xxxx-xxxx-xxxx-xxxx',\n  AccessKeySecret: 'xxxx-xxxx-xxxx-xxxx',\n  // 选填，不同接口类型注意版本日期，2.0.0之后版本会带上默认版本，但可能会落后于最新，需要注意\n  Version: '2014-05-26',\n  // 选填\n  SignatureMethod: 'HMAC-SHA1',\n  Format: 'json',\n  SignatureVersion: '1.0',\n  // 不填，每次请求都会自动重新生成\n  SignatureNonce: Math.random(),\n  Timestamp: new Date().toISOString()\n};\n```\n\nES5:\n\n```js\nvar WALIYUN = require('waliyun');\nvar ecs = WALIYUN.ECS(options);\necs.describeInstances({\n  RegionId: 'cn-hangzhou'\n}).then(function(instances){\n  // xxxx\n});\n```\n\nES7:\n\n```js\nimport {ECS} from 'waliyun';\nconst ecs = ECS(options);\n// Within Async Func\n(async() =\u003e {\n  const instances = await ecs.describeInstances({\n    RegionId: 'cn-hangzhou'\n  });\n  // xxxx\n});\n```\n\n### 查看接口对应版本\n\nES7:\n\n```js\nimport {ECS} from 'waliyun';\nconst ecs = ECS(options);\nconsole.log(ecs.version());\n```\n\n## 已支持的接口\n\n### CDN\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/27155.html\u003e\n\n### 移动推送 CLOUDPUSH\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/30074.html\u003e\n\n### 邮件推送 DM\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/29435.html\u003e\n\n发送示例:\n\n```js\nconst { DM } = require('waliyun');\n\nconst dm = DM({\n  AccessKeyId: 'xxxx',\n  AccessKeySecret: 'xxxxx'\n});\n\ndm.singleSendMail({\n  AccountName: 'no-reply@xxx.com',\n  ReplyToAddress: false,\n  AddressType: 1,\n  ToAddress: 'xxx@qq.com',\n  FromAlias: '用户名',\n  Subject: '注册邮件',\n  HtmlBody: '\u003cp\u003e您的注册验证码为:1234\u003c/p\u003e'\n}).then(data =\u003e {\n  console.log(data);\n}).catch(err =\u003e {\n  console.log(err);\n});\n\n```\n\n### 短信服务 SMS\n\u003e 阿里云已停止开通原短信服务（整合在消息服务内）。新开通阿里云短信服务的用户，请参考下方的`新短信服务`调用示例\n\n发送示例:\n\n```js\nconst { SMS } = require('waliyun');\n\nconst sms = SMS({\n  AccessKeyId: 'xxxx',\n  AccessKeySecret: 'xxxx'\n});\n\nsms.singleSendSMS({\n  ParamString: '{\"customer\":\"1234\"}',\n  RecNum: '13812341234',\n  SignName: '您的签名',\n  TemplateCode: 'SMS_77778888'\n}).then(data =\u003e {\n  console.log(data);\n});\n```\n\n### 新短信服务 DYSMS\n\nAPI文档参考： https://help.aliyun.com/document_detail/56189.html\n\n发送示例:\n\n```js\nconst { DYSMS } = require('waliyun');\n\nconst sms = DYSMS({\n  AccessKeyId: 'xxxx',\n  AccessKeySecret: 'xxxx'\n});\n\nsms.sendSms({\n  TemplateParam: JSON.stringify({customer: '1234'}),\n  PhoneNumbers: mobileNo,\n  SignName: '您的签名',\n  TemplateCode: 'SMS_77778888'\n})\n```\n\n### 分布式关系型数据库 DRDS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/35276.html\u003e\n\n### 云服务器 ECS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/25485.html\u003e\n\nES7 示例:\n\n```js\nimport {ECS} from 'waliyun';\n\n(async() =\u003e {\n  const ces = ECS({\n    AccessKeyId: 'xxxx',\n    AccessKeySecret: 'xxxx',\n    Version: '2014-05-26'\n  });\n  const data = await ces.describeInstances({\n    RegionId: 'cn-hangzhou'\n  });\n  console.log(data.Instances.Instance);\n})();\n```\n\n### 语音服务 DYVMS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/56190.html\u003e\n\n### 弹性伸缩 ESS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/25925.html\u003e\n\n### ALIDNS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/29739.html\u003e\n\n### HTTPDNS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/30122.html\u003e\n\n### 阿里云物联网套件 IOT\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/30557.html\u003e\n\nES7 示例：\n\n```js\nimport {IOT} from 'waliyun';\n\n(async() =\u003e {\n  const iot = IOT({\n    Api:'https://iot.cn-shanghai.aliyuncs.com/',//可不填，默认为https://iot.aliyuncs.com/\n    AccessKeyId: 'xxxx',\n    AccessKeySecret: 'xxxxx',\n    Version: '2016-05-30'\n  });\n  const data = await iot.sub({\n    ProductKey: 'xxxx',\n    SubCallback: 'http://xxxx:xxx/',\n    'Topic.1': '/ProductKey/Topic'\n  });\n  console.log(data);\n})();\n```\n\n### 云监控 METRICS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/28616.html\u003e\n\nES7 示例：\n\n```js\nimport {METRICS} from 'waliyun';\n\n(async() =\u003e {\n  const metrics = METRICS({\n    AccessKeyId: 'xxxxxx',\n    AccessKeySecret: 'xxxxxx',\n    Version: '2015-10-20',\n    RegionId: 'cn-hangzhou'\n  });\n  const data = await metrics.queryMetric({\n    Project: 'acs_rds',\n    Metric: 'CpuUsage',\n    Period: '300',\n    StartTime: new Date() - 60 * 1000 * 1000,\n    Dimensions: '{instanceId:\\'xxxxxx\\'}'\n  });\n  console.log(data.Datapoints);\n})();\n```\n\n### 媒体转码 MTS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/29212.html\u003e\n\n### 访问控制 RAM\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/28672.html\u003e\n\n### 云数据库 RDS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/26226.html\u003e\n\n### 负载均衡 SLB\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/27566.html\u003e\n\n### 访问控制 STS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/28756.html\u003e\n\nES5示例:\n\n```js\nvar WALIYUN = require('waliyun');\nvar sts = WALIYUN.STS({\n  AccessKeyId: 'xxxx',\n  AccessKeySecret: 'xxxx',\n  Version: '2015-04-01'\n});\nsts.AssumeRole({\n  RoleArn: 'acs:ram::xxxx:role/xxxx',\n  RoleSessionName: 'xxxxx'\n},'post').then(function(token){\n  // xxxx\n});\n```\n\nES7 示例：\n\n```js\nimport {STS} from 'waliyun';\n\nconst sts = STS({\n  AccessKeyId: 'xxxx',\n  AccessKeySecret: 'xxxx',\n  Version: '2015-04-01'\n});\n\n(async() =\u003e {\n  const token = await sts.AssumeRole({\n    RoleArn: 'acs:ram::xxxx:role/xxxx',\n    RoleSessionName: 'xxxxx'\n  },'post');\n  // xxxx\n})();\n\n```\n\n\n### 容器服务 CS\n\nAPI文档参考： \u003chttps://help.aliyun.com/document_detail/26043.html\u003e\n\n注意，容器服务版本号停留在：2015-12-15。新版改动较为奇葩，暂不支持。\n\n旧版本方法列表：\n\n```js\n[\n  'GetClusterList',\n  'CreateCluster',\n  'DeleteCluster',\n  'GetClusterById',\n  'GetClusterCerts',\n  'UpdateClusterSizeById',\n  'ListProjects',\n  'CreateProject',\n  'RetrieveProject',\n  'StartProject',\n  'StopProject',\n  'UpdateProject',\n  'DeleteProject'\n]\n```\n\n## CHANGELOG\n\n### v2.0.0\n\n2016-09-06\n\n* 使用元编程方式进行重构，减少重复代码和`Action`限制；\n* 更新文档链接。\n\n### v1.0.0\n\n2016-05-16 解决了签名偶发错误的问题。\n\n## License\n\nMIT\n\n通过支付宝捐赠：\n\n![qr](https://cloud.githubusercontent.com/assets/1890238/15489630/fccbb9cc-2193-11e6-9fed-b93c59d6ef37.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Fwaliyun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillin%2Fwaliyun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillin%2Fwaliyun/lists"}