From a12ca337dfeb319fcfab8b71317cecd6939dfe84 Mon Sep 17 00:00:00 2001 From: Nikolay Vlasov Date: Fri, 23 Aug 2024 15:52:26 +1000 Subject: [PATCH] BSC Moved CloudWatch configuration closer to the end of the user-data script --- lib/bsc/lib/assets/user-data/node.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/bsc/lib/assets/user-data/node.sh b/lib/bsc/lib/assets/user-data/node.sh index 2fe8de2..f1460ef 100644 --- a/lib/bsc/lib/assets/user-data/node.sh +++ b/lib/bsc/lib/assets/user-data/node.sh @@ -49,14 +49,6 @@ echo "Downloading assets zip file" aws s3 cp $ASSETS_S3_PATH ./assets.zip --region $AWS_REGION unzip -q assets.zip -echo 'Configuring CloudWatch Agent' -cp /opt/cw-agent.json /opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json - -echo "Starting CloudWatch Agent" -/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \ --a fetch-config -c file:/opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json -m ec2 -s -systemctl status amazon-cloudwatch-agent - aws configure set default.s3.max_concurrent_requests 50 aws configure set default.s3.multipart_chunksize 256MB @@ -199,6 +191,14 @@ fi chown bcuser:bcuser -R /data +echo 'Configuring CloudWatch Agent' +cp /opt/cw-agent.json /opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json + +echo "Starting CloudWatch Agent" +/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \ +-a fetch-config -c file:/opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json -m ec2 -s +systemctl status amazon-cloudwatch-agent + sudo systemctl daemon-reload sudo systemctl enable --now bsc