AWS Elasticache

Elasticache is a managed caching service offered by Amazon Web Services (AWS), and it can be a good option when using BullMQ within the AWS infrastructure.

Here are some points to consider when using Elasticache with BullMQ within AWS:

  1. Use the standard cache-nodes setup (i.e. not the serverless version, as serverless for the moment uses an incompatible maxmemory-policy)

  2. In order to access your Elasticache instance you will need to create a security group that allows the instance to be accessible to the services running BullMQ instances.

<figure><img src="../../.gitbook/assets/image.png" alt=""><figcaption></figcaption></figure>
  1. You will need to specify a VPC and an Inboud rule. Most likely just a custom TCP with port range 6379 and some suitable source (anywhere works well for testing and in some simpler cases), remember that the cluster will not be accessible outside from AWS in any case.

  2. Attach the security group to your Elasticache cluster and to the services that need to access it.

  3. Make sure that you are using maxmemory-policy: noeviction in your Redis parameters. As you cannot modify any default parameter group you will need to create a new one.

    1. Go to Elasticache > Parameter Groups and click on Create.

    2. Fill name, description, and Family, at the time of writing redis7 is the newest and the recommended one.

  4. Click on "Create". Then find the parameter group in the list. Click on Edit parameter values and then search for maxmemory-policy:

  1. Change the value to "noeviction":

  1. Save changes. Now you can go to your elasticache cluster and change the parameter group to your custom group. Just find your instance, click on modify and go to cluster settings where you can change the parameter group:

  1. Preview changes and Modify. After this your cluster is ready to be used with BullMQ.

Last updated

Copyright (c) Taskforce.sh Inc.