AWS javascript sdk 队列配置 ResourceNotFound 异常
AWS javascript sdk fleet provisioning ResourceNotFound exception
我正在尝试在 AWS Lambda 函数中实施队列配置。作为起点,我有这段代码:
'use strict';
var AWS = require('aws-sdk');
var iot = new AWS.Iot({
endpoint: 'apiendpoint',
accessKeyId: "AAAABBBBBCCCCDDDDD",
secretAccessKey: "AAAAABBBBCCCDD/1234122311222",
region: 'ap-south-1'
});
exports.handler = async (event, context) => {
var params = {
setAsActive: true
};
return {
statusCode: 200,
body:JSON.stringify(await createCertAndKey(params))
}
}
const createCertAndKey = async (params) => {
return new Promise((resolve, reject) => {
iot.createKeysAndCertificate(params, function(err, data){
if(err){
console.log(err);
reject(err)
}
else{
console.log("success?");
resolve(data)
}
})
})
}
我在调用 createKeysAndCertificate
时遇到 ResourceNotFound
异常。我也尝试调用iot的其他函数,但它给出了同样的异常。
我做错了什么?
初始化对象时传递的端点应该是格式为 https://{service}.{region}.amazonaws.com
的通用 AWS 服务。我们不需要传递它,AWS 将根据我们正在初始化的区域和对象进行假设。
var iot = new AWS.Iot({
endpoint: 'iot.ap-south-1.amazonaws.com',
accessKeyId: "AAAABBBBBCCCCDDDDD",
secretAccessKey: "AAAAABBBBCCCDD/1234122311222",
region: 'ap-south-1'
});
我正在尝试在 AWS Lambda 函数中实施队列配置。作为起点,我有这段代码:
'use strict';
var AWS = require('aws-sdk');
var iot = new AWS.Iot({
endpoint: 'apiendpoint',
accessKeyId: "AAAABBBBBCCCCDDDDD",
secretAccessKey: "AAAAABBBBCCCDD/1234122311222",
region: 'ap-south-1'
});
exports.handler = async (event, context) => {
var params = {
setAsActive: true
};
return {
statusCode: 200,
body:JSON.stringify(await createCertAndKey(params))
}
}
const createCertAndKey = async (params) => {
return new Promise((resolve, reject) => {
iot.createKeysAndCertificate(params, function(err, data){
if(err){
console.log(err);
reject(err)
}
else{
console.log("success?");
resolve(data)
}
})
})
}
我在调用 createKeysAndCertificate
时遇到 ResourceNotFound
异常。我也尝试调用iot的其他函数,但它给出了同样的异常。
我做错了什么?
初始化对象时传递的端点应该是格式为 https://{service}.{region}.amazonaws.com
的通用 AWS 服务。我们不需要传递它,AWS 将根据我们正在初始化的区域和对象进行假设。
var iot = new AWS.Iot({
endpoint: 'iot.ap-south-1.amazonaws.com',
accessKeyId: "AAAABBBBBCCCCDDDDD",
secretAccessKey: "AAAAABBBBCCCDD/1234122311222",
region: 'ap-south-1'
});