Skip to content

Instantly share code, notes, and snippets.

@mmansoor
Last active December 4, 2020 04:47
Show Gist options
  • Save mmansoor/af19835c5ef4ac121ac1cce875353848 to your computer and use it in GitHub Desktop.
Save mmansoor/af19835c5ef4ac121ac1cce875353848 to your computer and use it in GitHub Desktop.
#!/bin/bash
sudo yum update -y
amazon-linux-extras install -y nginx1.12
sudo systemctl start nginx
sudo systemctl enable nginx
usermod -a -G nginx-user ec2-user
chown -R ec2-user:nginx-user /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} \;
find /var/www -type f -exec chmod 0664 {} \;
TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/local-ipv4 > /usr/share/nginx/html/ready.html
yum -y install ruby
cd /tmp
wget https://aws-codedeploy-us-east-2.s3.amazonaws.com/latest/install;
chmod +x ./install
./install auto
sudo service codedeploy-agent start
sudo systemctl enable codedeploy-agent.service
sudo yum install -y awslogs
sudo systemctl start awslogsd
sudo systemctl enable awslogsd.service
sudo yum install -y python
sudo yum install -y python-pip python-wheel
sudo pip install certbot-nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment