Posts

Showing posts from May, 2016

Frequently update the AMI or Instance-Type in AWS Autoscaling group

If your instances running under AWS autoscaling, then instances will always use the same AMI or Instance-Type which configured in launch configuration. If you installed new packages or did any changes in instance root volume, then you need to take new AMI from that instance[root volume] and need to update that AMI in Autoscaling group[using launch configuration]. But it will require many manual steps. So I created a Bash script and it will do that task automatically. Example 1:- If you want to just update the AMI in Autoscaling group, run the script like below. #./script.sh <Autoscaling Group Name>  <Launch Configuration Name>  <AWS Region> Example 2:- If you want to  update both instance type and AMI in Autoscaling group, run the script like below. #./script.sh <Autoscaling Group Name>  <Launch Configuration Name>  <AWS Region>  <Instance Type> ==================================== #!/bin/bash Autos...

Very Good Tutorial To Learn Git

https://www.atlassian.com/git/ tutorials/what-is-version- control

Bash Script to find the exact application or command which consumed high CPU and Memory

#!/bin/bash #loadavg=$(awk '{ print $1 "\t" $2 "\t" $3 }' /proc/loadavg ) #To find the exact memory used percentage[Used-(Cached+Buffer)] Memusage=$(printf '%.0f\n' `free | awk 'FNR == 3{print $3/($3+$4)*100}'`) now=$(date +"%Y-%m-%d %H:%M:%S") #To find the cpu load average cpu_load=$(printf '%.0f\n' `uptime | awk '{print $(NF-2)}' | cut -c1-4`) if [ "$cpu_load" -ge "25" ] || [ "$Memusage" -ge "50" ];then   echo -e "\n\n=================\t$now\t========================" >> /var/log/top_report   top -b -c -n1 >> /var/log/top_report fi