shubham kamboj
shubham kamboj

Reputation: 109

Not able to run command in Userdata with cloud-formation

"AppLaunchConfig": {
            "Type": "AWS::AutoScaling::LaunchConfiguration",
            "Properties": {
                "AssociatePublicIpAddress": true,
                "EbsOptimized": false,
                "ImageId": {
                    "Ref": "amiID"
                },
                "InstanceType": "t3.small",
                "UserData"       : { "Fn::Base64" : { "Fn::Join" : ["", [
                    "#!/bin/bash -xe\n",
                   "har-extractor /home/ubuntu/work/git.codavel.com.har --output /home/ubuntu/extract/\n"
                     ]]
                   }
                },
                "SecurityGroups": [
                    {
                        "Ref": "InstanceSecGroup"
                    }
                ],
            }
            },

Hi Team, This is my cloud-formation template for auto-scaling and it is working properly but the thing is I am running one command in Userdata that is not working. I have tried every possible thing but didn't work at all. And If I am running this manually this command is working. So please help me out in this how will I resolve this issue. I am running this command on Ubuntu machine.

Upvotes: 0

Views: 337

Answers (1)

Chris Williams
Chris Williams

Reputation: 35188

You can debug this by taking a look at the /var/log/cloud-init-output.log file which contains the output for your Linux Userdata commands.

If this does not provide any useful debug, the next necessary step would be try running the command as root which mimics exactly what the functionality carries out.

Upvotes: 2

Related Questions