DEV Community

Samarth Funde
Samarth Funde

Posted on

AI_ASSISTED_DEVOPS DAY-1

## Day1

Task : check the ec2 cpu optimization, memory optimization, disk optimization is healhty or not

Solution using AI Copilot:

Step 1) go in Github Account Create a Repositoy like 'Ai_Assisted_Devops_day1'

Step 2) Open Vs Code 'Install Copilot Extension Chat' open the terminal and write the command 'git clone githubrepourl'

Step 3) in the VS code just click the button 'ctrl+shift+i' you can see copilot is open

Step 4) in the copilot chat write this prompt *'Create a shell script where the script should analyze the health of the virtual machine based on CPU, memory, and disk space. If any of these three things are less than 60 percent utilized, the script declares the state of the VM as healthy. Whereas if any of these parameters are more than 60 percent, the script declares the health as not healthy. Also, the script should support a command-line argument named "explain". When passed, the script should explain the reason for the health status along with printing the health status. Target virtual machines are always ubuntu' *

Step 5) you can see shell file is created and all process output is generated

Step 6) you can check file code otherwise see the left menu and click on 'Source Control' icon and you can see the Commit button so write a some commit message and click on 'Commit' button

Step 7) go in Github Account and refresh the page and you get your shell file inside the repository so copy that repo code

Step 8) open the AWS Console and launch the EC2 instance

Step 9) login your instance with terminal or click on connect button.... and make a folder like 'Ai_Assited_Devops_Day1' and write the command inside this folder 'git clone github-repourl'

Step 10) and give the permission to the shell file for the execution so write the command 'chmod +x shellfilename' and './shellfilename'
and here you can see your output 'Healthy or Not'

.........................................................................................................

Top comments (0)