GetAtt
The get_att
method is the CloudFormation Fn::GetAtt equivalent.
Example Snippet
resource("MyElb", "AWS::ElasticLoadBalancing::LoadBalancer",
AvailabilityZones: ["eu-west-1a"],
Listeners: [{
LoadBalancerPort: "80",
InstancePort: "80",
Protocol: "HTTP"
}]
)
resource("MyElbIngressGroup", "AWS::EC2::SecurityGroup",
GroupDescription: "ELB ingress group",
SecurityGroupIngress: [{
IpProtocol: "tcp",
FromPort: "80",
ToPort: "80",
SourceSecurityGroupOwnerId: get_att("MyElb.SourceSecurityGroup.OwnerAlias"),
SourceSecurityGroupName: get_att("MyElb.SourceSecurityGroup.GroupName")
}]
)
Example Output
Resources:
MyElb:
Type: AWS::ElasticLoadBalancing::LoadBalancer
Properties:
AvailabilityZones:
- eu-west-1a
Listeners:
- LoadBalancerPort: '80'
InstancePort: '80'
Protocol: HTTP
MyElbIngressGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: ELB ingress group
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '80'
ToPort: '80'
SourceSecurityGroupOwnerId:
Fn::GetAtt:
- MyElb
- SourceSecurityGroup.OwnerAlias
SourceSecurityGroupName:
Fn::GetAtt:
- MyElb
- SourceSecurityGroup.GroupName
Back to Intrinsic Functions List.
Pro tip: Use the <- and -> arrow keys to move back and forward.
Edit this page
See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!
- Suggest an edit to this page (here's the contributing guide).
- Open an issue about this page to report a problem.