Ask Your Question
0

How to get WaitCondition Data in instance

asked 2013-06-20 10:52:37 -0500

nanjj gravatar image

In UserData, I use cfn-singal in MySql instance as below: "/opt/aws/bin/cfn-signal --id 00001 -e 0 -r done --data 'done' '",{ "Ref" : "MySqlWaitHandle" }, "'\n",

My question is, how do I get { id:00001, data:done} from other instance? Say WordProc, thanks!

I tried heat resource-metadata stack WaiHandle, which can get the signal data. But the question is how to get it in instance.

edit retag flag offensive close merge delete

11 answers

Sort by ยป oldest newest most voted
0

answered 2013-09-10 03:42:26 -0500

nanjj gravatar image

(Now I know the answer)

we can get signals in instance via cfn-get-metadata -s stack_name -r handle_name

edit flag offensive delete link more
0

answered 2013-09-11 09:22:10 -0500

zaneb gravatar image

In AWS the WaitConditionHandle is actually a pre-signed URL to an S3 bucket. I don't think it's readable by instances though, for security reasons.

edit flag offensive delete link more
0

answered 2013-09-10 13:15:11 -0500

nanjj gravatar image

The problem is signals may be changed, for example, before cfn-signal invoked, signals is empty, after cfn-signal invoked, there will be some data in it. So I prefer cfn-get-metadata -s stack_name -r handle_name to retrieve latest signals data.

edit flag offensive delete link more
0

answered 2013-09-10 09:31:37 -0500

zaneb gravatar image

The recommended way is to use:

{"Fn::GetAtt": ["MySqlWaitCondition", "Data"]}

in the template in the UserData or Metadata sections of the other server. This sets up the dependency automatically, and enlists the engine to insert the correct data into the server for you.

edit flag offensive delete link more
0

answered 2013-09-10 13:03:44 -0500

I saw some recent comments addressing this post, so I took the liberty opening it up again.

edit flag offensive delete link more
0

answered 2013-07-06 09:20:58 -0500

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

edit flag offensive delete link more
0

answered 2013-09-10 13:14:58 -0500

nanjj gravatar image

The problem is signals may be changed, for example, before cfn-signal invoked, signals is empty, after cfn-signal invoked, there will be some data in it. So I prefer cfn-get-metadata -s stack_name -r handle_name to retrieve latest signals data.

edit flag offensive delete link more
0

answered 2013-09-10 14:23:57 -0500

zaneb gravatar image

Right, you don't want to read it until after cfn-signal is called. That's why "Fn::GetAtt" adds a dependency, so any instance referencing the WaitCondition's Data won't be created until after the WaitCondition is complete (i.e. cfn-signal has been called). So the method I mentioned above is guaranteed to work by design - in fact, that's the entire point of orchestration.

The cfn-get-metadata method, on the other hand, is not portable (won't work on CloudFormation) and is extremely likely to stop working on Heat in the future, possibly the very near future. It's making use of a hack (WaitCondition data is stored in the metadata of the handle) in Heat that we are already taking steps to eliminate.

edit flag offensive delete link more
0

answered 2013-09-11 01:21:12 -0500

nanjj gravatar image

seemly we should expose an api to do the job of the hack.

what's Fn::GetAtt blocked is the whole resource, while, there may be several configurations in a single resource. Not same.

edit flag offensive delete link more
0

answered 2013-09-11 03:06:28 -0500

I don't want a direct API for it actually. I just want it in the Metadata, and I want any Metadata that references it to be updated when the signal happens. The reason is that as a template author, this gives me an enormous amount of visibility and control over which credentials can access the data from a waitcondition. If there is an API, that is less discoverable, and more work for us as Heat developers.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2013-06-20 10:52:37 -0500

Seen: 565 times

Last updated: Sep 11 '13