This project creates an Api Gateway directly connected to a SQS Fifo queue, a Dead Letter Queue and also a consumer to it with the power to connect in a RDS instance running in a private subnet with credentials configured over AWS Secrets Manager.
The default value of the batchSize
is 10 and we are consuming a batch of messages instead a single one. If you want more informations about it, just check this blog post.
-
You need to have a RDS Instance already created and retrieve the values of
VPC_ID
,SUBNET_IDS
andSECURITY_GROUP_IDS
from it. With this values in hand, you need to add them intoserverless.yml
file; -
You need to create a new input over AWS Secrets Manager, with
host
,username
andpassword
to be able to connect to the RDS instance;
serverless deploy --stage <YOUR_STAGE> -v
After the deploy it will output an HTTP Endpoint like this:
When you call this endpoint sending a JSON object over the body, it should place this message over your SQS Fifo queue and it will be going to be consumed by the index.js
code.
You can also check for a file called artillery/script.yml
file in the repository. If you want to run a stress test over your setup, you can use this file with serverless-artillery. You will need to fill the props target
and url
with the values of your deployment.