aws-samples / aws-lambda-lifecycle-hooks-function

Using Auto Scaling lifecycle hooks, Lambda, and EC2 Run Command
Apache License 2.0
102 stars 61 forks source link

Document fails to run on instances in my ASG #9

Closed matrix200 closed 6 years ago

matrix200 commented 6 years ago

The output is the following: /var/lib/amazon/ssm/i-0218f07a048432379/document/orchestration/2b726580-1b70-4f9e-8273-216627e6e45d/awsrunShellScript/0.awsrunShellScript/_script.sh: 8: /var/lib/amazon/ssm/i-0218f07a048432379/document/orchestration/2b726580-1b70-4f9e-8273-216627e6e45d/awsrunShellScript/0.awsrunShellScript/_script.sh: Bad substitution failed to run commands: exit status 2

matrix200 commented 6 years ago

Just to clarify, I should try to run the document on an instance similar to those in my ASG, but not part of ASG? Would it help if I pasted the document here with the appropriate changes to reflect my environment?

matrix200 commented 6 years ago

OK I think I am getting somewhere. As it turns out, I am missing aws cli on the machines in question. So apparently in order for the document to work, the script it creates depends on aws binary?

diegonat commented 6 years ago

yes because it uses AWS CLI to upload the files. Thanks for letting me know!

matrix200 commented 6 years ago

Well, I managed to make the script work (ok partly) without the aws. I removed all references to aws binary and instead put a long sleep in the lambda function prior to terminating the hook from there (added terminate hook api call right after final success msg).