Reputation: 32316
Here is a cloudformation template that works as expected.
https://github.com/shantanuo/cloudformation/blob/master/updated/so2.tpl.txt
But when I change the last line to something like this...
/home/ec2-user/mysecret.txt`'' --valid-ips !Ref MyIpAddress >
It silently ignores the command. Is there any other way to substitute the MyIpAddress variable?
Upvotes: 1
Views: 365
Reputation: 32316
I do not know how and why does it work. But this is what I was looking for.
- >-
/usr/local/bin/aws-ec2-assign-elastic-ip --access-key ''`cat
/home/ec2-user/myaccesskey.txt`'' --secret-key ''`cat
/home/ec2-user/mysecret.txt`'' --valid-ips '
- !Ref MyIpAddress
- |
'
Thanks to Pat's comment!
Upvotes: 1
Reputation: 481
Instead of using 'Fn::Join' you can use 'Fn::Sub'. This will make your template more readable as won't have to break your script inot multiple lines and you can reference MyIpAddress as ${MyIpAddress}.
Upvotes: 1