How can I find the endpoint after I have created a Redis instance using the CDK?

0

I'm doing this to create a Redis instance:

redis_cache_cluster = aws_elasticache.CfnCacheCluster(
            self,
            "RedisCacheCluster",
            cluster_name=f"ctest",
            cache_node_type="cache.t2.micro",
            cache_subnet_group_name="ghjghj",
            engine="redis",
            engine_version="7.0",
            num_cache_nodes=1,
            port=6379,
            vpc_security_group_ids=[
                'ghjghj'
            ]
        )

How can I get the endpoint after this? (Then assign it to an environment variable for a lambda?)

Mick B
demandé il y a un an573 vues
3 réponses
0

Hi Mick.

There are several ways to find the endpoints. Please see the following documentation page and use your preferred method (Console, CLI, or API).

I hope this helps.

profile pictureAWS
EXPERT
répondu il y a un an
  • Thanks. What about in the CDK? I want to assign it to an environment variable which can then be used by a lambda.

0

Mick, based on the documentation here, it looks you should be able to use the following properties from the redis_cache_cluster variable to get the endpoint information:

I hope this helps.

profile pictureAWS
EXPERT
répondu il y a un an
0

I managed to get this working using CodeWhisperer:

redis_endpoint = redis_cache_cluster.attr_redis_endpoint_address
Mick B
répondu il y a un an
profile picture
EXPERT
vérifié il y a un an

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions