-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_data.sh
More file actions
25 lines (19 loc) · 755 Bytes
/
Copy pathuser_data.sh
File metadata and controls
25 lines (19 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/bash
set -e
#Parameter.. harap diganti
# ssm_cloudwatch_config="master_cloudwatch_config"
# Ouput all log
# exec > >(tee /var/log/user-data.log|logger -t user-data-extra -s 2>/dev/console) 2>&1
# Make sure we have all the latest updates when we launch this instance
sudo apt-get update -y
sudo apt-get install collectd -y
sudo apt-get upgrade -y
# Configure Cloudwatch agent
sudo wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
sudo dpkg -i -E ./amazon-cloudwatch-agent.deb
# Use cloudwatch config from SSM
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl \
-a fetch-config \
-m ec2 \
-c ssm:${ssm_cloudwatch_config} -s
echo 'Done initialization'