【发布时间】:2021-11-24 15:58:56
【问题描述】:
我很难将我的 Lambda 与 AWS Memcache 连接起来。我正在使用下面的代码 sn-p,我没有看到任何错误日志并且函数超时。你能告诉我出了什么问题吗?
const MemcachePlus = require("memcache-plus");
const client = new MemcachePlus("test_memcached.cfg.use1.cache.amazonaws.com:11211");
exports.index = async (event) => {
try {
await client.set("firstName", "Victor", 10000);
console.log("Successfully set the key firstName");
const firstName = await client.get("firstName");
console.log(`Successfully got the key firstName: ${firstName}`);
} catch (e) {
console.log("error", e);
}
}
【问题讨论】:
-
您的函数是在 VPC 内部还是外部? AWS 内存缓存也一样?
-
lambda 和 memcache 都在同一个 VPC 上。
-
那很好。然后你能提供你的安全组规则吗?
-
目前我使用的是默认角色,允许所有流量。
-
memcache 和 lambda 都使用同一个组?还能截图规则吗?
标签: node.js amazon-web-services aws-lambda memcached elastic-cache