<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shahin Sheikh</title>
    <description>The latest articles on DEV Community by Shahin Sheikh (@shahin1337).</description>
    <link>https://dev.to/shahin1337</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3170526%2F5b3355fa-13c1-4af8-9862-df2052f2d5d3.PNG</url>
      <title>DEV Community: Shahin Sheikh</title>
      <link>https://dev.to/shahin1337</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shahin1337"/>
    <language>en</language>
    <item>
      <title>How I deployed my first project for my devops portfolio: EC2 health check and monitoring and Conclusion</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Wed, 13 Aug 2025 07:05:21 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-ec2-health-check-and-monitoring-and-3lon</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-ec2-health-check-and-monitoring-and-3lon</guid>
      <description>&lt;p&gt;So this is the final part where I implement the monitoring of my instance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Aim of my monitoring
&lt;/h2&gt;

&lt;p&gt;I wanted to monitor my instances disk usage, cpu and ram.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thoughts and implementations of monitoring
&lt;/h2&gt;

&lt;p&gt;At first I thought of using garafana and prometheus for monitoring as I implemented it in my company. Even though I don't have much idea but very basics of how to collect metrics and view it in grafana dashboard. Then expose the service via guest user to the &lt;a href="http://www" rel="noopener noreferrer"&gt;www&lt;/a&gt;. I prepared node exporter into my dockerfiles in Database pod and both app pods and even one for the EC2 but then something struck my mind. &lt;strong&gt;WHY???&lt;/strong&gt; Why do I have to go this far to monitor. All I want is simple monitor the aim CPU, RAM and Disk usage that is all. Then I rolled back to unix commands and that was the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Commands I settled for
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; | &lt;span class="nb"&gt;tee &lt;/span&gt;test.txt
top &lt;span class="nt"&gt;-bn&lt;/span&gt; 1 | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'NR &amp;gt;= 1 &amp;amp;&amp;amp; NR &amp;lt; 6 {print}'&lt;/span&gt; | &lt;span class="nb"&gt;tee &lt;/span&gt;test.txt
mpstat &lt;span class="nt"&gt;-T&lt;/span&gt; | &lt;span class="nb"&gt;tee &lt;/span&gt;test.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes I know top command shows me the cpu but I just kept the mpstat just because I felt like having 2 cpu metrics that I can make an estimated average of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenge is to send myself the metrics
&lt;/h2&gt;

&lt;p&gt;I choose one by &lt;strong&gt;EMail&lt;/strong&gt;, &lt;strong&gt;SMS&lt;/strong&gt;, and in &lt;strong&gt;Discord channel&lt;/strong&gt;. First is I made a separate python script exclusively for discord. I made a virtual env using &lt;strong&gt;venv&lt;/strong&gt; module and pip installed &lt;strong&gt;discord-webhook&lt;/strong&gt; and created a webhook in my server and used the url and successfully sent the message.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivlj2atue6g4dz7fpmax.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fivlj2atue6g4dz7fpmax.png" alt="Discord webhook" width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When I first sent the message it was not exactly like this as I improved it once time went by.&lt;/p&gt;

&lt;h3&gt;
  
  
  Then I came across second challenge SMS and EMAIL
&lt;/h3&gt;

&lt;p&gt;At first I thought of having a personal smtp server and send it but then I found out it is blocked by all ISPS across the world to prevent spams then I thought of a service that does the very same thing &lt;strong&gt;SNS&lt;/strong&gt;. I watched the web and created a basic SNS topic from dashboard and created a mail subscription and an SMS and published messages and wallah as it is working I quickly terraformed it.&lt;br&gt;
Second challenge is to now publish a message from the EC2 instance.&lt;br&gt;
I came across this &lt;a href="https://rollout.com/integration-guides/aws-sns/sdk/step-by-step-guide-to-building-a-aws-sns-api-integration-in-python" rel="noopener noreferrer"&gt;website&lt;/a&gt; and wrote the initial script in python with the access keys in it for the testing and it was working fine. Then I created a role manually and assigned it to the instance and then tried it without the access keys and it was working fine again. The &lt;strong&gt;Snag&lt;/strong&gt; is that when I did it using terraform it wasn't reflecting in the EC2 instance. Thing is after making the role I couldn't assign the role in EC2 from the console. So I went on the hunt why it was not working via terraform and working if created manually via dashboard. Upon inspection of both the roles side by side I saw something different from the dashboard created one with terraform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5e2l456khnitvc5bin6y.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5e2l456khnitvc5bin6y.PNG" alt="ARN of dashboard created role" width="800" height="304"&gt;&lt;/a&gt;&lt;br&gt;
I saw &lt;strong&gt;instance-profile/RoleName&lt;/strong&gt; and terrafrom created &lt;strong&gt;role/RoleName&lt;/strong&gt; at the ARN. Now I understood that I merely created normal role profile, but I need to assign an &lt;code&gt;instance-profile&lt;/code&gt; to it and hence the hunt begun and I modified my terraform for it and it worked like a charm this time.&lt;/p&gt;

&lt;p&gt;I made a custom policy using &lt;a href="https://awspolicygen.s3.amazonaws.com/policygen.html" rel="noopener noreferrer"&gt;aws official policy generator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;main.tf&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ----------------------IAM ROLES &amp;amp; POLICIES ----------------&lt;/span&gt;

&lt;span class="c1"&gt;# AWS IAM role creation&lt;/span&gt;
&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_policy_document"&lt;/span&gt; &lt;span class="s2"&gt;"assume_role"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;statement&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;effect&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;

    &lt;span class="nx"&gt;principals&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;type&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Service"&lt;/span&gt;
      &lt;span class="nx"&gt;identifiers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ec2.amazonaws.com"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nx"&gt;actions&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sts:AssumeRole"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# AWS IAM role creation completed&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_role"&lt;/span&gt; &lt;span class="s2"&gt;"sns-trigger-ec2"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;               &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"EC2snsPublish"&lt;/span&gt;
  &lt;span class="nx"&gt;assume_role_policy&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_iam_policy_document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;assume_role&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Policy creation in json&lt;/span&gt;
&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_policy_document"&lt;/span&gt; &lt;span class="s2"&gt;"sns-publish-policy"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;statement&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;effect&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow"&lt;/span&gt;
    &lt;span class="nx"&gt;actions&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"sns:Publish"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nx"&gt;resources&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="s2"&gt;"arn:aws:sns:ap-south-1:058264131778:ec2-health-topic-email"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="s2"&gt;"arn:aws:sns:ap-south-1:058264131778:ec2-health-topic-sms"&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Policy creation getting in json&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_policy"&lt;/span&gt; &lt;span class="s2"&gt;"sns-publish-policy"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt;        &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"sns-publish-policy"&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"SNS Publish only policy"&lt;/span&gt;
  &lt;span class="nx"&gt;policy&lt;/span&gt;      &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_iam_policy_document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sns-publish-policy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Attach the newly created policy to the newly created IAM role&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_role_policy_attachment"&lt;/span&gt; &lt;span class="s2"&gt;"sns-policy-attach"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;role&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_iam_role&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sns-trigger-ec2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
  &lt;span class="nx"&gt;policy_arn&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_iam_policy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sns-publish-policy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arn&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Create an instance profile for the IAM role&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_iam_instance_profile"&lt;/span&gt; &lt;span class="s2"&gt;"sns-policy-attach"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ec2_instance_profile"&lt;/span&gt;
  &lt;span class="nx"&gt;role&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_iam_role&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sns-trigger-ec2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# -----------------------------------------------------------&lt;/span&gt;

&lt;span class="c1"&gt;# SNS Topic creation and customization&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_sns_topic"&lt;/span&gt; &lt;span class="s2"&gt;"user_updates_email"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ec2-health-topic-email"&lt;/span&gt;
  &lt;span class="nx"&gt;display_name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"EC2 Health topic email"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;#resource "aws_sns_topic" "user_updates_sms" {&lt;/span&gt;
&lt;span class="c1"&gt;#  name = "ec2-health-topic-sms"&lt;/span&gt;
&lt;span class="c1"&gt;#  display_name = "EC2 Health topic sms"&lt;/span&gt;
&lt;span class="c1"&gt;#}&lt;/span&gt;

&lt;span class="c1"&gt;# Creating subscription&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_sns_topic_subscription"&lt;/span&gt; &lt;span class="s2"&gt;"user_update_email"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;topic_arn&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_sns_topic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user_updates_email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arn&lt;/span&gt;
    &lt;span class="nx"&gt;protocol&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"email"&lt;/span&gt;
    &lt;span class="nx"&gt;endpoint&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"------@gmail.com"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;#resource "aws_sns_topic_subscription" "user_update_sms"{&lt;/span&gt;
&lt;span class="c1"&gt;#    topic_arn = aws_sns_topic.user_updates_sms.arn&lt;/span&gt;
&lt;span class="c1"&gt;#    protocol = "sms"&lt;/span&gt;
&lt;span class="c1"&gt;#    endpoint = "+91-------"&lt;/span&gt;
&lt;span class="c1"&gt;#}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final part
&lt;/h2&gt;

&lt;p&gt;I created a python script which creates the body and using webhook to send the message to discord channel of mine and one EMAIL to me via SNS and all run using virtual env and cronjobed it.&lt;/p&gt;

&lt;p&gt;healthupdate.py&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;system&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;discord_webhook&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DiscordWebhook&lt;/span&gt;

&lt;span class="c1"&gt;# Utility class
&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="n"&gt;commands&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;diskformat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;df -h | tee test.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpuram&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;top -bn 1 | awk &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;NR &amp;gt;= 1 &amp;amp;&amp;amp; NR &amp;lt; 6 {print}&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; | tee test.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mpstat -T | tee test.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;removetemp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rm temp.txt test.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;


    &lt;span class="n"&gt;filename&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;temp.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;test.txt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;getmessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="nf"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

      &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

      &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;w&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;```

&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;

```&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

      &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;r&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

      &lt;span class="nf"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;removetemp&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="k"&gt;pass&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;# aws SNS
&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SNS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sns_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sns&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;publishmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sns_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TopicArn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arn:aws:sns:ap-south-1:058264131778:ec2-health-topic-email&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;publishsms&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sns_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TopicArn&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;arn:aws:sns:ap-south-1:058264131778:ec2-health-topic-sms&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;# Discord Webhook
&lt;/span&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Discord&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;DWebhook&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webhookurl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DWebhook&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;uname&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;uname&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webhook&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DiscordWebhook&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webhookurl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;username&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;uname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;subject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Daily instance health check&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getmessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;diskformat&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**Disk Space data**&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getmessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpuram&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**Top command output**&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getmessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Utility&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;cpu&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="n"&gt;body&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**CPU data mpstat output**&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="c1"&gt;# Discord webhook triggers
&lt;/span&gt;&lt;span class="n"&gt;webhook&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Discord&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://discord.com/api/webhooks/1400674337966522399/gfdgdfgdgdfg----------yjfLwc&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;webhook&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trigger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;# Daily instance health check&lt;/span&gt;&lt;span class="se"&gt;\n\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Doctor CPU&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;# aws sns triggers
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SNS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;ap-south-1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;publishmail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subject&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8mis8b5f171yub7m4be.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe8mis8b5f171yub7m4be.PNG" alt="SNS EMAIL result" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I ended up removing SMS as EMAIL and discord is enough to have my eyes on it.&lt;/p&gt;

&lt;h1&gt;
  
  
  FAQ
&lt;/h1&gt;

&lt;p&gt;In this project of mine I used DB as pod not RDS. That must have been question of many.&lt;br&gt;
I used it as a pod because I wanted to understand cross pod communication as a developers perspective and also RDS is expensive for me currently. That is the reason why I didn't have the DB running in the Instance itself and choose the pod. &lt;/p&gt;

&lt;h1&gt;
  
  
  My Architecture evolution screenshots
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtdv3jpglx6gxnj1h9c3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjtdv3jpglx6gxnj1h9c3.jpg" alt=" " width="800" height="748"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zltzrlypzrohlzy1px5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6zltzrlypzrohlzy1px5.jpg" alt=" " width="800" height="572"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi4gvj8spy2kgobdjiwkz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fi4gvj8spy2kgobdjiwkz.jpg" alt=" " width="800" height="1117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Past 1.5 years of me planning and developing the project and its architectures was a journey to me. My experience across projects in my office, different architectures I changed my deployment architecture multiple times and each iteration was more improved one and many times I scrapped old architectures as I &lt;strong&gt;aimed to be able to set up the production as fast as possible and as automated as possible with minimal intervention of mine and if want new addition I can expand it without any problem&lt;/strong&gt;.&lt;br&gt;
I understood one thing while deploying and creating architecture. It is never about what top end tools we use or what top trending services we need. It all boils down to &lt;strong&gt;needs&lt;/strong&gt;. What and how the budget or the application will be running maybe a few change in app to be compatible with this style of deployment hence a lot of &lt;strong&gt;communication&lt;/strong&gt; between teams. Sometimes a legacy tool can help a lot with automation.&lt;br&gt;
I could be wrong about many things here since this is my first company and my first experience in this field but after all I went through in office and here I came to this conclusion for now.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>python</category>
      <category>terraform</category>
      <category>linux</category>
    </item>
    <item>
      <title>How I deployed my first project for my devops portfolio: Minikube and Deployment</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Tue, 05 Aug 2025 06:29:29 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-minikube-and-deployment-50kf</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-minikube-and-deployment-50kf</guid>
      <description>&lt;p&gt;OK, first before I begin, a lot of you may have a question in your mind. Why did I choose the minikube instead of EKS or just spin up the container using docker compose and be done with it. Well I have thought of very same thing at the very beginning. Hell I even thought of like just running my projects in simple container in EC2 and host a static S3 website. Then questions came to my mind like what if due to a bug in programming (Which there is since I just wanted to host project so I skipped the code safety) which can break the code and stop the container? Then I have to manually ssh it to start it and I wont be home forever to do it. Sure I can have a periodic health check for the responses using cronjob and if not found then spin it up again. It will take a bit of scripting but what if I have the ability like kubernetes which just spins it up as it goes down. There I decided with minikube and it will help me with learning of kubernetes to.&lt;/p&gt;

&lt;h3&gt;
  
  
  The quest for running minikube successfully in EC2
&lt;/h3&gt;

&lt;p&gt;In my home environment I have it installed and ran it but there was a snag I saw. &lt;code&gt;minikube tunnel&lt;/code&gt; is the way to make the site accessible through any other device in my private network else it was only responding to &lt;code&gt;localhost:port&lt;/code&gt;. I thought of minikube tunnel in background, but what if it stops suddenly? I wanted something reliable.&lt;/p&gt;

&lt;p&gt;There I was thinking of how the communications are to be meant if it was a kubernetes. &lt;code&gt;Client --&amp;gt; EC2 ingress port ---&amp;gt; ingress routes to service ---&amp;gt; service routes to pods&lt;/code&gt;. In case of simple containers &lt;code&gt;Client ---&amp;gt; EC2 port ----&amp;gt; Container port binding there&lt;/code&gt;. &lt;br&gt;
In case of minikube with &lt;code&gt;minikube tunnel&lt;/code&gt; active what I guess I figured it out like &lt;code&gt;Client ---&amp;gt; EC2 ---&amp;gt; Minikube LoadBalancer IP &amp;lt;Minikube ip&amp;gt; ---&amp;gt; Ingress ---&amp;gt; Service ---&amp;gt; Pods&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Looking at this I figured if &lt;code&gt;tunnel&lt;/code&gt; does is bridges gap between the ingress (The minikube running on the mini ip what I say it) and localhost. So as I now had a good guess of the working I wanted to test it by needing a way to route traffic coming from outside to the &lt;code&gt;minikube ip&lt;/code&gt;. As I thought of this I remembered there is a term already for this thing, &lt;strong&gt;Reverse Proxy&lt;/strong&gt;. I immediately went for the nginx and made this configurations in &lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;    upstream backend_servers &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c"&gt;#server 10.110.163.66:8001;&lt;/span&gt;
        &lt;span class="c"&gt;#server 10.100.252.56:8002;&lt;/span&gt;
        server 192.168.49.2:80&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;

    server &lt;span class="o"&gt;{&lt;/span&gt;
        listen 80&lt;span class="p"&gt;;&lt;/span&gt;

        location / &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="c"&gt;#proxy_pass http://192.168.49.2:80;&lt;/span&gt;
            &lt;span class="c"&gt;#proxy_pass http://192.168.49.2:8080;&lt;/span&gt;
            &lt;span class="c"&gt;#proxy_pass http://localhost:8000;&lt;/span&gt;

             &lt;span class="c"&gt;#proxy_pass http://10.110.163.66:8001;&lt;/span&gt;
             &lt;span class="c"&gt;#proxy_pass http://192.168.49.2:80;&lt;/span&gt;

            &lt;span class="c"&gt;# load balancing method&lt;/span&gt;
             proxy_pass http://backend_servers&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wont be removing others, just keeping it raw just to show how I tested this by changing service ports in yaml files.&lt;/p&gt;

&lt;p&gt;However This very same configurations were not working when being deployed to EC2. I tried to narrow the problem down by using same method of communications simulations in brain and paper and even using AI. I came to a conclusion that maybe traffic routing is not working properly as &lt;code&gt;curl localhost&lt;/code&gt; was not working to. For this I went on a quest to learn &lt;strong&gt;iptables&lt;/strong&gt;, and &lt;a href="https://dev.to/netikras/iptables-a-beast-worth-training-netfilter-tables-and-chains-bj6"&gt;I found this incredible article here in dev&lt;/a&gt; and tried all shorts of stuff even though I understood little but yeah was going somewhere except the fact I was going nowhere. At that time I was reading about VPC, more accurately about &lt;strong&gt;NAT&lt;/strong&gt;, and I kind of got the idea that iptables or netfilter type stuff is implemented in it that's why it was once an EC2 before becoming fully managed service. Anyway coming back to the topic I went on nearly 2 weeks for this solution and later thought of changing to other reverse proxy service and decided to try on apache2 and wallah it worked in an instant in EC2, so I settled on it.&lt;br&gt;
&lt;code&gt;/etc/apache2/sites-available/000-default.conf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&amp;lt;VirtualHost &lt;span class="k"&gt;*&lt;/span&gt;:80&amp;gt;

    ProxyPreserveHost On

    &lt;span class="c"&gt;# Reverse proxy for the application running on port 3000 on the same server&lt;/span&gt;
    ProxyPass / http://192.168.49.2:80/
    ProxyPassReverse / http://192.168.49.2:80/
&amp;lt;/VirtualHost&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before doing this we need to run the two commands and need a systemctl restart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;a2enmod proxy
&lt;span class="nb"&gt;sudo &lt;/span&gt;a2enmod proxy_http
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Ingress snag
&lt;/h3&gt;

&lt;p&gt;This one is small but it took me 2 days to pin it down. When I had got my application running in minikube in EC2 I saw that two different pods taking same css path and this kind of making confusion as I had made file structure nearly same for html css but are in isolated environment only thing is ingress was routing wrong and later after one or two days I found out that &lt;strong&gt;in ingress we need to have the path written to the ingress else no connections will be formed&lt;/strong&gt;, same thing happened to my &lt;code&gt;/api&lt;/code&gt; path in my main application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Soo many times destroying and restarting EC2
&lt;/h2&gt;

&lt;p&gt;I have lost count on how many times I messed things up. Destroyed and recreated EC2 a lot many times. IaC is really something.&lt;br&gt;
My &lt;code&gt;main.tf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;module&lt;/span&gt; &lt;span class="s2"&gt;"key_pair"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;source&lt;/span&gt;             &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"terraform-aws-modules/key-pair/aws"&lt;/span&gt;
  &lt;span class="nx"&gt;key_name&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"project-solo"&lt;/span&gt;
  &lt;span class="nx"&gt;create_private_key&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# store &lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"local_file"&lt;/span&gt; &lt;span class="s2"&gt;"private_key_pem"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;content&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key_pair&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;private_key_pem&lt;/span&gt;
  &lt;span class="nx"&gt;filename&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;module}&lt;/span&gt;&lt;span class="s2"&gt;/project-solo.pem"&lt;/span&gt;
  &lt;span class="nx"&gt;file_permission&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0600"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# id would be aws_instance.my-first-terraform-ec2&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_instance"&lt;/span&gt; &lt;span class="s2"&gt;"my-first-terraform-ec2"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ami&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ami-0131b8f4c937c332f"&lt;/span&gt;           &lt;span class="c1"&gt;# debian arm64 ami&lt;/span&gt;
  &lt;span class="nx"&gt;instance_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"t4g.medium"&lt;/span&gt;
&lt;span class="c1"&gt;#  instance_type = "t4g.small"&lt;/span&gt;
  &lt;span class="nx"&gt;subnet_id&lt;/span&gt;               &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_default_subnet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;default&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_security_group_ids&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allow_tcp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

  &lt;span class="nx"&gt;key_name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key_pair&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key_pair_name&lt;/span&gt;

  &lt;span class="nx"&gt;iam_instance_profile&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ec2_instance_profile"&lt;/span&gt;

  &lt;span class="nx"&gt;user_data&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;base64encode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
              #!/bin/bash
              apt-get update

              # install kubectl
              curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
              sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

              # install minikube
              curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube-linux-arm64
              sudo install minikube-linux-arm64 /usr/local/bin/minikube &amp;amp;&amp;amp; rm minikube-linux-arm64

              # install docker
              sudo apt-get install ca-certificates curl
              sudo install -m 0755 -d /etc/apt/keyrings
              sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
              sudo chmod a+r /etc/apt/keyrings/docker.asc

              # Add the repository to Apt sources:
              echo \
                "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
                $(. /etc/os-release &amp;amp;&amp;amp; echo "$VERSION_CODENAME") stable" | \
                sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null
              apt-get update

              # install docker
              sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

              sudo apt install apache2 -y
              sudo systemctl enable apache2
              sudo systemctl start apache2

              alias k="kubectl"
&lt;/span&gt;&lt;span class="no"&gt;              EOF
&lt;/span&gt;  &lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Portfolio EC2"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# ebs root volume&lt;/span&gt;
  &lt;span class="nx"&gt;root_block_device&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;delete_on_termination&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="nx"&gt;volume_size&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;
    &lt;span class="nx"&gt;volume_type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"gp3"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c1"&gt;# going to use default vpc id&lt;/span&gt;
&lt;span class="c1"&gt;# The ID here becomes data.aws_vpc.default.id&lt;/span&gt;
&lt;span class="k"&gt;data&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc"&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# default subnet az1 i choose for my ec2&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_default_subnet"&lt;/span&gt; &lt;span class="s2"&gt;"default"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;availability_zone&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;local&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_az&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"indiaAZ1"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c1"&gt;# create a security group with default vpc ID&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_security_group"&lt;/span&gt; &lt;span class="s2"&gt;"allow_tcp"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"allow_tcp"&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Allow tcp inbound traffic"&lt;/span&gt;
  &lt;span class="nx"&gt;vpc_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_vpc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;default&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;

  &lt;span class="nx"&gt;tags&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"allow_tcp"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# ingress rule for tcp to port 22 from anywhere in the world for ssh&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc_security_group_ingress_rule"&lt;/span&gt; &lt;span class="s2"&gt;"allow_tcp_22_ipv4"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;security_group_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allow_tcp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_ipv4&lt;/span&gt;         &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;
  &lt;span class="nx"&gt;from_port&lt;/span&gt;         &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
  &lt;span class="nx"&gt;ip_protocol&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tcp"&lt;/span&gt;
  &lt;span class="nx"&gt;to_port&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;22&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# ingress rule for tcp to port 80 from anywhere in the world for nginx httpd 80&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc_security_group_ingress_rule"&lt;/span&gt; &lt;span class="s2"&gt;"allow_tcp_80_ipv4"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;security_group_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allow_tcp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_ipv4&lt;/span&gt;         &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;
  &lt;span class="nx"&gt;from_port&lt;/span&gt;         &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;
  &lt;span class="nx"&gt;ip_protocol&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"tcp"&lt;/span&gt;
  &lt;span class="nx"&gt;to_port&lt;/span&gt;           &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;80&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# an eggress rule to allow tcp from vm to the www&lt;/span&gt;
&lt;span class="k"&gt;resource&lt;/span&gt; &lt;span class="s2"&gt;"aws_vpc_security_group_egress_rule"&lt;/span&gt; &lt;span class="s2"&gt;"allow_all_traffic_ipv4"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;security_group_id&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;aws_security_group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;allow_tcp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;
  &lt;span class="nx"&gt;cidr_ipv4&lt;/span&gt;         &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"0.0.0.0/0"&lt;/span&gt;
  &lt;span class="nx"&gt;ip_protocol&lt;/span&gt;       &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"-1"&lt;/span&gt; &lt;span class="c1"&gt;# semantically equivalent to all ports&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Note: Ignore the VPC CIDR part as I was practicing VPC stuff using terraform and same vars file I used in my main.tf file
&lt;/h2&gt;

&lt;p&gt;My &lt;code&gt;vars.tf&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight terraform"&gt;&lt;code&gt;&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"aws_regions"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;india&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"ap-south-1"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;locals&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;aws_az&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;indiaAZ1&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_regions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"india"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;a"&lt;/span&gt;
        &lt;span class="nx"&gt;indiaAZ2&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_regions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"india"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;b"&lt;/span&gt;
        &lt;span class="nx"&gt;indiaAZ3&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;aws_regions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"india"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;c"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# CIDR array for vpc to be created for individual use&lt;/span&gt;
&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"vpc_cidr_individual"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;cidr1&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.1.0.0/16"&lt;/span&gt;
        &lt;span class="nx"&gt;cidr0&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.0.0/16"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"CIDR blocks of the vpc for individual use"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# CIDR array for subnet&lt;/span&gt;
&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"vpc_cidr_subnet"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;publicA&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.0.0/24"&lt;/span&gt;
        &lt;span class="nx"&gt;publicB&lt;/span&gt;     &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.1.0/24"&lt;/span&gt;
        &lt;span class="nx"&gt;privateA&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.16.0/20"&lt;/span&gt;
        &lt;span class="nx"&gt;privateB&lt;/span&gt;    &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.0.32.0/20"&lt;/span&gt;
        &lt;span class="nx"&gt;peerpublicA&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"10.1.0.0/24"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c1"&gt;# environment&lt;/span&gt;
&lt;span class="k"&gt;variable&lt;/span&gt; &lt;span class="s2"&gt;"environment"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;default&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Shahin"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One more thing when my EC2 starts up I need to use command &lt;code&gt;sudo usermod -aG docker $USER &amp;amp;&amp;amp; newgrp docker&lt;/code&gt; as I dunno why using it in user data script didn't seem to work. &lt;u&gt;If any of you know the reason please let me know in comments below, thank you&lt;/u&gt;.&lt;/p&gt;

&lt;p&gt;And after this step I run this command &lt;code&gt;minikube start --driver=docker &amp;amp;&amp;amp;kubectl create namespace static &amp;amp;&amp;amp;kubectl create namespace sololeveling &amp;amp;&amp;amp;minikube addons enable ingress&lt;/code&gt; and apache2 config for reverse prxy and my EC2 becomes ready for the github actions to ssh and apply the yaml and start the application. All that is left to update the secrets variable in my actions with the newly generated &lt;code&gt;.pem&lt;/code&gt; file.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>kubernetes</category>
      <category>terraform</category>
    </item>
    <item>
      <title>How I deployed my first project for my devops portfolio: CI/CD during development vs CI/CD while live</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Fri, 25 Jul 2025 08:41:20 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-cicd-during-development-vs-cicd-while-2n0h</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-cicd-during-development-vs-cicd-while-2n0h</guid>
      <description>&lt;h2&gt;
  
  
  CI/CD during development and CI/CD now during live
&lt;/h2&gt;

&lt;h3&gt;
  
  
  CI/CD setup during development
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;First&lt;/u&gt;&lt;/strong&gt; I setup my Jenkins. I didn't want to manually run jenkins every time I boot up my raspberry pi so I made a &lt;strong&gt;Custom Daemon Service&lt;/strong&gt; for it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[Unit]
Description=Jenkins
After=network.target

[Service]
Type=simple
User=&amp;lt;username&amp;gt;
Group=users
ExecStart=/home/&amp;lt;username&amp;gt;/jenkins/jdk-21.0.5/bin/java -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true -DJENKINS_HOME=/home/&amp;lt;username&amp;gt;/jenkins/.jenkins-config-new -jar /home/&amp;lt;username&amp;gt;/jenkins/jenkins.war
Restart=always

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then I &lt;code&gt;systemctl enabled&lt;/code&gt; and it was working fine. The &lt;code&gt;journalctl -xeu jenkins.service&lt;/code&gt; helped me to get the initial password as jenkins was starting the first time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Second&lt;/u&gt;&lt;/strong&gt; I have installed docker and docker-compose in my pi and using it I used to spin up the containers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Third&lt;/u&gt;&lt;/strong&gt; At first I used to checkout to local repo that I created using &lt;code&gt;git init --bare&lt;/code&gt; at my HDD but later shifted to github. This reason will explain the &lt;code&gt;Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true&lt;/code&gt; in the daemon service.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;u&gt;Fourth&lt;/u&gt;&lt;/strong&gt; I used custom database that I got from this &lt;a href="https://dev.mysql.com/doc/refman/9.4/en/binary-installation.html" rel="noopener noreferrer"&gt;mysql generic bianries&lt;/a&gt; instead of pulling the already present image at the dockerhub. Reason behind is that I wont be changing anything later and also I don't want to use the env line in compose at that time. All I wanted is just let the DB container get spunned up and all get ready so that is the reason why I customized it to my own liking.&lt;br&gt;
Here is the entrypoint script for the custom DB image I made.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;!&lt;/span&gt; /bin/bash

bin/mysqld &lt;span class="nt"&gt;--initialize-insecure&lt;/span&gt; &lt;span class="nt"&gt;--user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mysql &lt;span class="nt"&gt;--bind-address&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.0.0.0
bin/mysqld_safe &lt;span class="nt"&gt;--user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mysql &amp;amp;

