File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -142,13 +142,23 @@ nohup bash -c "
142142# Configure CloudWatch Logs if a log group is specified
143143if [ " $cloudwatch_logs_group " != " " ]; then
144144 log " Installing CloudWatch agent"
145+
146+ # Detect architecture for CloudWatch agent
147+ ARCH=$( uname -m)
148+ if [ " $ARCH " = " aarch64" ] || [ " $ARCH " = " arm64" ]; then
149+ CW_ARCH=" arm64"
150+ else
151+ CW_ARCH=" amd64"
152+ fi
153+
145154 if command -v dpkg > /dev/null 2>&1 ; then
146155 wait_for_dpkg_lock
147- wget -q https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64 /latest/amazon-cloudwatch-agent.deb
156+ wget -q https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/${CW_ARCH} /latest/amazon-cloudwatch-agent.deb
148157 dpkg -i -E ./amazon-cloudwatch-agent.deb
149158 rm amazon-cloudwatch-agent.deb
150159 elif command -v rpm > /dev/null 2>&1 ; then
151- wget -q https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
160+ # Note: For RPM-based systems, the path structure might differ
161+ wget -q https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/${CW_ARCH} /latest/amazon-cloudwatch-agent.rpm
152162 rpm -U ./amazon-cloudwatch-agent.rpm
153163 rm amazon-cloudwatch-agent.rpm
154164 fi
You can’t perform that action at this time.
0 commit comments