Skip to content

Instantly share code, notes, and snippets.

@BielosX
Created September 16, 2022 08:07
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 BielosX/89c1d4272c7b9afe452317ed04dcf268 to your computer and use it in GitHub Desktop.
Save BielosX/89c1d4272c7b9afe452317ed04dcf268 to your computer and use it in GitHub Desktop.
#!/bin/bash
amazon-linux-extras install epel -y
yum -y update
yum -y install nginx
yum -y install python3
yum -y install python3-pip
yum -y install ruby
yum -y install wget
yum -y install curl
yum -y install jq
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
INSTANCE_IDENTITY=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/dynamic/instance-identity/document)
REGION=$(jq -r '.region' <<< "$INSTANCE_IDENTITY")
curl https://raw.githubusercontent.com/fluent/fluent-bit/master/install.sh | sh
mkdir -p /etc/fluent-bit/fluent-bit.conf.d
cp /tmp/fluent-bit.conf /etc/fluent-bit
cp /tmp/fluent-bit-init.service /usr/lib/systemd/system
cp /tmp/fluent-bit-init.sh /opt
chmod +x /opt/fluent-bit-init.sh
mkdir -p /usr/lib/systemd/system/fluent-bit.service.d
cat <<EOT > /usr/lib/systemd/system/fluent-bit.service.d/00_env.conf
[Service]
EnvironmentFile=/etc/fluent-bit/variables.env
EOT
systemctl enable fluent-bit
systemctl enable fluent-bit-init
adduser app --user-group
adduser proxy --user-group
mkdir -p /home/proxy/logs
pip3 install virtualenv
pip3 install boto3
CODE_DEPLOY_URL="https://aws-codedeploy-$REGION.s3.$REGION.amazonaws.com/latest/install"
wget "$CODE_DEPLOY_URL"
chmod +x ./install
./install auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment