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
已提问 1 年前574 查看次数
3 回答
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
专家
已回答 1 年前
  • 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
专家
已回答 1 年前
0

I managed to get this working using CodeWhisperer:

redis_endpoint = redis_cache_cluster.attr_redis_endpoint_address
Mick B
已回答 1 年前
profile picture
专家
已审核 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则