<?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: Md Shamim</title>
    <description>The latest articles on DEV Community by Md Shamim (@shamimice03).</description>
    <link>https://dev.to/shamimice03</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%2F948559%2F33bfc350-2962-4bba-8f51-dbde9ac4d434.jpeg</url>
      <title>DEV Community: Md Shamim</title>
      <link>https://dev.to/shamimice03</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shamimice03"/>
    <language>en</language>
    <item>
      <title>AWS Security Series: AWS Access Key is Compromised. Now What? An Incident Response Playbook.</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Mon, 08 Dec 2025 17:18:07 +0000</pubDate>
      <link>https://dev.to/shamimice03/aws-security-series-aws-access-key-is-compromised-now-what-an-incident-response-playbook-448b</link>
      <guid>https://dev.to/shamimice03/aws-security-series-aws-access-key-is-compromised-now-what-an-incident-response-playbook-448b</guid>
      <description>&lt;p&gt;In the world of AWS, it's always best practice to: &lt;strong&gt;use IAM roles whenever possible.&lt;/strong&gt; IAM roles provide temporary, automatically rotated credentials that are the gold standard for security. But reality is not the same. What happens when we need to integrate with a third-party service that only supports static, long-term credentials? This is where the IAM user with an access key becomes a necessary...&lt;/p&gt;

&lt;p&gt;So, the critical moment arrives: &lt;strong&gt;an access key is exposed. What to do?&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Phase 1: Assess the situation&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Our first instinct might be to hit the delete button—and fast. But hold on. A rash deletion could instantly break our production environment. A smarter, safer first move is to &lt;strong&gt;deactivate&lt;/strong&gt; the key. Think of it as putting the key on 'pause.' It immediately stops working, giving you a crucial window to assess the impact on the applications.&lt;/p&gt;

&lt;p&gt;Often, AWS detects this kind of exposure. It might send a notification and even proactively attach the &lt;a href="https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AWSCompromisedKeyQuarantineV3.html" rel="noopener noreferrer"&gt;AWSCompromisedKeyQuarantineV3&lt;/a&gt; policy to the user to help limit the damage.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Phase 2: The Hidden Threat&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;We've deactivated the key, created a new set, and updated our applications. But then, when we check CloudTrail, and shocked!!! Unauthorized API calls are still happening.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How is this possible?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The attacker was one step ahead. Before we deactivated the main key, they used it to generate &lt;strong&gt;temporary session tokens&lt;/strong&gt; using a command like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws sts get-session-token &lt;span class="nt"&gt;--duration-seconds&lt;/span&gt; 129600 &lt;span class="c"&gt;# (36 hours)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These tokens are independent of the original key and can remain valid for up to 36 hours, giving the attacker a persistent backdoor long after the original key is dead.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Phase 3: Add Deny Policy to restrict Temporary Credentials&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;We can create a "time-based fence" with an IAM policy to block &lt;em&gt;new&lt;/em&gt; temporary tokens; Therefore, we can use a policy like the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "DenyAccessWithTemporaryCredentialsIssuedAfterCompromise",
            "Effect": "Deny",
            "Action": "*",
            "Resource": "*",
            "Condition": {
                "DateLessThan": {
                    "aws:TokenIssueTime": "2025-12-08T16:00:00Z"
                }
            }
        }
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deny all temporary credentials that were created before the exposure of access keys.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Phase 4: The Recovery - Restoring Access Safely&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;It's time to rebuild. The goal is to restore access without re-introducing the same risk.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Create New Credentials:&lt;/strong&gt; The cleanest approach is to create brand new access keys. And review the policy and apply the &lt;strong&gt;principle of least privilege&lt;/strong&gt;, granting only the permissions necessary for its job.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Update All Systems:&lt;/strong&gt; Update every application, script, configuration file, and secret store (like AWS Secrets Manager) with the new credentials.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Phase 5: The Post-Mortem - Hardening Our Defenses&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The incident is over, but the work isn't. Now it's time to learn from the attack and strengthen our defenses.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Forensic Analysis with CloudTrail:&lt;/strong&gt; Dive into CloudTrail logs. Filter events by the compromised user's name to see every API call they made. What data did they access? Did they try to create new users, roles, or backdoors? This log is our forensic evidence of the attack's scope.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Threat Detection with GuardDuty:&lt;/strong&gt; We can use Amazon GuardDuty is an intelligent threat detection service that was likely monitoring our account during the attack. Review its findings for indicators of compromise, such as unusual API behavior or attempts to escalate privileges. GuardDuty can help us uncover other malicious activity we might have missed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;📌 Connect With Me&lt;br&gt;
🔗 LinkedIn: &lt;a href="https://www.linkedin.com/in/shamimice03/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/shamimice03/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>sre</category>
      <category>security</category>
    </item>
    <item>
      <title>Cross-Account VPC Associations with Route53 Private Hosted Zone and Addressing Terraform State Update Issue</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Sat, 31 Aug 2024 12:18:55 +0000</pubDate>
      <link>https://dev.to/aws-builders/cross-account-vpc-associations-with-route53-private-hosted-zone-and-addressing-terraform-state-update-issue-3eip</link>
      <guid>https://dev.to/aws-builders/cross-account-vpc-associations-with-route53-private-hosted-zone-and-addressing-terraform-state-update-issue-3eip</guid>
      <description>&lt;h2&gt;
  
  
  Background:
