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
gefragt vor 6 Monaten348 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
EXPERTE
beantwortet vor 6 Monaten
profile pictureAWS
EXPERTE
überprüft vor 6 Monaten
  • Okay, I'll try it, thank you

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen