vi_ral
vi_ral

Reputation: 369

Cant view downloaded file in cloudformation

Im trying to download a file using wget using Cloudformation. However, I dont see the file in the directory I downloaded it to ( /home/ubuntu/). Ive also tried different things like creating directories in /home/ubuntu but I also dont see the created directory

The following is the portition of the cloudformation code I am having trouble with. Lets assume that I am calling these commands correctly with cfn-init. I see the user data execute the cfn-init command but I dont see the files.

I wget the file and put it into /home/ubuntu/odbc_connector.tar.gz. When I go onto the server I do not find the file.

Instance:
        Type: AWS::EC2::Instance
        Metadata:
          AWS::CloudFormation::Init:
            configSets:
              Instance_install:
                # Install ODBC connector / pyodbc
                - setup_pyodbc
            setup_pyodbc:
              commands:
                # Install ODBC connector
                download_connector:
                    command: wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.19-linux-ubuntu18.04-x86-64bit.tar.gz -O /home/ubuntu/odbc_connector.tar.gz

Upvotes: 0

Views: 269

Answers (2)

Marcin
Marcin

Reputation: 238249

Your wget command should be:

wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.19-linux-ubuntu18.04-x86-64bit.tar.gz  -O /home/ubuntu/odbc_connector.tar.gz

There may be other issues, that fail in your template, but you should still correct your wget command.

Upvotes: 1

ohiodn8
ohiodn8

Reputation: 46

You can use the below command to debug the issue. You'll have to go into the instance =>

cat /var/log/cloud-init-output.log - to check cf error
cat /var/lib/cloud/instance/scripts/part-001 - to view script

The cloud-init-output.log should tell you why the command didn't run

Upvotes: 0

Related Questions