&lt;/h2&gt;

&lt;p&gt;Let assume, we have a private hosted zone in &lt;code&gt;Account A&lt;/code&gt; and a VPC associated with it from the same account. Now, we need to associate another VPC from &lt;code&gt;Account B&lt;/code&gt; (which is a Cross-Account) to the &lt;strong&gt;private hosted zone&lt;/strong&gt; residing in &lt;code&gt;Account A&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;However, this cannot be done via the AWS console. To accomplish this requirement, we'll need to use the programmatic approach. In this tutorial, we will be using AWS CLI to perform the necessary operations.&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%2Fv32ymeeju1um4l96cfxt.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%2Fv32ymeeju1um4l96cfxt.png" alt="Route53 Private Hosted Zone Cross Account VPC Association " width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The following commands need to be run on&lt;/strong&gt; &lt;code&gt;Account A&lt;/code&gt;: &lt;br&gt;
 &lt;code&gt;Account A&lt;/code&gt; needs to create a VPC association authorization to authorize the association of a VPC from &lt;code&gt;Account B&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create vpc association authorization:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws route53 create-vpc-association-authorization \
    --hosted-zone-id &amp;lt;hosted-zone-id&amp;gt; \
    --vpc VPCRegion=&amp;lt;region&amp;gt;,VPCId=&amp;lt;vpc-id&amp;gt; \
    --region &amp;lt;your-region&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Check if VPC is &lt;code&gt;authorized&lt;/code&gt;:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws route53 list-vpc-association-authorizations \
    --hosted-zone-id Z03168043HMQYLM46KQBL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Expected Outcome:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "VPCs": [
        {
            "VPCRegion": "region",
            "VPCId": "&amp;lt; target-vpc-id &amp;gt;"
        }
    ],
    "HostedZoneId": "&amp;lt; hosted-zone-id &amp;gt;"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;The following commands need to be run on&lt;/strong&gt; &lt;code&gt;Account B&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Account B&lt;/code&gt; needs to &lt;code&gt;associate-vpc-with-hosted-zone&lt;/code&gt; using the following command:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws route53 associate-vpc-with-hosted-zone \
    --hosted-zone-id &amp;lt;hosted-zone-id&amp;gt; \
    --vpc VPCRegion=&amp;lt;region&amp;gt;,VPCId=&amp;lt;vpc-id&amp;gt; \
    --region &amp;lt;your-region&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now, from the console, we can verify the associated VPC:&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%2Ffsq2q4d3m1oedqja1yti.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%2Ffsq2q4d3m1oedqja1yti.png" alt="Route53 Private Hosted Zone Cross Account VPC Association" width="800" height="205"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Addressing Terraform State Update Challenges
&lt;/h2&gt;

