GetAtt, parsing string from object

246 views
Skip to first unread message

Bardia Afshin

unread,
Mar 19, 2015, 5:56:18 PM3/19/15
to cloudto...@googlegroups.com
I'd like to be able to retrieve the string from GetAtt object, looking at the class definition, it's not apparent, I'd like to perform the following operation

first_instace_DNSName = GetAttr(first_instance, "DNSName")
print first_instance_DNSName
exit()

the code above returns a troposphere object, I'd like to parse the actual value of the DNSName from that object. 

Thoughts?

class GetAtt(AWSHelperFn):
def __init__(self, logicalName, attrName):
self.data = {'Fn::GetAtt': [self.getdata(logicalName), attrName]}

def JSONrepr(self):
return self.data

Michael Barrett

unread,
Mar 19, 2015, 6:03:04 PM3/19/15
to Bardia Afshin, cloudto...@googlegroups.com
What do you mean by parse?  Like you'd like to have the python code get the DNS name and do something with it?  That's not possible with GetAtt - remember that GetAtt is part of troposphere, which means that it's part of the CloudFormation language.  It simply translates into the CloudFormation Fn::GetAtt, which is only available once the template is built into a stack.

If you want to, after the stack is built, get the DNSName - then take the output of GetAtt(object, "DNSName") and put it in an Output.  Then you can query it with boto, or use it as a parameter in other stacks.

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html

--
You received this message because you are subscribed to the Google Groups "cloudtools-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cloudtools-de...@googlegroups.com.
To post to this group, send email to cloudto...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cloudtools-dev/8d0903f7-6b61-4231-817e-bdb47b8c75ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages