Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
Created January 17, 2020 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthuralvim/9bb0f645a3055548cd9102c3a7b45e41 to your computer and use it in GitHub Desktop.
Save arthuralvim/9bb0f645a3055548cd9102c3a7b45e41 to your computer and use it in GitHub Desktop.
AWS EC2 Setup (Amazon Linux 2)
#!/bin/bash
sudo yum update
# AWS Monitoring Tool (Matches perfectly with an Instance)
sudo yum install -y perl-Switch perl-DateTime perl-Sys-Syslog perl-LWP-Protocol-https perl-Digest-SHA.x86_64
cd /home/ec2-user
curl https://aws-cloudwatch.s3.amazonaws.com/downloads/CloudWatchMonitoringScripts-1.2.2.zip -O
unzip CloudWatchMonitoringScripts-1.2.2.zip
rm CloudWatchMonitoringScripts-1.2.2.zip
(crontab -l 2>/dev/null; echo "*/5 * * * * /home/ec2-user/aws-scripts-mon/mon-put-instance-data.pl --mem-used-incl-cache-buff --mem-util --disk-space-util --disk-path=/ --from-cron") | crontab -
# Docker, Git, Python, Nginx
sudo yum install -y nginx httpd httpd-tools docker git python34 python34-pip
sudo usermod -a -G docker ec2-user
sudo usermod -a -G nginx ec2-user
sudo curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment