2014-07-20 2 views
2

구름 형성 템플릿 간의 순환 참조는 어떻게 피합니까?보안 그룹과 함께 구름 형 순환 참조를 피하는 방법은 무엇입니까?

예. 내 웹 서버에는 하나의 템플릿이 있고 데이터베이스 인스턴스에는 다른 템플릿이 있습니다.

"WebServer": { 
    "Type":"AWS::EC2::Instance", 
    "Properties": { 
    // lots of other props 
    "SecurityGroups": [ {"Ref":"DBSecurityGroup"} ] 
    } 
}, 
"WebSecurityGroup" : { 
    "Type":"AWS::EC2::SecurityGroup", 
    "Properties": { 
    // lots of other props 
    "SecurityGroupEgress": [{... "SourceSecurityGroupId":{"Ref":"DBSecurityGroup"}}] 
    } 
} 

가 어떻게 템플릿 사이의 이러한 순환 참조를 피하기 않습니다

"Database": { 
    "Type":"AWS::RDS::DBInstance", 
    "Properties": { 
    // lots of other props 
    "VPCSecurityGroups": [ {"Ref":"DBSecurityGroup"} ] 
    } 
}, 
"DBSecurityGroup" : { 
    "Type":"AWS::RDS::DBSecurityGroup", 
    "Properties": { 
    // lots of other props 
    "SecurityGroupIngress": [{... "SourceSecurityGroupId":{"Ref":"WebSecurityGroup"}}] 
    } 
} 

하지만 내 웹 서버 템플릿

, 내가 DBSecurityGroup를 참조해야합니다 같은 템플릿 DB는 LOK 것인가?

답변

0

SecurityGroupEgress 속성 대신 AWS::EC2::SecurityGroupEgress 리소스를 별도로 사용하십시오.

내가 별도로 SecurityGroupIngress을 사용하는 방법을 알고 http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ec2.html#scenario-ec2-security-group-ingress

+0

에서 예 스 니펫 (snippet)을 참조하십시오. 하지만 여러 템플릿 문제를 해결하는 데 어떻게 도움이되는지 이해할 수 없습니까? 너는 넓게 생각하니? – deitch

+0

죄송합니다. 질문에 대해 오해 한 것 같습니다. 하나의 접근법은 3 개의 템플리트를 가지는데, 웹 템플리트와 DB 템플리트 모두에 매개 변수로 전달하는 SG의 경우 하나의 "루트"입니다. –

+0

걱정할 필요는 없지만 노력에 감사드립니다. 나는 그것에 대해 생각했지만 논리와 규칙이 밀접하게 연관되어 있기 때문에 서버와 같은 템플릿으로 SecurityGroup을 원했습니다. 그래서 나는 다른 해결책을 생각해 냈습니다. SG 태깅. 그것은 꽤 산뜻하다. – deitch

관련 문제