用nodejs鏈接aws短信發送服務發送驗證碼,參考鏈接https://gist.github.com/tmarshall/6149ed2475f964cda3f5javascript
不過這裏代碼的問題是須要ARN(Amazon Resource Names)參數 ,ARN又分爲 Topic ARN(訂閱相關)和Target ARN(告警相關),瞬間矇蔽了。這是啥?java
而後問了下前輩。果真不用這些就能夠。so easynode
const AWS = require('aws-sdk'); AWS.config.update({ accessKeyId: amazonKey, secretAccessKey: amazonSecret, region: 'us-east-1'//本身看下aws配置 }); const sns = new AWS.SNS(); const params = { Message: '驗證碼123456', PhoneNumber: '8618888888888' } sns.publish(params, function(err, data) { if (err){ // an error occurred console.log(err, err.stack); } else { // successful response } })