Trying to track down how to set Lambda reservedCon...
# sst
s
Trying to track down how to set Lambda reservedConcurrency
and this appears to be how it's done in CDK
In the console
t
It's actually really weird, let me find my code
Wait are you referring to "reservedConcurrentExecutions" or something else?
s
Yup, that's the one
I have a lambda that is a target of an API Gateway route and an SQS queue consumer
t
I got confused with provisionedConcurrentExecutions - should be able to just set that right?
s
yeah, fiddling with it now
t
I have something similiar
Copy code
consumer: {
        function: {
          handler: "services/catalog/price.update",
          timeout: Duration.minutes(2),
          reservedConcurrentExecutions: 10,
        },
      },
s
oh, that's simpler than I had envisioned. Trying it now
It worked, thank you! Yeah, it's a bit tricky to set up an SQS Queue, a consumer, a DLQ (with no consumer) and set batch sizes, reserved concurrent executions, etc
I ended up with:
Copy code
// Create the source DLQ in native CDK
    const sourceDLQ = new sqs.Queue(this, `kas-source-dlq-${this.stage}`);

    // Create the source queue in native CDK
    const sourceQueue = new sqs.Queue(this, `kas-source-queue-main-${this.stage}`, {
      deadLetterQueue: {
        maxReceiveCount: 3,
        queue: sourceDLQ
      }
    });

    // Pass the source queue into sst.Queue and add a consumer
    new sst.Queue(this, `kas-source-queue-${this.stage}`, {
      consumer: {
        srcPath: "functions",
        handler: "record_source/create.handler",
        reservedConcurrentExecutions: 30
      },
      consumerProps: {
        batchSize: 10,
      },
      sqsQueue: sourceQueue,
    });
I also have an API endpoint that exposes the same Function with the same configuration, so I suppose I'll need to extract the inline
consumer
settings into a standalone
Function
construct and pass that to the
sst.Queue
and the
sst.Api