I tried to run cfn-signal from cloudformation, to create a Windows server 2008 instance. creating stack and roles and waithandler are fine, the only problem is sending a successfull signal from instance to the cloudformation.
the Userdata of cloudformation template is :
"UserData": {
"Fn::Base64": {
"Fn::Join": [
"",
[
"<script> \n",
"cd C:\\chef\\ff_dotnet_2008\\test\\integeration\\default \n",
"C:\\opscode\\chef\\embedded\\bin\\inspec.bat exec win2008.rb \n",
"cd /",
"\n",
"cfn-signal.exe ",
{
"Fn::Base64": {
"Ref": "WaitHandlewin2008"
}
},
"\n",
"echo cfn-signal: %ERRORLEVEL% >> C:\\userdata.log \n",
"</script>"
]
]
}
}
}
},
I loged in through the instance, the inspec part of userdata ran successfully but for cfn-signal.exe the error is :
2017-07-27T17:55:18.813Z: Ec2HandleUserData: Message: Could not find <powershell> and </powershell>
2017-07-27T17:55:18.814Z: Background plugin complete: Ec2HandleUserData
2017-07-27T17:55:18.814Z: After ready plugins complete.
2017-07-27T17:55:19.988Z: SSM Service is running now
2017-07-27T17:55:23.793Z: Failed to fetch instance metadata http://169.254.169.254/latest/meta-data/public-ipv4 with exception The remote server returned an error: (404) Not Found.
2017-07-27T17:55:23.797Z: Ec2SetWallpaper: Could not get metadata for: meta-data/public-ipv4
Error in Aws Console is:
AWS::CloudFormation::WaitCondition : WaitCondition timed out. Received 0 conditions when expecting 1
I ran the same command inside the instance and it works. even I used this Userdata for windows server 2016 and it is working as well! So, I cloudnt undestand what is the problem! any suggestion?