我正在構建Cloud Formation JSON以定義EC2實例和安全組。允許同一安全組中的每個實例在Cloud Formation JSON上彼此之間共享任何數據?
我需要創建一個安全組,允許屬於它的每個實例在彼此之間共享任何數據。
我的JSON是這樣的:
"InternalSecurityGroup" : {
"Type" : "AWS::EC2::SecurityGroup",
"Properties" : {
"VpcId" : {"Ref" : "myVPC"},
"GroupDescription" : "Allow the machines in this group to share all kinds of traffic between each other",
"SecurityGroupIngress" : [
{
"IpProtocol" : "-1",
"FromPort": "-1",
"ToPort": "-1",
"SourceSecurityGroupId" : { "Ref" : "InternalSecurityGroup" }
}
],
"SecurityGroupEgress" : [
{
"IpProtocol" : "-1",
"FromPort": "-1",
"ToPort": "-1",
"DestinationSecurityGroupId" : { "Ref" : "InternalSecurityGroup" }
}
]
}
},
但這讓我看到以下錯誤:
A client error (ValidationError) occurred when calling the CreateStack operation: Circular dependency between resources
要解決它,我改變了我的代碼,以CidrIp而不是SourceSecurityGroupId,定義子網的情況下,都在。
是否有可能引用同一個安全組?什麼是最好(或正確)的方式來實現我想要的?