user_data_part1.sh 904 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash -v
  2. yum update -y
  3. yum install git -y
  4. yum install python3 -y
  5. pip3 install boto3
  6. # Setup BBR
  7. echo "Setup BBR"
  8. cat <<EOF>> /etc/sysconfig/modules/tcpcong.modules
  9. #!/bin/bash
  10. exec /sbin/modprobe tcp_bbr >/dev/null 2>&1
  11. exec /sbin/modprobe sch_fq >/dev/null 2>&1
  12. EOF
  13. chmod 755 /etc/sysconfig/modules/tcpcong.modules
  14. echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.d/00-tcpcong.conf
  15. modprobe tcp_bbr
  16. modprobe sch_fq
  17. sysctl -w net.ipv4.tcp_congestion_control=bbr
  18. # Install CW Agent
  19. echo "Install CW Agent"
  20. wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm
  21. rpm -U ./amazon-cloudwatch-agent.rpm
  22. # Add to startup
  23. echo "/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/root/cw-agent-config.json -s" >> /etc/rc.local
  24. # Create CWAgent config file
  25. cat <<EOF>> /root/cw-agent-config.json