为什么我无法将我的 EC2 实例连接到 ElastiCache?

问题描述 投票:0回答:1

我正在尝试在 EC2 实例中执行此 Python 脚本:

import elasticache_auto_discovery

elasticache_config_endpoint = "<my-elasticache-cluster-endpoint>:6379"
nodes = elasticache_auto_discovery.discover(elasticache_config_endpoint)
print("nodes discovered")

但是,打印语句永远不会执行。有时我得到

TimeoutError: [Errno 110] Connection timed out
,通常我什么也得不到。

EC2 实例和 ElastiCache Redis 集群具有相同的 VPC ID 和安全组 ID。 ElastiCache Redis 集群具有附加到同一 VPC ID 的子网组名称。

EC2 实例使用附加了 AmazonElastiCacheFullAccess 策略的 IAM 角色。该角色被分配了一个权限边界,该边界拒绝“受限:写入”并允许“完全:读取、列表、标记受限:写入”。

如果我使用

elasticache_config_endpoint
的无意义字符串运行脚本,我会得到
socket.gaierror: [Errno -2] Name or service not known

python amazon-web-services amazon-ec2 amazon-elasticache
1个回答
0
投票

我终于明白了这一点,至少在有限的意义上是这样。我创建了一个新的 Elasticache 集群,并且禁用了传输中加密和静态加密,然后我能够使用新集群的端点执行我的问题中给出的 Python 代码片段。

© www.soinside.com 2019 - 2024. All rights reserved.