https://pulumi.com logo
Title
e

elegant-pager-5412

04/23/2021, 12:10 PM
I have a few general questions about AWS using Lambda and SQS: 1. If I have an SQS queue with hundreds of thousands of messages in it with a lambda listening to the queue, how many instances of the same Lambda will AWS spawn? Is there a way I can limit it? 2. If I have a FIFO SQS queue with multiple groups, will each group be processed by a different lambda instance? For example, I have
groupA
and
groupB
, will AWS automatically spawn multiple lambda instances and process
groupA
messages in parallel to
groupB
? 3. For how long will an SQS message processing will be attempted before it gets discarded (or sent to a DLQ) when it fails? 4. Is there a way to send a message that failed to process back to the queue with a delay of few seconds/minutes before it’s being retried? Also, is it possible to get the retry number in the lambda itself? Thanks in advance!
d

damp-school-17708

04/23/2021, 12:41 PM
re: concurrency https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html I haven't use it in pulumi yet but I assume there's a property to set those limits
e

elegant-pager-5412

04/23/2021, 12:49 PM
Thank you very much! I’ll start reading this right away!
By the way, is there any good practice for folder structuring? Where would you define each piece of infra and domain logic
d

damp-school-17708

04/23/2021, 12:52 PM
There's a few old chats on the subject, the key points where everyone seem to agree are: • keep things that change at the same rate together • better to have multiple stacks/projects than a monolithic one
I have : • functions with app code and infra folder, that's one pulumi project • frontend - with its own infra (S3+cloudfront+route 53) • infrastructure with everything else (VPC, cognito, sqs, codebuild/pipeline)
Arguably I can split further, especially the codepipeline seems a bit out of place.
e

elegant-pager-5412

04/23/2021, 12:57 PM
So you split your folder per “features” and inside each feature you have the infra and the app code?
For example:
root/
├─ frontend/
│  ├─ infra/
│  │  ├─ index.ts
│  ├─ src/
├─ backend/
│  ├─ infra/
│  │  ├─ index.ts
│  ├─ src/
├─ shared-infra/
│  ├─ index.ts
d

damp-school-17708

04/23/2021, 2:23 PM
yes like that 👍
then inside share infra I have /route53 /sqs /dyanamo /etc
e

elegant-pager-5412

04/25/2021, 6:53 AM
@damp-school-17708 I see. How does Pulumi know to look for the
index.ts
inside infra?
d

damp-school-17708

04/25/2021, 8:01 AM
There's a 'main' property in the Pulumi.yaml, set it to the folder name
e

elegant-pager-5412

04/25/2021, 8:11 AM
@damp-school-17708 oh I see. Thanks!