我確實沒有設定來測試這一點,但如果我創建一個具有超過 1 個節點的 Elasticache Redis 集群,安全組到底必須看起來如何才能非常安全,但又不會破壞集群本身?
假設我建立了一個安全群組,允許從連接埠 6379 上從自身和我的 kubernetes 節點進入,並允許所有到自身和 kubernetes 的出站。
例如這樣:
resource "aws_security_group" "tools_elasticache_default" {
name = "tools-elasticache-default"
description = "Allow traffic from tools cluster to elasticache instance"
vpc_id = module.tools_cluster.vpc_id
ingress {
description = "Incomming redis traffic"
from_port = 6379
to_port = 6379
protocol = "tcp"
self = "true"
security_groups = [for x in module.tools_cluster.node_security_groups : x.id ]
}
egress {
description = "Outgoing redis traffic"
from_port = 0
to_port = 0
protocol = "-1"
self = "true"
security_groups = [for x in module.tools_cluster.node_security_groups : x.id ]
}
tags = merge(var.tags, {
"shared" = "true"
})
}
這會破壞我的 Elasticache 叢集嗎,因為它的底層是 ec2 且安全性群組是基於每個實例的?由於我沒有明確指定 Redis 集群通訊端口,如所述這裡?
據我了解,叢集應該被破壞,因為一個 Redis 節點可以在連接埠 3333 上出口到另一個節點,但他的請求將因另一個叢集參與者上缺少入口規則而被丟棄。
或者 AWS 是否隱式管理這些規則並確保始終允許集群間通訊的連接埠?
任何幫助將不勝感激。謝謝!
答案1
或者 AWS 是否隱式管理這些規則並確保始終允許集群內通訊的連接埠?
是的。