I'm trying to create an SNS event source on a lambda using the Javascript AWS SDK. I have the following snippet:
var permissionParams = {
FunctionName: "MyFunction",
Action: "lambda:Invoke",
Principal: "sns.amazonaws.com",
StatementId: "snsinvoke",
SourceArn: "MyArn"
};
lambda.addPermission(permissionParams, function (err, data) {
if (err) {
console.log(err);
} else {
console.log(data);
}
});
This combined with another call to subscribe to the topic creates the event source in the lambda, but it is disabled. Is there another call I can make to enable it or is there a way to have it enabled when I add it?