0

I've got a CloudFormation template that's launching a central server instance using OpsWorks (so I'm defining an OpsWorks::App, OpsWorks::Instance, OpsWorks::Layer and OpsWorks::Stack). Elsewhere in the CF template it is launching an EC2 instance for a slave node, which needs to know the IP address / DNS name of the central server so it initiate communications with the server. The Opsworks server gets an Elastic IP, but not one I explicitly give it, instead the OpsWorks layer has AutoAssignElasticIps set to true.

If it were one EC2 instance referencing another, I'd simply use { "Fn::GetAtt": [ "MyServerInstance", "PublicDnsName" ] } to get the address. But an AWS::OpsWorks::Instance is not the same as an AWS::EC2::Instance (even though it does create an EC2 instance), and so template validation fails with:

Template validation error: Template error: resource MyServerInstance does not support attribute type PublicDnsName in Fn::GetAtt

Is there another way to get the address of the launched OpsWorks instance? Or is it possible to get an AWS::EC2::Instance from an AWS::OpsWorks::Instance such that I can then ask it for the PublicDnsName?

2 Answers 2

1

That is not possible via CloudFormation, you must use a cookbook on the OpsWorks layer.

I use this one: https://github.com/opscode-cookbooks/aws.

0

You could also install aws-cli and a Chef recipe and parse the details from there (I used this method to bootstrap a an EC2 into a NAT for the VPC). This assumes you're running "locally" or you would need to run from another machine...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.