I have difficulty in connecting my Lambda with AWS Memcache. I'm using the below code snippet, I don't see any error logs and the function is getting timed out. Can you suggest me what went wrong ?
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);
}
}
myLambdaFunc:
handler: src/myLambdaFunc.handler
vpc:
securityGroupIds:
- Fn::ImportValue: myapp-${{self:provider.stage}}-PrivateVPCLambdaSGID
subnetIds:
- Fn::ImportValue: myapp-${{self:provider.stage}}-PrivateVPCSubnet1Ref
- Fn::ImportValue: myapp-${{self:provider.stage}}-PrivateVPCSubnet2Ref
environment:
ELASTIC_CACHE_CONNECTION_URL:
Fn::ImportValue: myapp-${{self:provider.stage}}-ECURL