&lt;p&gt;After associating cross-account VPC with a private hosted zone using CLI. In &lt;code&gt;terraform&lt;/code&gt;, we might see &lt;code&gt;terraform&lt;/code&gt; will delete the cross-account VPC from the hosted zone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  # aws_route53_zone.private will be updated in-place
  ~ resource "aws_route53_zone" "private" {
        id                  = "Z03168043HMQYLAGDGAL"
        name                = "example.com"
        tags                = {}
        # (7 unchanged attributes hidden)

      - vpc {
          - vpc_id     = "vpc-072877fb4e12c2427" -&amp;gt; null
          - vpc_region = "us-east-1" -&amp;gt; null
        }

        # (1 unchanged block hidden)
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To resolve this issue we can use the &lt;code&gt;lifecycle&lt;/code&gt; block inside the &lt;code&gt;aws_route53_zone&lt;/code&gt; resource code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;resource "aws_route53_zone" "private" {
  name = "example.com"

  vpc {
    vpc_id = "vpc-0f76856d99df4csbf"
  }
  # Like this 
  lifecycle {
    ignore_changes = [vpc]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all for now. Please let me know your feedback and if you have any questions.&lt;/p&gt;

&lt;p&gt;Thanks!!&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/shamimice03/" rel="noopener noreferrer"&gt;Md Shamim &lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>terraform</category>
      <category>route53</category>
      <category>cloudcomputing</category>
    </item>
    <item>
      <title>Kubeconfig for EKS Cluster</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Fri, 09 Jun 2023 10:21:28 +0000</pubDate>
      <link>https://dev.to/aws-builders/kubeconfig-for-eks-cluster-4aga</link>
      <guid>https://dev.to/aws-builders/kubeconfig-for-eks-cluster-4aga</guid>
      <description>&lt;h1&gt;
  
  
  How to create a &lt;code&gt;kubeconfig&lt;/code&gt; file for an existing EKS Cluster?
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Step-1:
&lt;/h3&gt;

&lt;p&gt;Install &lt;strong&gt;&lt;code&gt;aws-cli&lt;/code&gt;&lt;/strong&gt; on your machine using the following script:&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="c"&gt;#!/bin/bash&lt;/span&gt;
curl &lt;span class="s2"&gt;"https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"awscliv2.zip"&lt;/span&gt;
unzip awscliv2.zip
&lt;span class="nb"&gt;sudo&lt;/span&gt; ./aws/install
aws &lt;span class="nt"&gt;--version&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step-2:
&lt;/h3&gt;

&lt;p&gt;Run &lt;strong&gt;&lt;code&gt;aws configure&lt;/code&gt;&lt;/strong&gt; command to set up aws credentials:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ aws configure

AWS Access Key ID [None]: &amp;lt;AccessID&amp;gt;
AWS Secret Access Key [None]: &amp;lt;AccessKey&amp;gt;
Default region name [None]: &amp;lt;Region&amp;gt;
Default output format [None]: &amp;lt;Format, e.g:json&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step-3:
&lt;/h3&gt;

&lt;p&gt;Create &lt;strong&gt;&lt;code&gt;kubeconfig&lt;/code&gt;&lt;/strong&gt; file on &lt;strong&gt;&lt;code&gt;~/.kube/config&lt;/code&gt;&lt;/strong&gt; location:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ aws eks update-kubeconfig --name &amp;lt;EKS_CLUSTER_NAME&amp;gt; \
                            --region &amp;lt;REGION_CODE&amp;gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ aws eks update-kubeconfig --name cluster-1 --region ap-northeast-1 

$ cat ~/.kube/config

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Bonus: How to list all existing EKS Cluster ?
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ aws eks list-clusters --region &amp;lt;AWS-REGION&amp;gt; 

$ aws eks list-clusters --region ap-northeast-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "clusters": [
        "Cluster-1",
        "Cluster-2"
    ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Query Cluster Name:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ EKS_CLUSTER_NAME=$(aws eks list-clusters --region ap-northeast-1 --query clusters[0] --output text)

$ echo $EKS_CLUSTER_NAME

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cluster-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>aws</category>
      <category>awscommunitybuilders</category>
      <category>kubernetes</category>
      <category>eks</category>
    </item>
    <item>
      <title>A Guide to Docker Multi-Stage Builds</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Thu, 22 Dec 2022 05:36:15 +0000</pubDate>
      <link>https://dev.to/shamimice03/a-guide-to-docker-multi-stage-builds-2mcn</link>
      <guid>https://dev.to/shamimice03/a-guide-to-docker-multi-stage-builds-2mcn</guid>
      <description>&lt;p&gt;A Docker image is built up from a series of layers. Each layer represents an instruction in the image’s Dockerfile. Each layer except the very last one is read-only. &lt;/p&gt;

&lt;p&gt;One of the most challenging things about building images is decreasing image size. In this article, we will discuss how we can optimize a docker image size.&lt;/p&gt;

&lt;p&gt;Let’s create a custom docker image for a simple golang application.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# app.go

package main

import (
    "fmt"
    "time"
    "os/user"
)

func main () {
    user, err := user.Current()
    if err != nil {
        panic(err)
    }

    for {
        fmt.Println("user: " + user.Username + " id: " + user.Uid)
        time.Sleep(1 * time.Second)
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, let’s write a **Dockerfile **to package the golang application : &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Dockerfile

FROM ubuntu   # Base image 
ARG DEBIAN_FRONTEND=noninteractive   
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y golang-go    # Install golang
COPY app.go .                                         # Copy source code                 
RUN CGO_ENABLED=0 go build app.go                     
CMD ["./app"]                               
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next, Create a **docker image **and run a container from that image : &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Create image from the Dockerfile
&amp;gt;&amp;gt;  docker build -t goapp .
...
Successfully built 0f51e92fe409
Successfully tagged goapp:latest

# Run a container from the image created above
&amp;gt;&amp;gt; docker run -d goapp

04eb7e2f8dd2ade3723af386f80c61bdf6f5d9afe6671011b60f3a61756bdab6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, ‘&lt;strong&gt;exec&lt;/strong&gt;’ into the container we created earlier : &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# exec into the container
&amp;gt;&amp;gt; docker exec -it 04eb7e2f8dd sh

# list the files
~ ls
app  app.go  bin  boot  dev  etc  home  ...

# run the application 
~ ./app
user: root id: 0
user: root id: 0
user: root id: 0
user: root id: 0
user: root id: 0
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We can see that after building the application we have &lt;strong&gt;app&lt;/strong&gt;artifact inside the container. If we check the image size which helped us to build our application artifact : &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt; docker images goapp

REPOSITORY                  TAG       IMAGE ID       CREATED        SIZE
goapp                       latest    0f51e92fe409   16 hours ago   870MB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The image size is ‘&lt;strong&gt;870MB’&lt;/strong&gt;, but we can slim this down using multi-stage builds. With multi-stage builds, we will use multiple **FROM **statements in our  Dockerfile. Each **FROM **instruction can use a different base, and each of them begins a new stage of the build. We can selectively copy artifacts from one stage to another by leaving everything that we don’t want in the final image. To show how this works, let’s adapt the **Dockerfile **from the previous section to use multi-stage build.&lt;/p&gt;

&lt;p&gt;We will divide our &lt;strong&gt;Dockerfile&lt;/strong&gt; into two stages. One will be the &lt;strong&gt;build stage&lt;/strong&gt; , which will help us to build our application and generate the artifact. And then we will only &lt;strong&gt;copy the artifact from the build stage to another stage and create a tiny production image&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Dockerfile
# named this stage as builder ----------------------
FROM ubuntu AS builder         
ARG DEBIAN_FRONTEND=noninteractive   
# Install golang
RUN apt-get update &amp;amp;&amp;amp; apt-get install -y golang-go   
# Copy source code
COPY app.go .                                             
RUN CGO_ENABLED=0 go build app.go

# new stage -------------------
FROM alpine
# Copy artifact from builder stage                   
COPY --from=builder /app .   
CMD ["./app"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now, build the image and check the image size :&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt;&amp;gt; docker build -t goapp-prod  .

Successfully built 61627d74f8b8
Successfully tagged goapp-prod:latest

&amp;gt;&amp;gt; docker images goapp-prod

REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
goapp-prod   latest    61627d74f8b8   5 minutes ago   8.92MB  # &amp;lt;---
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;As we can see image size has been reduced significantly. It’s time to check if we can run a container from the image we created.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# create docker container
&amp;gt;&amp;gt; docker run goapp-prod

user: root id: 0
user: root id: 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Great!&lt;/strong&gt; We were able to use the tiny production image we created and it is working perfectly. &lt;/p&gt;

&lt;h3&gt;
  
  
  👉All Articles on Linux
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://medium.com/@shamimice03/list/1339e15e3304" rel="noopener noreferrer"&gt;All Articles on Linux&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  👉All Articles on Kubernetes
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://medium.com/@shamimice03/list/7ae1a0f96f3b" rel="noopener noreferrer"&gt;&lt;strong&gt;All Articles on Kubernetes&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>devops</category>
      <category>sre</category>
      <category>containerapps</category>
    </item>
    <item>
      <title>Helm — Create a Private Repository Using Apache Webserver</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Mon, 28 Nov 2022 02:45:36 +0000</pubDate>
      <link>https://dev.to/shamimice03/helm-create-a-private-repository-using-apache-webserver-4ofc</link>
      <guid>https://dev.to/shamimice03/helm-create-a-private-repository-using-apache-webserver-4ofc</guid>
      <description>&lt;p&gt;Suppose, we have a scenario where we want to distribute our helm chart internally or within the organization. One of the ways to achieve that is to create a private repository using the Apache Server and the server will serve as a helm repository.&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%2Fiqrpfnywk47ylpwrtr0s.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%2Fiqrpfnywk47ylpwrtr0s.png" alt=" " width="778" height="371"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://medium.com/p/e80e5dd7569e" rel="noopener noreferrer"&gt;Read Full Article&lt;/a&gt;&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Git Clone using Init-container | Kubernetes</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Sun, 27 Nov 2022 14:37:05 +0000</pubDate>
      <link>https://dev.to/shamimice03/git-clone-using-init-container-kubernetes-3id4</link>
      <guid>https://dev.to/shamimice03/git-clone-using-init-container-kubernetes-3id4</guid>
      <description>&lt;p&gt;An &lt;code&gt;Init-container&lt;/code&gt; is a special kind of container, which will run before the actual application. Init containers always run to completion.&lt;/p&gt;

&lt;p&gt;A pod can have several init-containers. Init containers execute in a sequential manner. Each init-container must be completed successfully before the next one starts to execute.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://faun.pub/git-clone-using-init-container-kubernetes-b49535be6968" rel="noopener noreferrer"&gt;Read Full Article&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>Helm — Dependencies</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Wed, 09 Nov 2022 05:24:06 +0000</pubDate>
      <link>https://dev.to/shamimice03/helm-dependencies-29jm</link>
      <guid>https://dev.to/shamimice03/helm-dependencies-29jm</guid>
      <description>&lt;p&gt;In helm, one chart can be dependent on another chart. For instance, a &lt;code&gt;WordPress&lt;/code&gt; application requires a database to start functioning. In helm, we can deploy WordPress as part of the parent chart and &lt;code&gt;MySQL&lt;/code&gt; or any other required application as a dependency of the parent chart.&lt;/p&gt;

&lt;p&gt;Helm charts store their dependencies in ‘charts/’. There are two different ways to add dependency charts to parent charts:&lt;/p&gt;

&lt;p&gt;Listing all the dependencies inside the Chart.yaml file and helm will download the dependencies and store them in the ‘charts/’ Directory.&lt;/p&gt;

&lt;p&gt;Manually populate the dependency chart inside the ‘charts/’ directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  List dependencies inside the Chart.yaml file
&lt;/h2&gt;

&lt;p&gt;Before listing dependencies in the Chart.yaml file, By default Chart.yaml file looks like this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Chart.yaml
apiVersion: v2
name: webserver
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's see how we can populate the dependencies into the Chart.yaml file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dependencies:

- name: mysql
  version: "9.3.4"
  repository: "https://charts.bitnami.com/bitnami"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After adding dependencies to the Chart.yaml file :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Chart.yaml

apiVersion: v2
name: webserver
description: A Helm chart for Kubernetes
type: application
version: 0.1.0
appVersion: "1.16.0"
dependencies:
- name: mysql
  version: "9.3.4"
  repository: "https://charts.bitnami.com/bitnami"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using a simple helm command we can pull the chart from the repository defined in the dependencies field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   helm dependency update [CHART] 
&amp;gt;&amp;gt; helm dependency update ~/webserver
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above-defined command will generate .webserver/Chart.lock file as well as download all dependencies into the .webserver/charts directory&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;Chart.lock&lt;/code&gt; file lists the exact versions of immediate dependencies and their dependencies and so on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://levelup.gitconnected.com/helm-dependencies-1907facbe410" rel="noopener noreferrer"&gt;Read full article...&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>helm</category>
      <category>containerapps</category>
      <category>packagemanage</category>
    </item>
    <item>
      <title>A Series on Bash Scripting</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Fri, 04 Nov 2022 00:44:30 +0000</pubDate>
      <link>https://dev.to/shamimice03/a-series-on-bash-scripting-38k1</link>
      <guid>https://dev.to/shamimice03/a-series-on-bash-scripting-38k1</guid>
      <description>&lt;h2&gt;
  
  
  What is Bash?
&lt;/h2&gt;

&lt;p&gt;Bash is a type of shell that allows running commands on Linux.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Bash Script?
&lt;/h2&gt;

&lt;p&gt;A Bash script is a plain text file that contains a series of commands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases of Bash Scripting
&lt;/h2&gt;

&lt;p&gt;Bash scripts can be used for various purposes, such as executing a shell command, running multiple commands together, customizing administrative tasks, performing task automation, etc.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to learn?
&lt;/h2&gt;

&lt;p&gt;You can start your bash scripting journey today. Following are the lists of articles :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://levelup.gitconnected.com/start-your-scripting-journey-today-bash-script-part-1-46cbddf4e4e7" rel="noopener noreferrer"&gt;● Start Your Scripting Journey Today | Bash Script — Part 1&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/geekculture/start-your-scripting-journey-today-bash-script-part-2-4d93ecb59249" rel="noopener noreferrer"&gt;● Start Your Scripting Journey Today | Bash Script — Part 2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/geekculture/start-your-scripting-journey-today-bash-script-part-3-9779ac0abea2" rel="noopener noreferrer"&gt;● Start Your Scripting Journey Today | Bash Script — Part 3&lt;/a&gt;&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://medium.com/@shamimice03" rel="noopener noreferrer"&gt;Follow &lt;/a&gt;me to get more articles like this.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>bash</category>
      <category>programming</category>
      <category>linux</category>
      <category>script</category>
    </item>
    <item>
      <title>Start Your Scripting Journey Today | Bash Script</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Mon, 31 Oct 2022 05:37:55 +0000</pubDate>
      <link>https://dev.to/shamimice03/start-your-scripting-journey-today-bash-script-3aeo</link>
      <guid>https://dev.to/shamimice03/start-your-scripting-journey-today-bash-script-3aeo</guid>
      <description>&lt;p&gt;A Bash script is a plain text file that contains a series of commands. Anything we can normally run from the command line can be used to create a script.&lt;/p&gt;

&lt;p&gt;Article Links:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://levelup.gitconnected.com/start-your-scripting-journey-today-bash-script-part-1-46cbddf4e4e7" rel="noopener noreferrer"&gt;Start Your Scripting Journey Today | Bash Script- Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/geekculture/start-your-scripting-journey-today-bash-script-part-2-4d93ecb59249" rel="noopener noreferrer"&gt;Start Your Scripting Journey Today | Bash Script- Part 2&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Helm—Named Templates</title>
      <dc:creator>Md Shamim</dc:creator>
      <pubDate>Wed, 26 Oct 2022 06:00:49 +0000</pubDate>
      <link>https://dev.to/shamimice03/helm-named-templates-1576</link>
      <guid>https://dev.to/shamimice03/helm-named-templates-1576</guid>
      <description>&lt;p&gt;We can create partial or sub-templates in helm, mainly known as “named templates”. A named template is simply a template defined inside a file and given a name.&lt;/p&gt;

&lt;p&gt;Named templates can be considered just like functions. Named templates will allow us to reuse syntax or logic throughout the helm chart.&lt;/p&gt;

&lt;p&gt;Article Link - &lt;a href="https://levelup.gitconnected.com/helm-named-templates-de2efc3875d0" rel="noopener noreferrer"&gt; Helm—Named Templates&lt;/a&gt;&lt;/p&gt;

</description>
      <category>helm</category>
      <category>kubernetes</category>
      <category>k8s</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
