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
asked a year ago536 views
3 Answers
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
answered a year ago
  • 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
answered a year ago
0

I managed to get this working using CodeWhisperer:

redis_endpoint = redis_cache_cluster.attr_redis_endpoint_address
Mick B
answered a year ago
profile picture
EXPERT
reviewed 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions