how to echo commands executed by cfn-init ?

0

Hi,

I have an AWS::CloudFormation::Init section and a configSet containing a config key with some commands, one failed for a shell syntax issue but I did not find the problem and I would like to show the command executed by cfn-init.

Cfn-init logs are in the /var/log folder, the -v option prints the command outputs in the log files cfn-init-cmd.log or cfn-init-cmd.log but these files do not contain the commands executed.

Is there a way to display executed commands?

Sincerly

已提問 10 個月前檢視次數 475 次
1 個回答
0

How about "echo `command` >> text.txt" to describe the result of the command execution?

profile picture
專家
已回答 10 個月前
  • my point is to have somewhere the command executed by cfn-init. Two examples.

    If the command written in the stack file is "curl -k -s --request GET --header \"PRIVATE-TOKEN= qqqqq\" --url '<one url>' I would like to get in the log the command : curl -k -s --request GET --header "PRIVATE-TOKEN= qqqqq" --url '<one url> ' (back slash are removed)

    If the command written in the stack file is { "Fn::Join" : ["", [ "curl -k --request POST --header 'PRIVATE-TOKEN: D77KrrH6YqkOzTTFr7Wq-' "," -F 'title=name' ", "-F 'key=", { "Ref" : "aParam" },"'", " --url ' <one url' "]]} I would like to get in the log the result of Fn::join with the parameter value.

    So I do not think that echo could help me but tell me if I am wrong.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南