I'm able to create an SQS queue + lambda function and connect them via trigger/subscription.
How can I create a topic filter via CDK?
I'm able to create the topic, lambda, and trigger / subscription like so:
const queue = new sqs.Queue(this, 'OurSqsQueue', {
queueName: 'OurSQSQueue',
});
const lambdaFunction = new lambda.Function(this,'test', {
code: lambda.Code.fromAsset('src'),
handler: index.lambdaHandler,
functionName: 'test',
runtime: lambda.Runtime.NODEJS_14_X,
});
const eventSource = new lambdaEventSources.SqsEventSource(queue);
lambdaFunction.addEventSource(eventSource);
According to the docs Amazon SQS topic subscriber receives every message published to the topic. To receive a subset of the messages, a subscriber must assign a filter policy to the topic subscription.
