AliastTarget and Route53

390 views
Skip to first unread message

Bardia Afshin

unread,
Apr 1, 2015, 3:06:52 PM4/1/15
to cloudto...@googlegroups.com
I'd like to create a Alias record via route53 to a Elastic Load Blanacer I have instantiated in my cloudformation script via troposphere.  I don't see any immediate examples on troposphere examples on doing this, can someone provide a working example to work off?

Mark Peek

unread,
Apr 1, 2015, 4:17:25 PM4/1/15
to Bardia Afshin, cloudto...@googlegroups.com
As an example, the below troposphere code will generate the same json from the snippet " An Alias Resource Record Set for a CloudFront Distribution" located here:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-route53.html

------
from troposphere import Ref, Template
from troposphere.route53 import AliasTarget, RecordSetGroup, RecordSet

t = Template()

myDNS = t.add_resource(RecordSetGroup(
        "myDNS",
        HostedZoneName=Ref("myHostedZoneID"),
        RecordSets=[
            RecordSet(
                Name=Ref("myRecordSetDomainName"),
                Type="A",
                AliasTarget=AliasTarget(
                    "Z2FDTNDATAQYW2",
                    Ref("myCloudFrontDistributionDomainName")
                ),
            ),
        ],
    )
)

print t.to_json()

------


On 4/1/15 12:06 PM, Bardia Afshin wrote:
I'd like to create a Alias record via route53 to a Elastic Load Blanacer I have instantiated in my cloudformation script via troposphere.  I don't see any immediate examples on troposphere examples on doing this, can someone provide a working example to work off?
--
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/18dcf67a-6805-418c-b54e-a4fbe2eb26b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Barrett

unread,
Apr 1, 2015, 5:29:39 PM4/1/15
to Mark Peek, Bardia Afshin, cloudto...@googlegroups.com
I actually had an internal version of the asg stack for stacker that created an ELB optionally (with SSL, optionally as well) and created a DNS alias for it.  I went ahead and finished cleaning that up and pushed it up into a branch.  The relevant code is here:

https://github.com/remind101/stacker/blob/optional_elb_for_asg/stacker/blueprints/asg.py#L148

It's a little complicated in that example, because I'm doing a lot in that code to make everything optional, but it should be pretty easy to follow.

Bardia Afshin

unread,
Apr 9, 2015, 4:09:52 PM4/9/15
to cloudto...@googlegroups.com, ma...@peek.org, brand...@gmail.com
Also, here's the logs from cfn-init from the instance

ubuntu@ip-10-0-0-208:/var/log$ cat cfn*.log
2015-04-09 20:07:44,070 [DEBUG] CloudFormation client initialized with endpoint https://cloudformation.us-east-1.amazonaws.com
2015-04-09 20:07:44,078 [DEBUG] Signaling resource AutoscalingGroup in stack EOD-ASHARP with unique ID i-bd97df6a and status SUCCESS
2015-04-09 20:07:44,361 [DEBUG] Response: 400 https://cloudformation.us-east-1.amazonaws.com/?Status=SUCCESS&ContentType=JSON&StackName=EOD-ASHARP&Version=2010-05-15&UniqueId=i-bd97df6a&Action=SignalResource&LogicalResourceId=AutoscalingGroup [headers: CaseInsensitiveDict({'x-amzn-requestid': '15ae2cba-def4-11e4-b908-d52580947c3c', 'date': 'Thu, 09 Apr 2015 20:07:43 GMT', 'content-length': '192', 'content-type': 'application/json', 'nncoection': 'close'})]
2015-04-09 20:07:44,362 [DEBUG] Response error: {"Error":{"Code":"ValidationError","Message":"Resource AutoscalingGroup is in CREATE_COMPLETE state and cannot be signaled","Type":"Sender"},"RequestId":"15ae2cba-def4-11e4-b908-d52580947c3c"}



There's nothing in here referencing that the file cannot be created

Bardia Afshin

unread,
Apr 9, 2015, 4:10:26 PM4/9/15
to cloudto...@googlegroups.com, ma...@peek.org, brand...@gmail.com
wrong thread
Reply all
Reply to author
Forward
0 new messages