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

asked 10 months ago440 views
1 Answer
0

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

profile picture
EXPERT
answered 10 months ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions