Awslogs-agent-setup.py not working on Ubuntu 17.10 (tricky)

This works fine on ubuntu 16.04, but not on 17.10

+ curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0^M100 56093 100 56093 0 0 56093 0 0:00:01 --:--:-- 0:00:01 98929 + chmod +x ./awslogs-agent-setup.py + ./awslogs-agent-setup.py -n -c /etc/awslogs/awslogs.conf -r us-west-2 Step 1 of 5: Installing pip ...^[[0mlibyaml-dev does not exist in system ^[[0m^[[92mDONE^[[0m Step 2 of 5: Downloading the latest CloudWatch Logs agent bits ... ^[[0mTraceback (most recent call last): File "./awslogs-agent-setup.py", line 1317, in <module> main() File "./awslogs-agent-setup.py", line 1313, in main setup.setup_artifacts() File "./awslogs-agent-setup.py", line 858, in setup_artifacts self.install_awslogs_cli() File "./awslogs-agent-setup.py", line 570, in install_awslogs_cli subprocess.call([AWSCLI_CMD, 'configure', 'set', 'plugins.cwlogs', 'cwlogs'], env=DEFAULT_ENV) File "/usr/lib/python2.7/subprocess.py", line 168, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 390, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1025, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory 

I noticed that earlier in the process, in the AWS template, he was unable to install libyaml-dev, but not sure if this is the only problem.

+1
source share
2 answers

Always find the answer immediately after posting it ...

Here is my modified CF template command:

  050_install_awslogs: command: !Sub "/bin/bash -x\n exec >>/var/log/cf_050_install_awslogs.log 2>&1 \n echo 050_install_awslogs...\n set -xe\n # Get the CloudWatch Logs agent\n mkdir /opt/awslogs\n cd /opt/awslogs\n # Needed for python3 in 17.10\n apt-get install -y libyaml-dev python-dev \n pip3 install awscli-cwlogs\n # avoid it complaining about not having /var/awslogs/bin/aws binary\n if [ ! -d /var/awslogs/bin ] ; then\n mkdir -p /var/awslogs/bin\n ln -s /usr/local/bin/aws /var/awslogs/bin/aws\n fi\n curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O\n chmod +x ./awslogs-agent-setup.py\n # Hack for python 3.6 & old awslogs-agent-setup.py\n sed -i 's/3,6/3,7/' awslogs-agent-setup.py\n ./awslogs-agent-setup.py -n -c /etc/awslogs/awslogs.conf -r ${AWS::Region}\n echo 050_install_awslogs end\n " 

Not quite sure if dir needs to be created, but I expect this to be a temporary case that will be resolved soon, since python 3.6 compatibility check still needs to be faked.

it can be installed using python 2.7, but it was like returning at this point, since my rationale for 17.10 was python 3.6.

Credit for the yaml idea and the idea of โ€‹โ€‹creating dir https://forums.aws.amazon.com/thread.jspa?threadID=265977 , but I prefer to avoid easy_install.

+2
source

I had a similar problem in Ubuntu 18.04.

In my case, the AWS instruction for offline installation worked .

 To download and run it standalone, use the following commands and follow the prompts: curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/AgentDependencies.tar.gz -O tar xvf AgentDependencies.tar.gz -C /tmp/ sudo python ./awslogs-agent-setup.py --region us-east-1 --dependency-path /tmp/AgentDependencies 
0
source

Source: https://habr.com/ru/post/1014636/


All Articles