How to non-interactively install and configure the CloudWatch Logs agent on an EC2 Ubuntu instance using a shell script?

1

I used the "-n" parameter in the command line and shell script to install the awslos agent non-interactively, but the error "ERROR: Missing required arguments. Please run with --help for details."

sudo python2 awslogs-agent-setup.py -n --region us-gov-west-1

Please tell me how to complete the non-interactive installation process in a shell script, otherwise the software cannot be installed automatically.

DD-Boom
질문됨 6달 전348회 조회
1개 답변
0
수락된 답변

Hello.

If you use the "-n" option, you must specify the configuration file using the "-c" option.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/EC2NewInstanceCWL.html

#!/bin/bash
curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O
chmod +x ./awslogs-agent-setup.py
./awslogs-agent-setup.py -n -r us-east-1 -c s3://DOC-EXAMPLE-BUCKET1/my-config-file

Additionally, since the CloudWatch Logs agent is being deprecated, we recommend using the CloudWatch Agent to configure log output settings.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/download-cloudwatch-agent-commandline.html#download-CloudWatch-Agent-on-EC2-Instance-commandline-first

profile picture
전문가
답변함 6달 전
profile pictureAWS
전문가
검토됨 6달 전
  • Okay, I'll try it, thank you

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