&lt;span class="c"&gt;# waiting time for the mysql_safeto start&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="o"&gt;((&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;20&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nt"&gt;--i&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
    if&lt;/span&gt;&lt;span class="o"&gt;((&lt;/span&gt;i &lt;span class="o"&gt;==&lt;/span&gt; 0&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Starting Database..."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nb"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;fi

    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; &lt;span class="s2"&gt;"Starting Database in ...&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; sec [/] &lt;/span&gt;&lt;span class="se"&gt;\r&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;sleep &lt;/span&gt;0.2&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; &lt;span class="s2"&gt;"Starting Database in ...&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; sec [-] &lt;/span&gt;&lt;span class="se"&gt;\r&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;sleep &lt;/span&gt;0.2&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; &lt;span class="s2"&gt;"Starting Database in ...&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; sec [|] &lt;/span&gt;&lt;span class="se"&gt;\r&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;sleep &lt;/span&gt;0.2&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; &lt;span class="s2"&gt;"Starting Database in ...&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; sec [-] &lt;/span&gt;&lt;span class="se"&gt;\r&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;sleep &lt;/span&gt;0.2&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-ne&lt;/span&gt; &lt;span class="s2"&gt;"Starting Database in ...&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; sec [&lt;/span&gt;&lt;span class="se"&gt;\\&lt;/span&gt;&lt;span class="s2"&gt;] &lt;/span&gt;&lt;span class="se"&gt;\r&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;sleep &lt;/span&gt;0.2&lt;span class="p"&gt;;&lt;/span&gt;


&lt;span class="k"&gt;done

&lt;/span&gt;bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;--skip-password&lt;/span&gt;  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"ALTER USER 'root'@'localhost' IDENTIFIED BY '&amp;lt;password&amp;gt;';"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"UPDATE mysql.user SET Host = '%' WHERE User = 'root' AND Host = 'localhost';"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"FLUSH PRIVILEGES;"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"create database Users;"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Creating importance filler table"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"create table if not exists importance(class varchar(1) primary key not null, xp_gain double not null);"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Filling importance table"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"insert into importance values('S', 10);"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"insert into importance values('A', 8);"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"insert into importance values('B', 6);"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"insert into importance values('C', 4);"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"insert into importance values('D', 2);"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-D&lt;/span&gt; Users &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"insert into importance values('E', 1);"&lt;/span&gt;


&lt;span class="c"&gt;# start node exporter&lt;/span&gt;
&lt;span class="c"&gt;#./node_exporter --web.listen-address=:5000&lt;/span&gt;

&lt;span class="c"&gt;# to keep the container up and alive&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"DB server online..."&lt;/span&gt; | &lt;span class="nb"&gt;tee &lt;/span&gt;stay.txt
&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; stay.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here I got the snag of DB not connecting at localhost so upon scraping the web I found out that in mysql.user table in HOST there is something denied so that is the reason why I used this query below and it started working.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"UPDATE mysql.user SET Host = '%' WHERE User = 'root' AND Host = 'localhost';"&lt;/span&gt;
bin/mysql &lt;span class="nt"&gt;-u&lt;/span&gt; root &lt;span class="nt"&gt;-p&lt;/span&gt;&amp;lt;inline_password&amp;gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"FLUSH PRIVILEGES;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  CI/CD Workflow during development
&lt;/h4&gt;

&lt;p&gt;I made/added in my code then I pushed it to repo and using the jenkins pipeline I created it builds the images and then docker compose up it in the pipeline itself. Then I checked and repeated this entire process.&lt;/p&gt;

&lt;h3&gt;
  
  
  CI/CD Setup and Workflow as it is live
&lt;/h3&gt;

&lt;p&gt;As I was planning to set up some kind of CI/CD during this live as I want to put off some updates there and my plan was very tedious and time consuming like setting up jenkins there then after code push hit jenkins build and yada yada... I got introduced to github actions when I was searching for things like "How to trigger jenkins job as I push code to github repo". Man I loved the actions and implemented it in my git repo.&lt;/p&gt;

&lt;p&gt;I currently have two branches, one main and one website. Main has my project and website has my personal website &lt;a href="http://shahin.zita.click/Shahin" rel="noopener noreferrer"&gt;http://shahin.zita.click/Shahin&lt;/a&gt; with both having .github/workflows/.yaml each. I did used the if condition &lt;code&gt;if: github.ref == 'refs/heads/&amp;lt;branch_name&amp;gt;'&lt;/code&gt; to run only specific yaml for the branch.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Snag&lt;/u&gt;: As I saw that actions has many vm and so I choose the ubuntu-24.04-arm since my project is built on ARM but I found out that for some reason when I was compiling the code in actions, building and pushing the image to my dockerhub repo and when I was trying to pull it back into my EC2 or my rasp it was not working. Upon some search I came to conclusion that its nothing but environment inconsistency, so I came up with a utility container idea which solely compiles the code and outputs the generated bianry for the next step where new image is built with the generated binaries and push it to dockerhub for the pull and it started working fine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -v $PWD:/build-app:rw schd1337/portfolioapp:compiler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I used volume mount along with uses: actions/checkout@v3 with rw permissions and it works like a charm.&lt;/p&gt;

&lt;p&gt;So now if I want a small change I just make the change in local and then push it to github and in the actions it compiles and pushes the image and then in next job I used a simple ssh into the EC2 using the secrets in actions to apply the yaml file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SSH into EC2 and deploy&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
            &lt;span class="s"&gt;echo "${{ secrets.EC2_KEY }}" | tee $PWD/ec2.pem&lt;/span&gt;
            &lt;span class="s"&gt;chmod 600 $PWD/ec2.pem&lt;/span&gt;
            &lt;span class="s"&gt;ssh -o "StrictHostKeyChecking=no" -i "ec2.pem" admin@ec2-13-235-247-44.ap-south-1.compute.amazonaws.com "git clone https://github.com/AstroKabutar/SoloLeveling.git"&lt;/span&gt;
            &lt;span class="s"&gt;ssh -o "StrictHostKeyChecking=no" -i "ec2.pem" admin@ec2-13-235-247-44.ap-south-1.compute.amazonaws.com "kubectl apply -f SoloLeveling/kubernetes/dbdeploy.yaml"&lt;/span&gt;
            &lt;span class="s"&gt;ssh -o "StrictHostKeyChecking=no" -i "ec2.pem" admin@ec2-13-235-247-44.ap-south-1.compute.amazonaws.com "kubectl apply -f SoloLeveling/kubernetes/project-upskill.yaml"&lt;/span&gt;
            &lt;span class="s"&gt;ssh -o "StrictHostKeyChecking=no" -i "ec2.pem" admin@ec2-13-235-247-44.ap-south-1.compute.amazonaws.com "kubectl apply -f SoloLeveling/kubernetes/ingress.yaml"&lt;/span&gt;
            &lt;span class="s"&gt;ssh -o "StrictHostKeyChecking=no" -i "ec2.pem" admin@ec2-13-235-247-44.ap-south-1.compute.amazonaws.com "rm -rf SoloLeveling"&lt;/span&gt;
      &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash&lt;/span&gt;    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;u&gt;Problem&lt;/u&gt;&lt;/strong&gt;: Even if this works good I have to manually ssh into the EC2 to delete pods so I am thinking of should I go for simple kubectl delete then apply again or even better using some simple bash script using awk to delete the pods from the actions ssh itself. Either way I will update the post as I come to any of the conclusions and why.&lt;/p&gt;

&lt;p&gt;EDIT : I updated my workflow to run additional bash script that gets the pod names and deletes it and all I have to do is wait and its done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl get pods &lt;span class="nt"&gt;-n&lt;/span&gt;&amp;lt;namespace&amp;gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'NR == 2 {print $1}'&lt;/span&gt; | xargs kubectl delete pods &lt;span class="nt"&gt;-n&lt;/span&gt;&amp;lt;namespace&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;From what I have seen in companies and my own project, what I found out is that on offshore deployment scenarios it's best to have jenkins to do the stuff and with a separate repo or branch would suffice and when that code is approved for next stage like prod or pre-prod the code must be merged to main and let actions take over for the EKS cluster or EC2 or whatever. It makes work easy and using terraform (IaC) is the best way to keep track and also make changes without manually clicking across the console as its far too much prone to human error.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cicd</category>
      <category>githubactions</category>
      <category>jenkins</category>
    </item>
    <item>
      <title>How I deployed my first project for my devops portfolio: The HUNT (Infra and budget)</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Fri, 25 Jul 2025 06:04:00 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-the-hunt-infra-and-budget-2jlf</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-the-hunt-infra-and-budget-2jlf</guid>
      <description>&lt;h2&gt;
  
  
  The hunt for the cheapest infra without loosing performance
&lt;/h2&gt;

&lt;p&gt;After I successfully made my project, I proceeded for my plans on infra on where to host it. I made it on my raspberry pi 4b and also did it in CI/CD way (More on the CI/CD details in later posts). Which means I need an &lt;strong&gt;ARM64&lt;/strong&gt; architecture for my target infra on which I need to host my project.&lt;br&gt;
Since I got introduced to AWS in my job so I thought of going with AWS here so I looked in this &lt;a href="https://calculator.aws/#/" rel="noopener noreferrer"&gt;aws pricing calculator&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At the very first glance &lt;strong&gt;x86-64&lt;/strong&gt; costing way too much compared to &lt;strong&gt;arm64&lt;/strong&gt;. I didn't know why buy I do know seeing all my life home labbing and using pi I do get a general idea of performance and power consumption does play some role. I found &lt;a href="https://www.redhat.com/en/topics/linux/ARM-vs-x86" rel="noopener noreferrer"&gt;this article&lt;/a&gt; as the time of writing, the question of &lt;strong&gt;arm vs x86&lt;/strong&gt; was intriguing to me. Though I not fully understood it but it did gave me the idea.&lt;/p&gt;

&lt;p&gt;Continuing to my budget setting I at first selected &lt;strong&gt;t2.small&lt;/strong&gt; which has 2vCPUs and 2GB RAM. Since I am using &lt;a href="https://minikube.sigs.k8s.io/docs/" rel="noopener noreferrer"&gt;minikube&lt;/a&gt; for my deployment which requires 2CPUs and 2GB RAM which is exactly what the instance type t4g.small has. I knew that even if I start the minikube in that then deployments will fail and most probably will hang up the system. So using my terraform I spun up this t4g.small and as I thought after enabling ingress and then deploying my project and it started lagging a bit. But when I tried deleting a pod to see how the system reacts and it became disastrous for me. I cant even ssh back into my instance it lagged so much. I scraped the plan and went for the better which takes a bit more money but sure even have the space for some upgrades with no performance sacrifices. &lt;strong&gt;t4g.medium&lt;/strong&gt; which has 2vCPUs and 4G RAM, and as expected it works fine. I even tested by deleting pods repeatedly and saw no problem with deployments. I saw 100% utilization of this instance will cost me &lt;strong&gt;Monthly: 16.35/Month&lt;/strong&gt; which in &lt;strong&gt;INR 1,414.66/Month&lt;/strong&gt;. After this I bought a cheap domain for 2 years &lt;code&gt;zita.click&lt;/code&gt; which costed me &lt;strong&gt;6/Month&lt;/strong&gt; which converts to &lt;strong&gt;INR 519.14/Month&lt;/strong&gt; and also keeping one Hosted Zone alive costs &lt;strong&gt;0.50/Month -- INR 43/Month&lt;/strong&gt;. All this totals to 1414.66 + 43 = 1457.66/Monthly with 519.14 as setup cost (domain cost for 2 years). Now seeing that it's just a portfolio so less queries and less data outflow it might increase to i guess &lt;code&gt;&amp;lt;= 1650&lt;/code&gt;. Seeing this I set my budget to &lt;strong&gt;INR 2000/Monthly&lt;/strong&gt;. Then I decided to Reserve it EC2 Instance Savings Plans which trickles the cost down to &lt;strong&gt;6.94/Month -- INR 600.47/Month&lt;/strong&gt; reserved for 3 years. Since I already got the domain for 2 years, I have plans on extending it for one more year before changing the domain itself. &lt;/p&gt;

&lt;p&gt;&lt;u&gt;Snag&lt;/u&gt; - Upon trying to reserve instance t4g.medium only one instance for 3 years showed me instance quota full even if I had got none running. I raised the quota increase limit and wallah, &lt;strong&gt;thanks aws&lt;/strong&gt; from default 20 I got 30 now. As time of writing I am currently running on On-Demand but will purchase the RI soon.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabool2qqcayntzfeh7ju.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabool2qqcayntzfeh7ju.PNG" alt=" " width="800" height="297"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Aaah, as I uploaded the pic above i saw this &lt;code&gt;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/abool2qqcayntzfeh7ju.PNG&lt;/code&gt;&lt;br&gt;
Bucket name - dev-to-uploads&lt;br&gt;
Object key - uploads/articles/abool2qqcayntzfeh7ju.PNG&lt;br&gt;
Object - abool2qqcayntzfeh7ju.PNG&lt;br&gt;
We can only imagine the power of cloud here and how much freedom and flexibility it brings to us.&lt;/p&gt;

&lt;p&gt;With this the &lt;strong&gt;hunt&lt;/strong&gt; for my own budget which is &lt;strong&gt;INR 2000/Monthly&lt;/strong&gt; and infrastructure selection which is &lt;strong&gt;t4g.medium&lt;/strong&gt; is &lt;strong&gt;completed&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>devops</category>
      <category>infrastructureascode</category>
    </item>
    <item>
      <title>How I deployed my first project for my devops portfolio: Project Architecture</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Sat, 19 Jul 2025 09:43:02 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-project-architecture-1i9g</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-project-architecture-1i9g</guid>
      <description>&lt;h2&gt;
  
  
  Project Architecture
&lt;/h2&gt;

&lt;p&gt;This project (&lt;a href="https://github.com/AstroKabutar/SoloLeveling" rel="noopener noreferrer"&gt;Github branch main&lt;/a&gt;) I built this app entirely in CPP and I used the &lt;a href="https://github.com/CrowCpp/Crow" rel="noopener noreferrer"&gt;CrowCpp &lt;/a&gt; framework to run it.&lt;/p&gt;

&lt;p&gt;I created some custom includes with all the custom libraries for each one.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mysql.h&lt;/strong&gt; &lt;u&gt;MySQL Connector/C++&lt;/u&gt; to grant the ability to my application to be able to connect to my mysql database. I got the sql cpp con from this package &lt;strong&gt;libmysqlcppconn-dev&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Player.h&lt;/strong&gt; which comes in as a new player gets created. It handles the initialization stuff like initial xp date of creation xp required. Basically sets the player up.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;PlayerGrowth.h&lt;/strong&gt; comes in when player sets or completes tasks. The calculation of rewarding xp by fetching from database and setting new ones back.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Setup.h&lt;/strong&gt; is the bootstrap for the application that creates the tables required for the application in the database.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I used &lt;a href="https://cmake.org/" rel="noopener noreferrer"&gt;CMAKE&lt;/a&gt; as my compiling tool followed by make.&lt;/p&gt;

&lt;p&gt;So in summery as new player is created Player.h comes in to do the formalities with giving back the UID generated to the player. As in LoadGame section when tasks created or completed and displaying of stats is handled by PlayerGrowth.h and as the app starts the Setup.h bootstraps it. Mysql.h works behind for the communication from app to database. The Auxiliary.h is just another custom header I made to enforce DRY(Don't Repeat Yourself) &lt;/p&gt;

</description>
      <category>cpp</category>
      <category>terraform</category>
      <category>aws</category>
      <category>cloud</category>
    </item>
    <item>
      <title>How I deployed my first project for my devops portfolio: The Project</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Sat, 19 Jul 2025 08:07:52 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-about-the-project-2no</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-about-the-project-2no</guid>
      <description>&lt;h1&gt;
  
  
  About the project
&lt;/h1&gt;

&lt;p&gt;This project that I made is just a simple task completion, where you insert a task and rate its importance (S,A,B,C,D,E) and based on its importance you will get rewarded with suitable XP as the task gets completed.&lt;/p&gt;

&lt;h1&gt;
  
  
  Simple working of the project
&lt;/h1&gt;

&lt;p&gt;&lt;a href="http://shahin.zita.click/Begin" rel="noopener noreferrer"&gt;Project SoloLeveling&lt;/a&gt; is the landing page where you will be greeted with name, dob for new player and LoadGame for existing player.&lt;/p&gt;

&lt;p&gt;As the new player inserts their name and DOB, a ID is created and must be saved.&lt;/p&gt;

&lt;p&gt;As an existing player we greeted with a new page as we hit the LoadGame.&lt;/p&gt;

&lt;p&gt;--&amp;gt; To check the XP of the player: At the end of page there is Player name filed and an ID field. Insert your name and the ID got during creation and submit. You will get the current player XP and Level.&lt;/p&gt;

&lt;p&gt;--&amp;gt; To add new task: Enter the task under New task and then select the importance from drop down menu beside it. Then again at the bottom Player Name and ID needs to be entered before submit to save it in the database.&lt;/p&gt;

&lt;p&gt;--&amp;gt; To complete a task: Your created tasks will be shown at the very top with the id of the task. Insert the task id which is completed in the field below the New Task section and yes again with player name and ID before submitting the task.&lt;/p&gt;

&lt;h1&gt;
  
  
  XP calculation and importance
&lt;/h1&gt;

&lt;p&gt;&lt;b&gt;First with importance&lt;/b&gt;: Below are the importance characters and its corresponding value I decided on.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;('S', 10)&lt;/li&gt;
&lt;li&gt;('A', 8)&lt;/li&gt;
&lt;li&gt;('B', 6)&lt;/li&gt;
&lt;li&gt;('C', 4)&lt;/li&gt;
&lt;li&gt;('D', 2)&lt;/li&gt;
&lt;li&gt;('E', 1)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;b&gt;XP calculation&lt;/b&gt;: On task completion, based on the importance value I settled on a simple formula.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;XP GAINED = (reward * current XP) / 100&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;For leveling up&lt;/b&gt; as in games an xp needed to be filled. So behind that I have made another simple formula.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;XP REQUIRED += (30 * required XP) / 100 + 8&lt;/u&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  FAQ
&lt;/h1&gt;

&lt;p&gt;&lt;b&gt;Question:&lt;/b&gt; xp gained = (reward * current xp) / 100. New player has 0 XP so anything x 0 is 0, so why that?&lt;br&gt;
&lt;b&gt;Answer:&lt;/b&gt; When new players signs up, the player gets an xp for that, hence every new player starts with 3.48 XP.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>terraform</category>
      <category>cpp</category>
    </item>
    <item>
      <title>How I deployed my first project for my devops portfolio: Introduction</title>
      <dc:creator>Shahin Sheikh</dc:creator>
      <pubDate>Sat, 19 Jul 2025 08:04:41 +0000</pubDate>
      <link>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-introduction-55h1</link>
      <guid>https://dev.to/shahin1337/how-i-deployed-my-first-project-for-my-devops-portfolio-introduction-55h1</guid>
      <description>&lt;h2&gt;
  
  
  INTRODUCTION
&lt;/h2&gt;

&lt;p&gt;Hi all, this is my first time writing anything like this in my life. I am an aspiring cloud engineer/architect whatever you like to call it, as I love cloud tech and actively looking for opportunities.&lt;/p&gt;

&lt;p&gt;Last year as I joined my first company and got introduced to this concept of &lt;strong&gt;Devops&lt;/strong&gt; I was in awe of this tech. I started to get ideas as how much we can do stuff by leveraging the cloud tech. And I have always been homelabbing before. Joining my first company and getting oppertunity in devops and cloud which is why I am much more inclined to this technology. I see many opportunities like getting a ML model or like realtime data from IoT, possibilities are endless.&lt;/p&gt;

&lt;p&gt;As to get recognized by companies in this tough competitive job market I got an idea of why not just diving into it and try making and deploying a real life simple project and see how messy the actual ground is. The project idea I got from watching an &lt;a href="https://www.crunchyroll.com/series/GDKHZEJ0K/solo-leveling" rel="noopener noreferrer"&gt;anime &lt;/a&gt; and yes that project type exists already everywhere app to web but my aim is to understand deployment and leverage the cloud with less cost and optimum performance. So a simple project and a good start as a beginner. I aim to learn how, what, where to use what services and what not. After all cloud is just another peoples computer out for rent in a nutshell.&lt;/p&gt;

&lt;p&gt;For the past 1.5 years as the time of writing this article, I successfully hosted my website and my project in devops style using IaaC.&lt;br&gt;
&lt;a href="http://shahin.zita.click/Shahin" rel="noopener noreferrer"&gt;My website here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;I hope you have a good time reading and learning and potentially advising improvement to my steps from that I can learn from you all to&lt;/u&gt;. &lt;br&gt;
Thank you.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>cpp</category>
      <category>terraform</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
