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
gefragt vor einem Jahr582 Aufrufe
3 Antworten
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
EXPERTE
beantwortet vor einem Jahr
  • 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
EXPERTE
beantwortet vor einem Jahr
0

I managed to get this working using CodeWhisperer:

redis_endpoint = redis_cache_cluster.attr_redis_endpoint_address
Mick B
beantwortet vor einem Jahr
profile picture
EXPERTE
überprüft vor einem Jahr

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen