Accessing Elastic Cache Redis from Celery in a docker-compose locally

0

Dear all,

I am developing a python FastAPI application that uses Celery and Redis. So far I have run these services locally using docker-compose and everything worked fine. I would now like to use the Elastic Cache Redis instance from my company, however I have problems connecting to it.

According to celery documentation https://docs.celeryq.dev/en/stable/userguide/configuration.html#std-setting-broker_url the CELERY_BROKER_URL should be redis://:password@hostname:port/db_number or transport://userid:password@hostname:port/virtual_host . Until now I simply had redis://redis:6379/0 because I had redis running locally, however I am unsure about what to put when using the remote instance.

I have tried using the Primary endpoint as the hostname, the Account ID as userid and the token as the password, is this correct? Also, is it actually possible to access the remote instance locally from celery?

質問済み 2年前2356ビュー
1回答
0

Hello, thank you for your post. Elasticache is designed to be used internally to your VPC and external access is not enabled. Should you need to access your Elasticache cluster from outside your VPC, you can do so via VPN. Please refer to the "Accessing ElastiCache resources from outside AWS" section on the page referenced below[1]. After you have established a VPN connection, you will be able to access the cluster simply using redis://redis:6379/0 as you do from within the VPC.

References:
[1] https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/accessing-elasticache.html

AWS
サポートエンジニア
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