Skip to content

Commit 3d513a9

Browse files
committed
Base. Moved configuration of CloudWatch Agent to the end of user-data scrt
1 parent c02b543 commit 3d513a9

File tree

1 file changed

+8
-8
lines changed
  • lib/base/lib/assets/user-data

1 file changed

+8
-8
lines changed

lib/base/lib/assets/user-data/node.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,6 @@ echo "Downloading assets zip file"
6666
aws s3 cp $ASSETS_S3_PATH ./assets.zip
6767
unzip -q assets.zip
6868

69-
echo 'Configuring CloudWatch Agent'
70-
cp /opt/cw-agent.json /opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json
71-
72-
echo "Starting CloudWatch Agent"
73-
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
74-
-a fetch-config -c file:/opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json -m ec2 -s
75-
systemctl status amazon-cloudwatch-agent
76-
7769
echo 'Uninstalling AWS CLI v1'
7870
yum remove awscli
7971

@@ -295,6 +287,14 @@ lsblk -d
295287
chown -R bcuser:bcuser /data
296288
chmod -R 755 /data
297289

290+
echo 'Configuring CloudWatch Agent'
291+
cp /opt/cw-agent.json /opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json
292+
293+
echo "Starting CloudWatch Agent"
294+
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
295+
-a fetch-config -c file:/opt/aws/amazon-cloudwatch-agent/etc/custom-amazon-cloudwatch-agent.json -m ec2 -s
296+
systemctl restart amazon-cloudwatch-agent
297+
298298
if [ "$RESTORE_FROM_SNAPSHOT" == "false" ]; then
299299
echo "Skipping restoration from snapshot. Starting node"
300300
systemctl daemon-reload

0 commit comments

Comments
 (0)