<?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>Debug School: Suyash Sambhare</title>
    <description>The latest articles on Debug School by Suyash Sambhare (@suyash).</description>
    <link>https://www.debug.school/suyash</link>
    <image>
      <url>https://www.debug.school/images/_oBG0EVLTPOYAnX0OCd-EzwpedSOpoZEU6sEV-leEps/rs:fill:90:90/g:sm/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvdXNl/ci9wcm9maWxlX2lt/YWdlLzQyNC9kNGFl/Yzk0Ny1hMjQ2LTRj/MDQtOGEyOC0xMjg3/NzM2MGMzYzkucG5n</url>
      <title>Debug School: Suyash Sambhare</title>
      <link>https://www.debug.school/suyash</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.debug.school/feed/suyash"/>
    <language>en</language>
    <item>
      <title>Windows 11 context menu</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Fri, 08 May 2026 05:15:07 +0000</pubDate>
      <link>https://www.debug.school/suyash/windows-11-context-menu-5ap</link>
      <guid>https://www.debug.school/suyash/windows-11-context-menu-5ap</guid>
      <description>&lt;h2&gt;
  
  
  Ye Olde Right Click menu
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/HcbRRdNTbAN1GZSadlJtbkbkcwY3a_-yaBDnb84WC4o/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvZmMyOTN4/eHVvY3IyODljamRi/a2gucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/HcbRRdNTbAN1GZSadlJtbkbkcwY3a_-yaBDnb84WC4o/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvZmMyOTN4/eHVvY3IyODljamRi/a2gucG5n" alt="Old Right Click" width="255" height="784"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Design engineer in Microsoft probably thinking, "&lt;em&gt;Hmm, the context menu when you right-click on a file is quite cluttered, lets fix that by moving everything to an overflow option called &lt;strong&gt;Show more options&lt;/strong&gt;&lt;/em&gt;"&lt;/p&gt;

&lt;h2&gt;
  
  
  Le New Right Click Menu
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/lGgKUrLM6yB2AyV6DFn_qVir5Q851RFtfF12pDUj3XU/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvbXNna3Ny/OXFlbzJyeGthY3Yy/Y3EucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/lGgKUrLM6yB2AyV6DFn_qVir5Q851RFtfF12pDUj3XU/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvbXNna3Ny/OXFlbzJyeGthY3Yy/Y3EucG5n" alt="New Right Click" width="340" height="787"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Much better!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/N2vp10-FiR8AxJIwwQrnKAIL7RbhziPNLqsWfacZdwM/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvbmxsaWY1/a2k4YmtjM3oxMWFh/b3UucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/N2vp10-FiR8AxJIwwQrnKAIL7RbhziPNLqsWfacZdwM/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvbmxsaWY1/a2k4YmtjM3oxMWFh/b3UucG5n" alt="Windows 11" width="164" height="314"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>windows</category>
      <category>microsoft</category>
      <category>design</category>
    </item>
    <item>
      <title>Win Updates via PS1</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Wed, 22 Apr 2026 03:07:02 +0000</pubDate>
      <link>https://www.debug.school/suyash/win-updates-via-ps1-51gb</link>
      <guid>https://www.debug.school/suyash/win-updates-via-ps1-51gb</guid>
      <description>&lt;p&gt;PowerShell file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;cd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;C:\&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;sfc&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/scannow&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;chkdsk&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;C:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/scan&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/perf&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;winget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;upgrade&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--all&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;install-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PSWindowsUpdate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;import-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PSWindowsUpdate&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;get-WindowsUpdate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-AcceptAll&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;tree&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nx"&gt;shutdown&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/r&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;exit&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.debug.school/images/Uv2LWqoLI0EG9Jse57Fcj_eO9CpKxUE4kwC7Z0hqUyE/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvMjdpZXRz/cWZjZ3VsbG80bmV1/bGcucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/Uv2LWqoLI0EG9Jse57Fcj_eO9CpKxUE4kwC7Z0hqUyE/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvMjdpZXRz/cWZjZ3VsbG80bmV1/bGcucG5n" alt="Art6" width="798" height="585"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Requires reboot&lt;/p&gt;

</description>
      <category>devops</category>
      <category>updates</category>
      <category>powershell</category>
      <category>windows</category>
    </item>
    <item>
      <title>AWS Secrets Manager in GitLab CI/CD</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Wed, 15 Apr 2026 05:45:02 +0000</pubDate>
      <link>https://www.debug.school/suyash/aws-secrets-manager-in-gitlab-cicd-35cc</link>
      <guid>https://www.debug.school/suyash/aws-secrets-manager-in-gitlab-cicd-35cc</guid>
      <description>&lt;h1&gt;
  
  
  Using AWS Secrets Manager in GitLab CI/CD
&lt;/h1&gt;

&lt;p&gt;GitLab lets you &lt;strong&gt;fetch secrets directly from AWS Secrets Manager at job runtime&lt;/strong&gt;, instead of hard‑coding or manually syncing secrets into GitLab CI variables.&lt;/p&gt;

&lt;p&gt;This gives you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Centralized secret management (AWS)&lt;/li&gt;
&lt;li&gt;  Short‑lived credentials (OIDC)&lt;/li&gt;
&lt;li&gt;  No secrets stored permanently in GitLab&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  How the Integration Works (Architecture)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;GitLab Runner&lt;/strong&gt; authenticates to AWS

&lt;ul&gt;
&lt;li&gt;  Via &lt;strong&gt;IAM Role&lt;/strong&gt; attached to the runner host&lt;/li&gt;
&lt;li&gt;  Or via &lt;strong&gt;OpenID Connect (OIDC)&lt;/strong&gt; using GitLab ID tokens&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt; During the &lt;strong&gt;“Resolving secrets”&lt;/strong&gt; phase:

&lt;ul&gt;
&lt;li&gt;  Runner calls AWS Secrets Manager&lt;/li&gt;
&lt;li&gt;  Fetches the secret value&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt; GitLab:

&lt;ul&gt;
&lt;li&gt;  Writes the secret to a &lt;strong&gt;temporary file&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  Exposes the file path as an &lt;strong&gt;environment variable&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt; Your job uses the secret&lt;/li&gt;
&lt;li&gt; Temp files are removed when the job finishes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Secrets never appear in the job logs unless you echo them.&lt;/p&gt;




&lt;h2&gt;
  
  
  Authentication Methods
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. IAM Role
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No tokens or role assumptions needed.&lt;/p&gt;

&lt;p&gt;With Kubernetes runners, the IAM role must be on the &lt;strong&gt;runner manager&lt;/strong&gt;, not just the pod.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. OpenID Connect
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  GitLab issues a short‑lived OIDC token&lt;/li&gt;
&lt;li&gt;  AWS STS exchanges it for temporary credentials&lt;/li&gt;
&lt;li&gt;  AWS_ROLE_ARN defines what role is assumed
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;id_tokens&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_ID_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;aud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sts.amazonaws.com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_ROLE_ARN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:iam::123456789012:role/gitlab-secrets-role&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Defining Secrets in Jobs
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Standard Form
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-secrets/database&lt;/span&gt;
      &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;password&lt;/span&gt;
    &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;password&lt;/code&gt; field is extracted from JSON&lt;/li&gt;
&lt;li&gt;  Value is exposed as &lt;code&gt;$DATABASE_PASSWORD&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;file: false&lt;/code&gt; → variable, not file path&lt;/li&gt;
&lt;/ul&gt;






&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;API_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-secrets/api#api_key&lt;/span&gt;
    &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Format:&lt;br&gt;
    secret-name[#json-field]&lt;/p&gt;


&lt;h2&gt;
  
  
  Working with Full JSON Secrets
&lt;/h2&gt;

&lt;p&gt;If you don’t specify &lt;code&gt;field&lt;/code&gt;, GitLab retrieves the &lt;strong&gt;entire value&lt;/strong&gt;.&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="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;FULL_SECRET&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-secrets/api&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&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;cat&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$FULL_SECRET&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | jq &lt;span class="nt"&gt;-r&lt;/span&gt; &lt;span class="s1"&gt;'.api_key'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Secret Versioning
&lt;/h2&gt;

&lt;p&gt;You can pin secrets to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  A &lt;strong&gt;version stage&lt;/strong&gt; (recommended)&lt;/li&gt;
&lt;li&gt;  A &lt;strong&gt;specific version ID&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version_stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;AWSCURRENT&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&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="na"&gt;version_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;01234567-89ab-cdef-0123-456789abcdef&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You cannot specify both.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cross‑Account Access
&lt;/h2&gt;

&lt;p&gt;To read secrets from another AWS account:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Use &lt;strong&gt;OIDC&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  Use the &lt;strong&gt;full secret ARN&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:secretsmanager:us-east-1:987654321098:secret:shared-api-keys-AbCdEf&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;IAM role must trust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  GitLab’s OIDC provider&lt;/li&gt;
&lt;li&gt;  The specific GitLab project/group&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Per‑Secret Overrides (Advanced)
&lt;/h2&gt;

&lt;p&gt;You can override AWS settings &lt;strong&gt;per secret&lt;/strong&gt;:&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="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;eu-app-secrets/database&lt;/span&gt;
  &lt;span class="na"&gt;region&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;eu-west-1&lt;/span&gt;
  &lt;span class="na"&gt;role_arn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;arn:aws:iam::123456789012:role/eu-role&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  File vs Variable (&lt;code&gt;file: true | false&lt;/code&gt;)
&lt;/h2&gt;

&lt;p&gt;Default behavior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  GitLab writes secret to a temp file&lt;/li&gt;
&lt;li&gt;  Environment variable contains &lt;strong&gt;file path&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$DATABASE_PASSWORD&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want the raw value:&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="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then:&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;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$DATABASE_PASSWORD&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;File mode is safer for binaries &amp;amp; large secrets.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://www.debug.school/images/8oeaNiIZtq8GHJssMI6HeJvbuORImPiesbZ3kKXvEG4/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvb3FqMWFp/dW5yb3A4NGh3MW5r/NTkucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/8oeaNiIZtq8GHJssMI6HeJvbuORImPiesbZ3kKXvEG4/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvb3FqMWFp/dW5yb3A4NGh3MW5r/NTkucG5n" alt="AWS" width="450" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Use AWS Secrets Manager secrets in GitLab CI/CD
&lt;/h1&gt;

&lt;p&gt;You can use secrets stored in &lt;a href="https://aws.amazon.com/secrets-manager/" rel="noopener noreferrer"&gt;AWS Secrets Manager&lt;/a&gt;&lt;br&gt;
in your GitLab CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have access to AWS Secrets Manager in your AWS account.&lt;/li&gt;
&lt;li&gt;Configure authentication using one of the following methods:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;IAM Role&lt;/strong&gt;: Use the IAM role assigned to your GitLab Runner instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenID Connect&lt;/strong&gt;: &lt;a href="//../cloud_services/aws/_index.md"&gt;Configure OpenID Connect in AWS&lt;/a&gt; to retrieve temporary credentials.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add &lt;a href="//../variables/_index.md#for-a-project"&gt;CI/CD variables to your project&lt;/a&gt; to provide details about your AWS configuration:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;AWS_REGION&lt;/code&gt;: The AWS region where your secrets are stored.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS_ROLE_ARN&lt;/code&gt;: The ARN of the AWS IAM role to assume (required when using OpenID Connect).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS_ROLE_SESSION_NAME&lt;/code&gt;: Optional. Custom session name for the assumed role.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Use AWS Secrets Manager secrets in a CI/CD job
&lt;/h2&gt;
&lt;h3&gt;
  
  
  With IAM Role authentication
&lt;/h3&gt;

&lt;p&gt;You can use a secret stored in AWS Secrets Manager in a job by defining it with the&lt;br&gt;
&lt;code&gt;aws_secrets_manager&lt;/code&gt; keyword.&lt;/p&gt;

&lt;p&gt;This method uses the IAM role assigned to your GitLab Runner instance. When using the&lt;br&gt;
&lt;a href="https://docs.gitlab.com/runner/executors/kubernetes/" rel="noopener noreferrer"&gt;Kubernetes executor&lt;/a&gt; or &lt;a href="https://docs.gitlab.com/runner/runner_autoscale/" rel="noopener noreferrer"&gt;autoscaling&lt;/a&gt;,&lt;br&gt;
make sure the IAM role is applied to your runner manager.&lt;/p&gt;

&lt;p&gt;Prerequisites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitLab Runner 18.3 or later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;

&lt;span class="na"&gt;database-migration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Running database migration..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;mysql -h $DB_HOST -u $DB_USER -p$DATABASE_PASSWORD &amp;lt; migration.sql&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Migration completed successfully."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  With OpenID Connect authentication
&lt;/h3&gt;

&lt;p&gt;For enhanced security, you can use OpenID Connect to authenticate with AWS and assume a specific IAM role.&lt;br&gt;
By default, the runner looks for an ID token named &lt;code&gt;AWS_ID_TOKEN&lt;/code&gt;. For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
  &lt;span class="na"&gt;AWS_ROLE_ARN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::123456789012:role/gitlab-secrets-role'&lt;/span&gt;

&lt;span class="na"&gt;database-migration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;id_tokens&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;AWS_ID_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sts.amazonaws.com'&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Connecting to production database..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;psql postgresql://$DB_USER:$DATABASE_PASSWORD@$DB_HOST:5432/$DB_NAME -c "SELECT version();"&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Database connection successful."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also specify a custom token using the &lt;code&gt;token&lt;/code&gt; option. For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
  &lt;span class="na"&gt;AWS_ROLE_ARN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::123456789012:role/gitlab-secrets-role'&lt;/span&gt;

&lt;span class="na"&gt;database-migration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;id_tokens&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;CUSTOM_AWS_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sts.amazonaws.com'&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
      &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$CUSTOM_AWS_TOKEN&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Connecting to production database with custom token..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;psql postgresql://$DB_USER:$DATABASE_PASSWORD@$DB_HOST:5432/$DB_NAME -c "SELECT version();"&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Database connection successful."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Short form syntax
&lt;/h3&gt;

&lt;p&gt;You can use a simplified syntax by specifying the secret ID as a string.&lt;br&gt;
You can optionally specify a field by separating it with a &lt;code&gt;#&lt;/code&gt; character.&lt;br&gt;
For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;

&lt;span class="na"&gt;api-deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;API_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;app-secrets/api#api_key'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;FULL_SECRET&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;app-secrets/api'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Deploying API with specific field..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;curl --header "Authorization&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Bearer $API_KEY" https://api.example.com/deploy&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Using full secret..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;curl --header "Authorization&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Bearer $(cat $FULL_SECRET | jq --raw-output '.api_key')" https://api.example.com/status&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Secret versioning
&lt;/h2&gt;

&lt;p&gt;AWS Secrets Manager supports multiple versions of secrets. You can specify a particular version&lt;br&gt;
using either &lt;code&gt;version_id&lt;/code&gt; or &lt;code&gt;version_stage&lt;/code&gt;. For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;

&lt;span class="na"&gt;production-deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;prod-app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
        &lt;span class="na"&gt;version_stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;AWSCURRENT'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;STAGING_DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;prod-app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
        &lt;span class="na"&gt;version_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;01234567-89ab-cdef-0123-456789abcdef'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Deploying to production with current secret version..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;deploy-prod.sh --db-password $DATABASE_PASSWORD&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Testing with specific secret version..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;test-with-version.sh --db-password $STAGING_DATABASE_PASSWORD&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cross-account secret access
&lt;/h2&gt;

&lt;p&gt;To retrieve secrets from another AWS account, you must use the full ARN.&lt;br&gt;
For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
  &lt;span class="na"&gt;AWS_ROLE_ARN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::123456789012:role/cross-account-secrets-role'&lt;/span&gt;

&lt;span class="na"&gt;cross-account-deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;id_tokens&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;AWS_ID_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sts.amazonaws.com'&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;SHARED_API_KEY&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:secretsmanager:us-east-1:987654321098:secret:shared-api-keys-AbCdEf'&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;production_key'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Accessing shared secret from another account..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;curl --header "Authorization&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Bearer $SHARED_API_KEY" https://shared-api.example.com/deploy&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Per-secret configuration overrides
&lt;/h2&gt;

&lt;p&gt;You can override global AWS settings on a per-secret basis. For example:&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="na"&gt;variables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;AWS_REGION&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-east-1&lt;/span&gt;
  &lt;span class="na"&gt;AWS_ROLE_ARN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::123456789012:role/default-role'&lt;/span&gt;

&lt;span class="na"&gt;multi-region-deployment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;id_tokens&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;AWS_ID_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sts.amazonaws.com'&lt;/span&gt;
    &lt;span class="na"&gt;EU_AWS_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aud&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sts.amazonaws.com'&lt;/span&gt;
  &lt;span class="na"&gt;secrets&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;EU_DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;eu-app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
        &lt;span class="na"&gt;region&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;eu-west-1'&lt;/span&gt;
        &lt;span class="na"&gt;role_arn&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;arn:aws:iam::123456789012:role/eu-deployment-role'&lt;/span&gt;
        &lt;span class="na"&gt;role_session_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;gitlab-eu-deployment'&lt;/span&gt;
      &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$EU_AWS_TOKEN&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;US_DATABASE_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;aws_secrets_manager&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;secret_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;us-app-secrets/database&lt;/span&gt;
        &lt;span class="na"&gt;field&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;password'&lt;/span&gt;
      &lt;span class="na"&gt;file&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;stage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deploy&lt;/span&gt;
  &lt;span class="na"&gt;script&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 "Deploying to EU region..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;deploy-to-eu.sh --db-password $EU_DATABASE_PASSWORD&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;echo "Deploying to US region..."&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;deploy-to-us.sh --db-password $US_DATABASE_PASSWORD&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In these examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;aud&lt;/code&gt;: The audience, which must match the audience used when &lt;a href="//../cloud_services/aws/_index.md"&gt;creating the federated identity credentials&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;secret_id&lt;/code&gt;: The name or ARN of the secret in AWS Secrets Manager. To retrieve a secret from another account, you must use an ARN.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;field&lt;/code&gt;: Is the specific key in the JSON secret to retrieve. If not specified, the entire secret is retrieved.
Field access is only supported for flat JSON secrets (top-level keys only) and supports string, number, and boolean values.
For example:

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;password&lt;/code&gt;: Accesses the &lt;code&gt;password&lt;/code&gt; field.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;api_key&lt;/code&gt;: Accesses the &lt;code&gt;api_key&lt;/code&gt; field.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;token&lt;/code&gt;: Specifies which ID token to use for authentication. If not specified, the runner looks for a token named &lt;code&gt;AWS_ID_TOKEN&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;version_id&lt;/code&gt;: Is the unique identifier of a specific version of the secret.
If you don't specify either &lt;code&gt;version_id&lt;/code&gt; or &lt;code&gt;version_stage&lt;/code&gt;, AWS Secrets Manager returns the &lt;code&gt;AWSCURRENT&lt;/code&gt; version.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;version_stage&lt;/code&gt;: The staging label of the version of the secret to retrieve (such as &lt;code&gt;AWSCURRENT&lt;/code&gt; or &lt;code&gt;AWSPENDING&lt;/code&gt;).
You cannot specify both &lt;code&gt;version_id&lt;/code&gt; and &lt;code&gt;version_stage&lt;/code&gt; for the same secret.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;region&lt;/code&gt;: Overrides the global &lt;code&gt;AWS_REGION&lt;/code&gt; for this specific secret.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;role_arn&lt;/code&gt;: Overrides the global &lt;code&gt;AWS_ROLE_ARN&lt;/code&gt; for this specific secret.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;role_session_name&lt;/code&gt;: Overrides the global &lt;code&gt;AWS_ROLE_SESSION_NAME&lt;/code&gt; for this specific secret.&lt;/li&gt;

&lt;li&gt;GitLab fetches the secret from AWS Secrets Manager and stores the value in a temporary file.
The path to this file is stored in a CI/CD variable, similar to
&lt;a href="//../variables/_index.md#use-file-type-cicd-variables"&gt;file type CI/CD variables&lt;/a&gt;.&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;p&gt;Refer to &lt;a href="//../cloud_services/aws/_index.md#troubleshooting"&gt;OIDC for AWS troubleshooting&lt;/a&gt; for general&lt;br&gt;
problems when setting up OIDC with AWS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Error: &lt;code&gt;no EC2 IMDS role found&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The following error might happen if both of these conditions are true:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The CI/CD job is configured to use IAM role authentication.&lt;/li&gt;
&lt;li&gt;The job is executed by a runner with the &lt;a href="https://docs.gitlab.com/runner/executors/kubernetes/" rel="noopener noreferrer"&gt;Kubernetes executor&lt;/a&gt; hosted on AWS EKS.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Resolving secrets
Resolving secret "MY_AWS_SECRET"...
Using "aws_secrets_manager" secret resolver...
ERROR: Job failed (system failure): resolving secrets: operation error Secrets Manager: GetSecretValue, get identity: get credentials: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, canceled, context deadline exceeded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;Resolving secrets&lt;/code&gt; step is handled by the runner manager. This step accesses IAM credentials&lt;br&gt;
cached in &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html" rel="noopener noreferrer"&gt;EC2 IMDS&lt;/a&gt;.&lt;br&gt;
If the IAM role has not been applied to the runner manager, the &lt;code&gt;Resolving secrets&lt;/code&gt; step fails.&lt;/p&gt;

&lt;p&gt;To address this error, apply the correct IAM role to the runner manager.&lt;/p&gt;

&lt;p&gt;Applying the IAM role to the runner pods that are spawned and managed by the runner manager does not resolve this issue.&lt;/p&gt;

&lt;p&gt;Ref: &lt;a href="https://docs.gitlab.com/ci/secrets/aws_secrets_manager/" rel="noopener noreferrer"&gt;https://docs.gitlab.com/ci/secrets/aws_secrets_manager/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fix invalid checkpoint record in Postgres</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Tue, 31 Mar 2026 22:10:21 +0000</pubDate>
      <link>https://www.debug.school/suyash/fix-invalid-checkpoint-record-in-postgres-2jd0</link>
      <guid>https://www.debug.school/suyash/fix-invalid-checkpoint-record-in-postgres-2jd0</guid>
      <description>&lt;p&gt;When PostgreSQL is unable to detect a valid checkpoint from which to begin the recovery procedure, it displays the error &lt;strong&gt;"PANIC: could not locate a valid checkpoint record."&lt;/strong&gt; This may occur if the PostgreSQL container is not restarted safely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prevent data corruption
&lt;/h2&gt;

&lt;p&gt;For stateful applications like databases, the first method is to use &lt;em&gt;Stateful Sets&lt;/em&gt; rather than &lt;em&gt;Deployments&lt;/em&gt;; this is a Kubernetes best practice. To preserve the stability and integrity of your database, Stateful Sets offer assurances regarding the ordering and uniqueness of pods. Additionally, stateful sets will manage restarts more effectively.&lt;/p&gt;

&lt;p&gt;The second method is to safely shut down your PostgreSQL instance by using a &lt;code&gt;preStop&lt;/code&gt; hook in Kubernetes.&lt;br&gt;
Before a pod is terminated in Kubernetes, the &lt;code&gt;preStop&lt;/code&gt; hook is invoked. Once the &lt;code&gt;preStop&lt;/code&gt; hook is finished, the pod's termination process starts.&lt;/p&gt;

&lt;p&gt;Apply the preStop hook in a Kubernetes configuration for PostgreSQL:&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="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;StatefulSet&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&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;postgres&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;replicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
  &lt;span class="na"&gt;serviceName&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;postgres"&lt;/span&gt;
  &lt;span class="na"&gt;selector&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;matchLabels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
  &lt;span class="na"&gt;template&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&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;postgres&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:latest&lt;/span&gt;
        &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;containerPort&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5432&lt;/span&gt;
        &lt;span class="na"&gt;volumeMounts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&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;postgres-data&lt;/span&gt;
          &lt;span class="na"&gt;mountPath&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/var/lib/postgresql/data&lt;/span&gt;
        &lt;span class="na"&gt;lifecycle&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;preStop&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;exec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
              &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/bin/sh"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-c"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;pg_ctl&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-D&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;/var/lib/postgres/data&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-w&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-t&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;60&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-m&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;fast&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;stop"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;volumeClaimTemplates&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;metadata&lt;/span&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;postgres-data&lt;/span&gt;
    &lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;accessModes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;ReadWriteOnce"&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;
      &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;storage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;1Gi&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;This &lt;code&gt;preStop&lt;/code&gt; hook runs the &lt;code&gt;pg_ctl&lt;/code&gt; stop command to shut down the PostgreSQL server. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-D /var/lib/postgres/data&lt;/code&gt; option specifies the directory where the data base files live, &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-w&lt;/code&gt; waits until the server shuts down, &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-t 60&lt;/code&gt; specifies the wait timeout in seconds, and &lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-m fast&lt;/code&gt; means to do a "fast" shutdown, which rolls back all active transactions, disconnects clients immediately and shuts down.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For AWS ECS deployments you can set the &lt;strong&gt;Min and max running tasks&lt;/strong&gt; respectively: &lt;code&gt;0% min and 100% max&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/3sOLGvIVNYsWsOjGFtrydWLkWXh8LGBFD1cJIiIGLew/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvZW0wOTMx/cnR3NGlrNTFocXBs/MTkucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/3sOLGvIVNYsWsOjGFtrydWLkWXh8LGBFD1cJIiIGLew/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvZW0wOTMx/cnR3NGlrNTFocXBs/MTkucG5n" alt="Postgres" width="128" height="128"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Recover from an error state
&lt;/h2&gt;

&lt;p&gt;This can be fixed by running &lt;code&gt;pg_resetwal&lt;/code&gt; command by connecting to the container. &lt;br&gt;
However, since the pod is in &lt;code&gt;crashLoopBackOff&lt;/code&gt; state, we will not be able to connect to the container.&lt;br&gt;
We must first make the pod to be in stable state to execute the command.&lt;/p&gt;

&lt;p&gt;Please follow the steps below for manual execution of the command &lt;code&gt;pg_resetwal&lt;/code&gt; in a container. &lt;br&gt;
This process requires the pod to be in a stable state, and not in a crash loop. &lt;br&gt;
You can achieve this by introducing a delay in the &lt;code&gt;postgres-deployment.yaml&lt;/code&gt; file.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Scale down the deployment by reducing the replica count of the deployment to zero using the following command: &lt;code&gt;kubectl scale deployment postgres - replicas=0&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Introduce a delay: Modify the &lt;code&gt;postgres-deployment.yaml&lt;/code&gt; file to include a sleep command that delays the initialization process by 600 seconds, keeping the pod in the initializing state.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here is an example of how to add it:&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="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&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;postgres&lt;/span&gt;
        &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:latest&lt;/span&gt;
        &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/bin/bash"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-c"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt; 
        &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sleep&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;600;"&lt;/span&gt; &lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Scale up the deployment: Bring the deployment back up by increasing the replica count to one using the following command: &lt;code&gt;kubectl scale deployment postgres - replicas=1&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Execute &lt;code&gt;pg_resetwal&lt;/code&gt; in the pod: Once the pod reaches the initializing state, run the &lt;code&gt;pg_resetwal&lt;/code&gt; command by executing into the pod. Here is how you can do this:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;kubectl &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; postgres - /bin/bash
su postgres
pg_resetwal /var/lib/postgres/data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Proceed despite the warning: If you do receive the warning, continue the process by forcing the &lt;code&gt;pg_resetwal&lt;/code&gt; command as follows: &lt;code&gt;pg_resetwal /var/lib/posgtgres/data -f&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After running this command, you should receive a confirmation message stating “Write-ahead log reset.”&lt;br&gt;
After you have successfully executed the pg_resetwal command, you should be able to restart the PostgreSQL server. &lt;br&gt;
Remember that the &lt;code&gt;pg_resetwal&lt;/code&gt; command is a measure of last resort and carries the risk of data loss or inconsistency.&lt;br&gt;
Always make sure to maintain regular backups of your PostgreSQL databases and consider setting up high availability and replication solutions for your production databases.&lt;/p&gt;

&lt;p&gt;Ref: &lt;a href="https://medium.com/@adnanitdev/fix-for-error-panic-could-not-locate-a-valid-checkpoint-record-in-postgres-or-citus-running-in-b03d8341a258" rel="noopener noreferrer"&gt;https://medium.com/@adnanitdev/fix-for-error-panic-could-not-locate-a-valid-checkpoint-record-in-postgres-or-citus-running-in-b03d8341a258&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>postgres</category>
      <category>data</category>
      <category>kubernetes</category>
    </item>
    <item>
      <title>VMWare vExpert Program</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Thu, 29 Jan 2026 04:35:52 +0000</pubDate>
      <link>https://www.debug.school/suyash/vmware-vexpert-program-3j84</link>
      <guid>https://www.debug.school/suyash/vmware-vexpert-program-3j84</guid>
      <description>&lt;h1&gt;
  
  
  Announcement: vExpert 2025 Recognition
&lt;/h1&gt;

&lt;p&gt;I am pleased to share that I have been recognised as a &lt;strong&gt;vExpert&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
Directory Listing: &lt;a href="https://vexpert.vmware.com/directory/9629" rel="noopener noreferrer"&gt;https://vexpert.vmware.com/directory/9629&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/ZHtHE_fmdqyd9OJHjKEzImAFGcYwFocWVi0TQNDIDgY/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvaHd2ejQw/bzM3Y3pmejh0cTd3/MXIucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/ZHtHE_fmdqyd9OJHjKEzImAFGcYwFocWVi0TQNDIDgY/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvaHd2ejQw/bzM3Y3pmejh0cTd3/MXIucG5n" alt="Suyash vExpert" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  vExpert Badge
&lt;/h2&gt;

&lt;p&gt;The vExpert program highlights individuals who demonstrate a strong passion for VMware technologies and who dedicate their time to sharing knowledge through blogs, forums, community groups, and various online or in‑person events. I am honoured to be part of such a dynamic and collaborative community, where ideas continually evolve and opportunities to engage with experts from around the world are abundant.&lt;/p&gt;




&lt;h2&gt;
  
  
  Importance of the vExpert Program
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;VMware by Broadcom vExpert Program&lt;/strong&gt; is a global community recognition initiative that acknowledges individuals who have made meaningful contributions to the VMware ecosystem. The program welcomes anyone with a deep interest in VMware products and services and seeks to recognise those who actively share their expertise, insights, and experiences with the broader community.&lt;/p&gt;

&lt;p&gt;I am particularly grateful for the wealth of technical blogs, articles, and resources produced by fellow vExperts. Their contributions not only support other vExperts but also provide invaluable guidance to VMware professionals worldwide. These resources span a wide range of topics, including best practices, troubleshooting, automation, networking, and advanced virtualisation concepts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Ways to Qualify for vExpert
&lt;/h2&gt;

&lt;p&gt;The vExpert award recognises contributions across multiple categories, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Enterprise/Internal Influencer&lt;/strong&gt; – Leading internal knowledge‑sharing sessions such as workshops or webinars on VMware technologies.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Blogging&lt;/strong&gt; – Publishing educational content on VMware products or events like VMware Explore.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code Sharing&lt;/strong&gt; – Providing tools, scripts, or code samples through websites, apps, VMware {code}, or internal platforms.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event Speaking&lt;/strong&gt; – Presenting at VMUG meetings, VMware Explore, or other industry conferences.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Podcasting&lt;/strong&gt; – Hosting or co‑hosting podcasts focused on VMware topics.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Video Content&lt;/strong&gt; – Creating tutorials, demonstrations, or technical walkthroughs on platforms such as YouTube.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Online Forums&lt;/strong&gt; – Supporting the community by answering questions on VMTN or VMware‑related Reddit communities.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VMUG Leadership Support&lt;/strong&gt; – Assisting local VMUG chapters in leadership or organisational roles.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;a href="https://www.debug.school/images/Yr85v5lYc4HIqa9e21yN2BcTFkcHjBjc0nOAjlC1XiE/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvaWc1ejN3/ZWE1dzJsOTRvODEz/ZW8ucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/Yr85v5lYc4HIqa9e21yN2BcTFkcHjBjc0nOAjlC1XiE/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvaWc1ejN3/ZWE1dzJsOTRvODEz/ZW8ucG5n" alt="vExpert" width="400" height="400"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Value of the vExpert Program
&lt;/h2&gt;

&lt;p&gt;Becoming a vExpert provides numerous benefits that extend well beyond recognition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Content Promotion&lt;/strong&gt; – vExpert content is amplified through VMware’s official social channels, LinkedIn, Broadcom Advocacy, and the VMware Blog RSS feed, increasing visibility and engagement.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Personal Brand Development&lt;/strong&gt; – The vExpert title enhances professional credibility and strengthens your reputation within the technology community.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Professional Recognition&lt;/strong&gt; – Inclusion in the vExpert Directory and on LinkedIn validates your community contributions and helps distinguish you in your career.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complimentary VMUG Advantage Membership&lt;/strong&gt; – Includes access to valuable resources and discounts.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free VMware Licenses&lt;/strong&gt; – vExperts receive VCF Home Lab licenses through VMUG Advantage (subject to passing the VCP‑VCF exam), enabling hands‑on learning and skill development.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Exclusive Networking Opportunities&lt;/strong&gt; – Access to private vExpert communication channels and industry experts.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Early Access &amp;amp; NDA Briefings&lt;/strong&gt; – Participation in NDA sessions and early access to VMware roadmap materials.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;VMware Explore Blogger Passes&lt;/strong&gt; – Complimentary blogger access to VMware Explore events (limited availability).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Pathways to Becoming a vExpert
&lt;/h2&gt;

&lt;p&gt;There are several recognised avenues for contributing to the VMware community:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enterprise / Internal Influencers
&lt;/li&gt;
&lt;li&gt;Bloggers
&lt;/li&gt;
&lt;li&gt;Code Contributors
&lt;/li&gt;
&lt;li&gt;VMUG Leaders
&lt;/li&gt;
&lt;li&gt;Event Speakers
&lt;/li&gt;
&lt;li&gt;Podcasters
&lt;/li&gt;
&lt;li&gt;Online Forum Supporters
&lt;/li&gt;
&lt;li&gt;Authors
&lt;/li&gt;
&lt;li&gt;VCDX Certification Holders
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Beyond being a symbol of achievement, the vExpert program empowers individuals to expand their professional network, strengthen their personal brand, and gain access to exclusive resources and events.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/SfyboDN5ATMkFcY4k_uRPHk1a2auX290H3hquvYunP0/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvNGdqb2F6/eWJ1ZTYzNHlkZDZ4/bHYucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/SfyboDN5ATMkFcY4k_uRPHk1a2auX290H3hquvYunP0/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvNGdqb2F6/eWJ1ZTYzNHlkZDZ4/bHYucG5n" alt="vExpert 5 Years" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing Thoughts
&lt;/h2&gt;

&lt;p&gt;Being part of the vExpert community is not solely about holding a title—it is about the collective impact we make on the VMware ecosystem. One of the most valuable aspects of this community is the wealth of knowledge shared by its members, which continues to inspire and support professionals across the globe.&lt;/p&gt;

&lt;p&gt;If you found this article helpful, a share on &lt;strong&gt;LinkedIn&lt;/strong&gt; or &lt;strong&gt;X&lt;/strong&gt; would be greatly appreciated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;vExpert Suyash Sambhare&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Directory Listing: &lt;a href="https://vexpert.vmware.com/directory/9629" rel="noopener noreferrer"&gt;https://vexpert.vmware.com/directory/9629&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For more information, visit the official vExpert website: &lt;a href="https://vexpert.vmware.com" rel="noopener noreferrer"&gt;https://vexpert.vmware.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vmware</category>
      <category>vexpert</category>
      <category>broadcom</category>
      <category>devops</category>
    </item>
    <item>
      <title>DevOps Training</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Tue, 13 Jan 2026 03:28:07 +0000</pubDate>
      <link>https://www.debug.school/suyash/devops-training-5hi</link>
      <guid>https://www.debug.school/suyash/devops-training-5hi</guid>
      <description>&lt;h2&gt;
  
  
  Application Development Concepts
&lt;/h2&gt;

&lt;p&gt;• History of Application Development&lt;br&gt;
• Evolution of Application Development Methodologies&lt;br&gt;
• Introduction to Application Architectures&lt;br&gt;
• Introduction to the Application Development Lifecycle&lt;br&gt;
• Application Testing and Quality Assurance&lt;br&gt;
• Application Monitoring, Maintenance, and Support&lt;/p&gt;




&lt;h2&gt;
  
  
  Application Security Fundamentals
&lt;/h2&gt;

&lt;p&gt;• What is Secure Application Development&lt;br&gt;
• Need for Application Security&lt;br&gt;
• Common Application Security Risks and Threats&lt;br&gt;
• OWASP Top 10 Application Security Techniques&lt;br&gt;
• Secure Design Principles&lt;br&gt;
• Threat Modeling&lt;br&gt;
• Secure Coding&lt;br&gt;
• Secure Code Review&lt;br&gt;
• SAST and DAST Testing&lt;br&gt;
• Secure Configurations&lt;br&gt;
• Educating Developers&lt;br&gt;
• Role of Risk Management in Secure Development&lt;br&gt;
• Project Management Role in Secure Application Development&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction to DevOps
&lt;/h2&gt;

&lt;p&gt;• Introduction to DevOps&lt;br&gt;
• DevOps Principles&lt;br&gt;
• DevOps Pipelines&lt;br&gt;
• DevOps and Project Management&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction to DevSecOps
&lt;/h2&gt;

&lt;p&gt;• Understanding DevSecOps&lt;br&gt;
• DevOps vs. DevSecOps&lt;br&gt;
• DevSecOps Principles&lt;br&gt;
• DevSecOps Culture&lt;br&gt;
• Shift-Left Security&lt;br&gt;
• DevSecOps Pipelines&lt;br&gt;
• Pillars of DevSecOps&lt;br&gt;
• DevSecOps Benefits and Challenges&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction to DevSecOps Management Tools
&lt;/h2&gt;

&lt;p&gt;• Project Management Tools&lt;br&gt;
• Integrated Development Environment (IDE) Tools&lt;br&gt;
• Source-code Management Tools&lt;br&gt;
• Build Tools&lt;br&gt;
• Continuous Testing Tools&lt;/p&gt;




&lt;p&gt;&lt;a href="https://www.debug.school/images/lj6UXdeepdxwkKW_jj0tnDLCqk5kjId7divIewOkPmc/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvdHUzYmxs/bHM1ZXl2YmQ2MTd4/bmcucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/lj6UXdeepdxwkKW_jj0tnDLCqk5kjId7divIewOkPmc/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvdHUzYmxs/bHM1ZXl2YmQ2MTd4/bmcucG5n" alt="DevOps Training" width="638" height="532"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to DevSecOps Code and CI/CD Tools
&lt;/h2&gt;

&lt;p&gt;• Continuous Integration Tools&lt;br&gt;
• Infrastructure as Code Tools&lt;br&gt;
• Configuration Management Tools&lt;br&gt;
• Continuous Monitoring Tools&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction to DevSecOps Pipelines
&lt;/h2&gt;

&lt;p&gt;• Role of DevSecOps in the CI/CD Pipeline&lt;br&gt;
• DevSecOps Tools&lt;br&gt;
• Embracing the DevSecOps Lifecycle&lt;br&gt;
• DevSecOps Ecosystem&lt;br&gt;
• Key Elements of the DevSecOps Pipeline&lt;br&gt;
• Integrating Security into the DevOps Pipeline&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction to DevSecOps CI/CD Testing and Assessments
&lt;/h2&gt;

&lt;p&gt;• Implementing Security into the CI/CD Pipeline and Security Controls&lt;br&gt;
• Continuous Security in DevSecOps with Security as Code&lt;br&gt;
• Continuous Application Testing for CI/CD Pipeline Security&lt;br&gt;
• Application Assessments and Penetration Testing&lt;/p&gt;




&lt;h2&gt;
  
  
  Implementing DevSecOps Testing and Threat Modeling
&lt;/h2&gt;

&lt;p&gt;• Integrating Security Threat Modeling in Plan Stage&lt;br&gt;
• Integrating Secure Coding in Code Stage&lt;br&gt;
• Integrating SAST, DAST, and IAST in Build and Test Stage&lt;br&gt;
• Integrating RASP and VAPT in Release and Deploy Stage&lt;/p&gt;




&lt;h2&gt;
  
  
  Implementing DevSecOps Monitoring Feedback
&lt;/h2&gt;

&lt;p&gt;• Implementing Infrastructure as Code (IaC)&lt;br&gt;
• Integrating Configuration Orchestration&lt;br&gt;
• Integrating Security in Operate and Monitor Stage&lt;br&gt;
• Integrating Compliance as Code (CaC)&lt;br&gt;
• Integrating Logging, Monitoring, and Alerting&lt;br&gt;
• Integrating Continuous Feedback Loop&lt;/p&gt;

</description>
      <category>devops</category>
      <category>learning</category>
      <category>training</category>
      <category>online</category>
    </item>
    <item>
      <title>EFS Utils</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Wed, 07 Jan 2026 23:34:57 +0000</pubDate>
      <link>https://www.debug.school/suyash/efs-utils-3pd9</link>
      <guid>https://www.debug.school/suyash/efs-utils-3pd9</guid>
      <description>&lt;h2&gt;
  
  
  Utilities for Amazon Elastic File System
&lt;/h2&gt;

&lt;p&gt;AWS EFS (Elastic File System) Utils is a mount helper for using Amazon EFS file systems used for various tasks related to managing and using Amazon EFS services. Here’s a breakdown of their primary functionalities:&lt;/p&gt;

&lt;h2&gt;
  
  
  Purpose of AWS EFS Utils
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Mounting EFS File Systems
&lt;/h3&gt;

&lt;p&gt;AWS EFS Utils provide easy-to-use commands for mounting EFS file systems to EC2 instances, allowing you to access files stored in EFS from your applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Performance Management
&lt;/h3&gt;

&lt;p&gt;The tools include options to configure mount settings that can optimize performance based on your specific workload needs, such as choosing throughput modes.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Automatic DNS Resolution
&lt;/h3&gt;

&lt;p&gt;EFS Utils help automatically resolve the correct DNS name for the EFS file system, simplifying the mounting process.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Health Monitoring
&lt;/h3&gt;

&lt;p&gt;These utils include commands that can be used to check the health and status of your EFS file systems, ensuring they are functioning correctly.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Security Configuration
&lt;/h3&gt;

&lt;p&gt;AWS EFS Utils help with configuring security options like AWS Identity and Access Management (IAM) policies and mounted instances' security groups, enhancing security during access.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Command-Line Interface
&lt;/h3&gt;

&lt;p&gt;The utilities provide a command-line interface for performing various administrative tasks related to EFS, making it easier to integrate EFS with your scripts or applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Troubleshooting
&lt;/h3&gt;

&lt;p&gt;They also include features for debugging and monitoring, allowing users to diagnose and troubleshoot issues that may arise during usage.&lt;/p&gt;



&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;AWS EFS Utils streamline the process of using Amazon EFS by providing tools for mounting, managing, and optimizing EFS interactions, making it a vital component for applications that require scalable file storage. If you have specific scenarios in mind for using EFS, let me know!&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;efs-utils&lt;/code&gt; package has been verified against the following Linux distributions:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Distribution&lt;/th&gt;
&lt;th&gt;Package Type&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;init&lt;/code&gt; System&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Linux 2&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amazon Linux 2023&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RHEL 8&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RHEL 9&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ubuntu 20.04&lt;/td&gt;
&lt;td&gt;&lt;code&gt;deb&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ubuntu 22.04&lt;/td&gt;
&lt;td&gt;&lt;code&gt;deb&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ubuntu 24.04&lt;/td&gt;
&lt;td&gt;&lt;code&gt;deb&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OpenSUSE Leap&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;SLES 15&lt;/td&gt;
&lt;td&gt;&lt;code&gt;rpm&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemd&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To install AWS EFS (Elastic File System) Utils on Ubuntu, follow these steps:&lt;/p&gt;

&lt;p&gt;Note: Building from source requires Rust 1.70+, Cargo, Go 1.17.13+, CMake 3.0+, GCC/G++, and Perl.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing AWS EFS Utils on Ubuntu
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Step 1: Update the Package Index
&lt;/h3&gt;

&lt;p&gt;Open your terminal and update the package index:&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;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Install Required Packages
&lt;/h3&gt;

&lt;p&gt;Install the necessary packages for building the EFS Utils:&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;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; git make gcc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Clone the EFS Utils Repository
&lt;/h3&gt;

&lt;p&gt;Clone the AWS EFS Utils GitHub repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/aws/efs-utils
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Change Directory
&lt;/h3&gt;

&lt;p&gt;Navigate into the cloned directory:&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;cd &lt;/span&gt;efs-utils
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Install EFS Utils
&lt;/h3&gt;

&lt;p&gt;Run the make command to compile and install:&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;make &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Verify Installation
&lt;/h3&gt;

&lt;p&gt;To ensure that the EFS Utils are installed correctly, you can check the version:&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;efs-utils &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see the version number, the installation was successful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Detailed Installation Information
&lt;/h3&gt;

&lt;h1&gt;
  
  
  Building efs-utils from Source
&lt;/h1&gt;

&lt;p&gt;This guide provides detailed instructions for building &lt;code&gt;efs-utils&lt;/code&gt; from source on various Linux distributions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build Prerequisites
&lt;/h2&gt;

&lt;p&gt;Building efs-utils v2.0+ requires the following dependencies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;rust&lt;/code&gt; 1.70+&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cargo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;go&lt;/code&gt; 1.17.13+&lt;/li&gt;
&lt;li&gt;&lt;code&gt;perl&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cmake&lt;/code&gt; 3.0+&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gcc&lt;/code&gt; and &lt;code&gt;g++&lt;/code&gt; (or &lt;code&gt;gcc-c++&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;make&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Recommended Resource Size:&lt;/strong&gt; minimum 2 vCPUs, 4GB RAM to ensure sufficient resources for compilation. In AWS EC2, use t3.medium or larger.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Rust and Cargo
&lt;/h2&gt;

&lt;p&gt;If your distribution doesn't provide a rust or cargo package, or it provides versions&lt;br&gt;
that are older than 1.70, then you can install rust and cargo through rustup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;--proto&lt;/span&gt; &lt;span class="s1"&gt;'=https'&lt;/span&gt; &lt;span class="nt"&gt;--tlsv1&lt;/span&gt;.2 &lt;span class="nt"&gt;-sSf&lt;/span&gt; https://sh.rustup.rs | sh
&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/.cargo/env"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Installing Go
&lt;/h2&gt;

&lt;p&gt;Ensure you have Go 1.17.13 or later is installed and configured on your system.&lt;br&gt;
Some distributions provide Go packages through package manager, but they may have outdated versions.&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;# DEB-based&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get update  
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install &lt;/span&gt;golang

&lt;span class="c"&gt;# Verify Go 1.17.13 or later is installed&lt;/span&gt;
go version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GCC Version Requirements
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install GCC 13 (if not already installed)&lt;/span&gt;
&lt;span class="c"&gt;# For Debian 13&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; gcc-13 g++-13

&lt;span class="c"&gt;# Set GCC 13 as the compiler for the build&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gcc-13
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CXX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;g++-13
&lt;span class="c"&gt;# Then proceed with the normal build steps&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Ubuntu 20.04, upgrade to use gcc-10 and g++-10&lt;/strong&gt;&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;# Install GCC 10&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install &lt;/span&gt;gcc-10 g++-10

&lt;span class="c"&gt;# Set GCC 10 as the compiler for the build&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CC&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;gcc-10
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;CXX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;g++-10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Alternatively, you can set the system default compiler using &lt;code&gt;update-alternatives&lt;/code&gt; (requires sudo and affects all applications)&lt;/p&gt;

&lt;h2&gt;
  
  
  CMake version requirement
&lt;/h2&gt;

&lt;p&gt;Building AWS-LC requires CMake 3.0 or later. CMake is typically available through the standard packager manager.&lt;/p&gt;

&lt;h2&gt;
  
  
  DEB-based Distributions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Debian/Ubuntu
&lt;/h3&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;apt-get update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install &lt;/span&gt;git binutils rustc cargo libssl-dev pkg-config gettext make gcc g++ cmake wget perl &lt;span class="c"&gt;# remove gcc g++ here if you already installed a compatible version following GCC Version Requirements instruction&lt;/span&gt;
git clone https://github.com/aws/efs-utils
&lt;span class="nb"&gt;cd &lt;/span&gt;efs-utils
./build-deb.sh
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install&lt;/span&gt; ./build/amazon-efs-utils&lt;span class="k"&gt;*&lt;/span&gt;deb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running Tests
&lt;/h2&gt;

&lt;p&gt;After building from source, you can run the test suite:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Set up a virtualenv:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;virtualenv ~/.envs/efs-utils
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.envs/efs-utils/bin/activate
pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run tests:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;make &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Verifying Installation
&lt;/h2&gt;

&lt;p&gt;After installation, verify efs-utils is working:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mount.efs &lt;span class="nt"&gt;--version&lt;/span&gt;
/usr/sbin/mount.efs Version: 2.2.0

mount.efs &lt;span class="nt"&gt;--help&lt;/span&gt;
Usage: mount.efs &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;--version&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-h&lt;/span&gt;|--help] &amp;lt;fsname&amp;gt; &amp;lt;mountpoint&amp;gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;-o&lt;/span&gt; &amp;lt;options&amp;gt;]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Additional Notes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Make sure you have &lt;code&gt;nfs-common&lt;/code&gt; installed, as it is required for mounting EFS file systems. You can install it with:
&lt;/li&gt;
&lt;/ul&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;apt &lt;span class="nb"&gt;install &lt;/span&gt;nfs-common
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.debug.school/images/-7VTkcsuKAwajdjj4ChE-gTsDO9hS5ClKu7Fou91guU/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvejE0ajJp/dnFiMHBpZjBmeXZ2/NGQucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/-7VTkcsuKAwajdjj4ChE-gTsDO9hS5ClKu7Fou91guU/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvejE0ajJp/dnFiMHBpZjBmeXZ2/NGQucG5n" alt="Efs Utils" width="472" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  mount.efs
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;efs-utils&lt;/code&gt; includes a mount helper utility, &lt;code&gt;mount.efs&lt;/code&gt;, that simplifies and improves the performance of EFS file system mounts.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mount.efs&lt;/code&gt; launches a proxy process that forwards NFS traffic from the kernel's NFS client to EFS.&lt;br&gt;
This proxy is responsible for TLS encryption, and for providing improved throughput performance.&lt;/p&gt;

&lt;p&gt;To mount with the recommended default options, simply run:&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount file system to a specific mount target of the file system, run:&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;mounttargetip&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;mount-target-ip-address file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount file system within a given network namespace, run:&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;netns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;netns-path file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount file system to the mount target in a specific availability zone (e.g. us-east-1a), run:&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;az&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;az-name file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount file system to the mount target in a specific region (e.g. us-east-1), run:&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nv"&gt;region&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;region-name file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount the filesystem mount target in the same physical availability zone ID (e.g. use1-az1) as the client instance over cross-AWS-account mounts, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo mount -t efs -o crossaccount file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount over TLS, simply add the &lt;code&gt;tls&lt;/code&gt; option:&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; tls file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To authenticate with EFS using the system’s IAM identity, add the &lt;code&gt;iam&lt;/code&gt; option. This option requires the &lt;code&gt;tls&lt;/code&gt; option.&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; tls,iam file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount using an access point, use the &lt;code&gt;accesspoint=&lt;/code&gt; option. This option requires the &lt;code&gt;tls&lt;/code&gt; option.&lt;br&gt;
The access point must be in the "available" state before it can be used to mount EFS.&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;mount &lt;span class="nt"&gt;-t&lt;/span&gt; efs &lt;span class="nt"&gt;-o&lt;/span&gt; tls,accesspoint&lt;span class="o"&gt;=&lt;/span&gt;access-point-id file-system-id efs-mount-point/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To mount your file system automatically with any of the options above, you can add entries to &lt;code&gt;/efs/fstab&lt;/code&gt; like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;file-system-id efs-mount-point efs _netdev,tls,iam,accesspoint&lt;span class="o"&gt;=&lt;/span&gt;access-point-id 0 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information on mounting with the mount helper, see the manual page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;man mount.efs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;mount.efs  launches  a proxy process that forwards NFS traffic from the kernel's NFS client to EFS. This proxy&lt;br&gt;
is responsible for TLS encryption, and for providing improved throughput performance.&lt;/p&gt;

&lt;p&gt;fs-id-or-dns-name has to be of one of the following two forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An EFS filesystem ID in the form of "fs-abcd1234", generated when the file system is created.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A domain name that has a resolvable DNS-CNAME record, which in turn points to a fully-qualified EFS DNS name  in  the  form  of  "fs-abcd1234.efs.us-east-1.amazonaws.com"  or  "us-east-1a.fs-abcd1234.efs.us-east-1.amazonaws.com".&lt;br&gt;
mount-point is the local directory on which the file system will be mounted.&lt;br&gt;
mount.efs automatically applies the following NFS options:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;nfsvers=4.1&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;rsize=1048576&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;wsize=1048576&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;hard&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;timeo=600&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;retrans=2&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;noresvport&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;tls (for Mac distributions)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By  default,  when using the Amazon EFS mount helper with Transport Layer Security (TLS), the mount helper enforces the certificate hostname checking and disables the use of Online Certificate  Status  Protocol  (OCSP). These options can be configured in the config file located at &lt;code&gt;/etc/amazon/efs/efs-utils.conf&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Additionally,  the  Amazon  EFS mount helper has built-in logging for troubleshooting purposes. These logs are located at &lt;code&gt;/var/log/amazon/efs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It is possible to configure your Amazon EC2 instance to automatically remount your Amazon EFS file system when it reboots. &lt;/p&gt;

&lt;h3&gt;
  
  
  Options
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;-o&lt;/code&gt;,  Options  are specified with a -o flag followed by a comma separated string of options. All of the options specified in nfs are available, in addition to the following EFS-specific options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;tls&lt;/code&gt;: Mounts the EFS file system over TLS. For EC2 instances using Mac distributions, this option is by default passed and the EFS file system is mounted over TLS.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;notls&lt;/code&gt;: Mounts the EFS file system without TLS, applies for Mac distributions only.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;region&lt;/code&gt;: Mounts the EFS file system from the specified region, overriding any config file value.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tlsport=n&lt;/code&gt;: Configures  the  proxy process to listen for connections from the NFS client on the specified port. This is applicable to both non-tls and tls mounts. By default, the tlsport is chosen randomly from port range defined in the config file located at &lt;code&gt;/etc/amazon/efs/efs-utils.conf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;verify=n&lt;/code&gt;:  Verify TLS certificates using the specified stunnel verify level.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ocsp / noocsp&lt;/code&gt;: Selects whether to perform OCSP validation on TLS certificates, overriding &lt;code&gt;/etc/amazon/efs/efs-utils.conf&lt;/code&gt;. By default OCSP is disabled. The ocsp mount option is incompatible with the efs-proxy process, and will revert efs-utils to the legacy &lt;code&gt;stunnel&lt;/code&gt; mode, which does not support improved per-client throughput performance.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;iam&lt;/code&gt;: Use  the  system's IAM identity to authenticate with EFS. The mount helper will try to retrieve the required IAM credentials from the following locations: the aws credentials URI passed by mount  option,  the  AWS CLI credentials file (&lt;code&gt;~/.aws/credentials&lt;/code&gt;), and the AWS CLI config file (&lt;code&gt;~/.aws/config&lt;/code&gt;), the &lt;code&gt;AWS_CONTAINER_CREDENTIALS_RELATIVE_URI&lt;/code&gt; environment variable,  the  &lt;code&gt;AssumeRoleWithWebIdentity&lt;/code&gt;,  the EC2 instance profile.  The first location that has credentials will be used. This option requires the tls option.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;rolearn&lt;/code&gt;: Role ARN for IAM authentication with AssumeRoleWithWebIdentity API.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;jwtpath&lt;/code&gt;: Identity token for IAM authentication with AssumeRoleWithWebIdentity API.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;accesspoint&lt;/code&gt;: Mount the EFS file system using the specified access point. This option requires the tls option. The access point must be in the "available" state before it can be used to mount EFS.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;awsprofile&lt;/code&gt;: Use  the  named profile used to lookup IAM credentials in the AWS CLI credentials file (&lt;code&gt;~/.aws/credentials&lt;/code&gt;) or AWS CLI config file (&lt;code&gt;~/.aws/config&lt;/code&gt;). If botocore is installed, assume the  named  profile  and  use  the  credentials of the assumed profile. If "awsprofile" is not specified, the "default" profile is used.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;awscredsuri&lt;/code&gt;: Use the relative uri to lookup IAM credentials from ecs task metadata endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cafile&lt;/code&gt;: Use the cafile as the stunnel certificate authority file.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;netns&lt;/code&gt;: Mount the EFS file system to the specified network namespace.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;az&lt;/code&gt;: Mount the EFS file system to the specified availability zone mount target.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mountport&lt;/code&gt;: Use the port 2049 to bypass portmapper daemon on EC2 Mac instances running macOS Big Sur.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;mounttargetip&lt;/code&gt;: Mount the EFS file system to the specified mount target ip address.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;stunnel&lt;/code&gt;: Forward NFS traffic from the local NFS client to EFS using stunnel instead of efs-proxy. This will enable compatibility with the ocsp mount option, but will not deliver the increased throughput performance provided by efs-proxy. This option is enabled by default for Mac clients.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ref: &lt;a href="https://github.com/aws/efs-utils" rel="noopener noreferrer"&gt;https://github.com/aws/efs-utils&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>aws</category>
      <category>efs</category>
      <category>utils</category>
    </item>
    <item>
      <title>Happy New Year!</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Thu, 01 Jan 2026 08:20:33 +0000</pubDate>
      <link>https://www.debug.school/suyash/happy-new-year-3ak9</link>
      <guid>https://www.debug.school/suyash/happy-new-year-3ak9</guid>
      <description>&lt;h2&gt;
  
  
  Happy New Year!
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/AeEsa1b1k6lAxqSrmuafDG-GjN92m8Wc8l0r_qptJus/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvajkwand5/ODRhd2d1cDEyajlh/ZDQucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/AeEsa1b1k6lAxqSrmuafDG-GjN92m8Wc8l0r_qptJus/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvajkwand5/ODRhd2d1cDEyajlh/ZDQucG5n" alt="Happy New Year!" width="128" height="48"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy New Year! &lt;br&gt;
🫥🧑🏼‍💻🪺🫕🌁🪉&lt;/p&gt;

</description>
      <category>devops</category>
      <category>newyear</category>
      <category>nye</category>
      <category>2026</category>
    </item>
    <item>
      <title>Configure SQL Container</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Wed, 17 Dec 2025 04:52:53 +0000</pubDate>
      <link>https://www.debug.school/suyash/configure-sql-container-86l</link>
      <guid>https://www.debug.school/suyash/configure-sql-container-86l</guid>
      <description>&lt;h1&gt;
  
  
  ✅ How to Configure and Customize SQL Server Linux Containers
&lt;/h1&gt;

&lt;p&gt;SQL Server on Linux containers offers powerful flexibility for development, testing, and even some production setups. You can customize your container using:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Environment variables&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Custom Dockerfiles&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Persistent storage&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Startup scripts&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Docker Compose or env‑files&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This guide walks you through each of these approaches.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Create and Customize SQL Server Linux Containers
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;1.1 Build a Customized Container&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You can create your own Dockerfile and add scripts, packages, or configuration steps.&lt;/p&gt;

&lt;p&gt;Example from Microsoft documentation: the SQL Server process &lt;strong&gt;must remain the primary (right‑most) foreground process&lt;/strong&gt;; otherwise, the container shuts down when other steps finish.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;/usr/src/app/do-my-sql-commands.sh &amp;amp; 
/opt/mssql/bin/sqlservr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;sqlservr&lt;/code&gt; is not last, the container exits immediately after your custom script finishes.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Configure Using Environment Variables
&lt;/h1&gt;

&lt;p&gt;SQL Server on Linux exposes a comprehensive set of environment variables covering setup, memory, language, storage paths, HADR, SQL Agent, ports, and more. &lt;/p&gt;

&lt;p&gt;Here are some of the most important:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Variable&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ACCEPT_EULA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Required to accept license terms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_SA_PASSWORD&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sets &lt;code&gt;sa&lt;/code&gt; password (replaces deprecated &lt;code&gt;SA_PASSWORD&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_PID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Sets edition or product key&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_COLLATION&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Default collation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_LCID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Language locale&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_MEMORY_LIMIT_MB&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Max memory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_TCP_PORT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Listen port (default 1433)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;MSSQL_DATA_DIR&lt;/code&gt; / &lt;code&gt;MSSQL_LOG_DIR&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Custom data &amp;amp; log paths&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_BACKUP_DIR&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Backup directory&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_AGENT_ENABLED&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enable SQL Agent (true/false)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MSSQL_ENABLE_HADR&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Enable Availability Groups&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Example Container Run
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"ACCEPT_EULA=Y"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_SA_PASSWORD=MyP@ssw0rd!"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_AGENT_ENABLED=true"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_TCP_PORT=1533"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 1533:1533 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; sqlserver &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; mcr.microsoft.com/mssql/server:2022-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  3. Persisting Data (Critical!)
&lt;/h1&gt;

&lt;p&gt;Container files are &lt;em&gt;ephemeral&lt;/em&gt;. To retain your databases, use volumes.&lt;/p&gt;

&lt;p&gt;SQL Server recommends mounting &lt;strong&gt;/var/opt/mssql&lt;/strong&gt;, the location for data, logs, dumps, and configs. &lt;/p&gt;

&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"ACCEPT_EULA=Y"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_SA_PASSWORD=MyP@ssw0rd!"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-v&lt;/span&gt; ~/sqlvolumes:/var/opt/mssql &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 1433:1433 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; sql1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; mcr.microsoft.com/mssql/server:2022-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  4. Using Docker Compose for Multi‑Container or Complex Configs
&lt;/h1&gt;

&lt;p&gt;Docker Compose simplifies multi‑step setups (e.g., AOAG clusters). It passes environment variables, mounts volumes, and orchestrates replicated SQL Server containers. &lt;/p&gt;

&lt;p&gt;Example &lt;code&gt;docker-compose.yml&lt;/code&gt;:&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="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;sql1&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;mcr.microsoft.com/mssql/server:2022-latest&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;ACCEPT_EULA&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Y"&lt;/span&gt;
      &lt;span class="na"&gt;MSSQL_SA_PASSWORD&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;MyP@ssw0rd!"&lt;/span&gt;
      &lt;span class="na"&gt;MSSQL_AGENT_ENABLED&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;true"&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;1433:1433"&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;sql1data:/var/opt/mssql&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;sql1data&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://www.debug.school/images/g7Lp-JMEvt7QBMt9QRFPg3djRDDBbTYhxdADeexIPFk/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvcHg3d3Qx/a20xY2JheXE4ZTQ2/aXIuanBn" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/g7Lp-JMEvt7QBMt9QRFPg3djRDDBbTYhxdADeexIPFk/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvcHg3d3Qx/a20xY2JheXE4ZTQ2/aXIuanBn" alt="SQL" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Using .env Files for Cleaner Configuration
&lt;/h1&gt;

&lt;p&gt;Instead of piling up variables in Docker commands, store them in a file (example from Axial SQL). &lt;/p&gt;

&lt;p&gt;&lt;code&gt;config.env&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ini"&gt;&lt;code&gt;    &lt;span class="py"&gt;MSSQL_PID&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Developer&lt;/span&gt;
    &lt;span class="py"&gt;ACCEPT_EULA&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Y&lt;/span&gt;
    &lt;span class="py"&gt;MSSQL_AGENT_ENABLED&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;True&lt;/span&gt;
    &lt;span class="py"&gt;MSSQL_DATA_DIR&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/var/opt/sqlserver/sqldata&lt;/span&gt;
    &lt;span class="py"&gt;MSSQL_LOG_DIR&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/var/opt/sqlserver/sqllog&lt;/span&gt;
    &lt;span class="py"&gt;MSSQL_BACKUP_DIR&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/var/opt/sqlserver/sqlbackups&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;--env-file&lt;/span&gt; config.env &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;MSSQL_SA_PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;MyP@ssw0rd! &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 1433:1433 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; sqlcontainer1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; mcr.microsoft.com/mssql/server:2019-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  6. Copy Files In and Out of Containers
&lt;/h1&gt;

&lt;p&gt;SQL Server containers support file copying (e.g., backups, scripts).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;cp &lt;/span&gt;myscript.sql sql1:/tmp/myscript.sql
docker &lt;span class="nb"&gt;exec&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; sql1 /opt/mssql-tools18/bin/sqlcmd &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;-S&lt;/span&gt; localhost &lt;span class="nt"&gt;-U&lt;/span&gt; sa &lt;span class="nt"&gt;-P&lt;/span&gt; MyP@ssw0rd! &lt;span class="nt"&gt;-i&lt;/span&gt; /tmp/myscript.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  7. Advanced Customization with Dockerfile
&lt;/h1&gt;

&lt;p&gt;You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Install extra tools&lt;/li&gt;
&lt;li&gt;  Add startup scripts&lt;/li&gt;
&lt;li&gt;  Change OS‑level settings&lt;/li&gt;
&lt;li&gt;  Customize collation or locale via environment variables at build time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example from SQL Server 2025 container customization: you can specify collation during container creation only.&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="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_COLLATION=Latin1_General_BIN2"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  8. Starting SQL Server 2025 Preview Containers
&lt;/h1&gt;

&lt;p&gt;Microsoft’s official SQL Server 2025 preview image command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"ACCEPT_EULA=Y"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_SA_PASSWORD=&amp;lt;password&amp;gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"MSSQL_PID=Evaluation"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-p&lt;/span&gt; 1433:1433 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--name&lt;/span&gt; sqlpreview &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--hostname&lt;/span&gt; sqlpreview &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; mcr.microsoft.com/mssql/server:2025-latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  9. Additional Notes &amp;amp; Best Practices
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Non‑root containers
&lt;/h3&gt;

&lt;p&gt;SQL Server 2019+ containers run as non‑root for security.   &lt;/p&gt;

&lt;h3&gt;
  
  
  Encryption‑first ODBC tooling
&lt;/h3&gt;

&lt;p&gt;ODBC 18 enforces encryption by default when using &lt;code&gt;sqlcmd&lt;/code&gt; inside containers.    &lt;/p&gt;

&lt;h3&gt;
  
  
  Availability Groups in containers
&lt;/h3&gt;

&lt;p&gt;You can build clusterless Always On AG setups using Docker Desktop + scripts.    &lt;/p&gt;




&lt;h1&gt;
  
  
  ✅ Summary
&lt;/h1&gt;

&lt;p&gt;To configure and customize SQL Server Linux containers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Use &lt;strong&gt;environment variables&lt;/strong&gt; for edition, passwords, ports, collation, memory, and SQL Agent.&lt;/li&gt;
&lt;li&gt; Use &lt;strong&gt;Dockerfiles&lt;/strong&gt; to automate customizations.&lt;/li&gt;
&lt;li&gt; Use &lt;strong&gt;volumes&lt;/strong&gt; to persist SQL data.&lt;/li&gt;
&lt;li&gt; Use &lt;strong&gt;copy commands&lt;/strong&gt; or mount points for scripts and backups.&lt;/li&gt;
&lt;li&gt; Use &lt;strong&gt;Docker Compose&lt;/strong&gt; or &lt;strong&gt;env files&lt;/strong&gt; for multi‑container setups or cleaner configs.&lt;/li&gt;
&lt;li&gt; Consider SQL Server 2025 preview features and new image behaviors.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Ref: &lt;a href="https://learn.microsoft.com/en-nz/sql/sql-server/?view=sql-server-ver16" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-nz/sql/sql-server/?view=sql-server-ver16&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>sql</category>
      <category>container</category>
      <category>compose</category>
    </item>
    <item>
      <title>Colored Bash Prompt</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Fri, 12 Dec 2025 01:12:59 +0000</pubDate>
      <link>https://www.debug.school/suyash/colored-bash-prompt-hab</link>
      <guid>https://www.debug.school/suyash/colored-bash-prompt-hab</guid>
      <description>&lt;h1&gt;
  
  
  -------- Modern Colored Bash Prompt --------
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Colors (ANSI escape sequences, with Bash [ ] wrapping for correct line editing)
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Regular
&lt;/h1&gt;

&lt;p&gt;BLACK="[\e[30m]"; RED="[\e[31m]"; GREEN="[\e[32m]"; YELLOW="[\e[33m]"&lt;br&gt;
BLUE="[\e[34m]"; MAGENTA="[\e[35m]"; CYAN="[\e[36m]"; WHITE="[\e[37m]"&lt;/p&gt;
&lt;h1&gt;
  
  
  Styles
&lt;/h1&gt;

&lt;p&gt;BOLD="[\e[1m]"; DIM="[\e[2m]"; RESET="[\e[0m]"&lt;/p&gt;
&lt;h1&gt;
  
  
  Show last exit code if non-zero
&lt;/h1&gt;

&lt;p&gt;__last_exit_segment() {&lt;br&gt;
  local ec=$?&lt;br&gt;
  if [[ $ec -ne 0 ]]; then&lt;br&gt;
    echo -e "${RED}✖${ec}${RESET} "&lt;br&gt;
  fi&lt;br&gt;
}&lt;/p&gt;
&lt;h1&gt;
  
  
  Git branch + dirty/clean + ahead/behind markers
&lt;/h1&gt;

&lt;p&gt;__git_segment() {&lt;br&gt;
  command -v git &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || return&lt;br&gt;
  local branch dirty ahead behind&lt;br&gt;
  branch=$(git rev-parse --abbrev-ref HEAD 2&amp;gt;/dev/null) || return&lt;br&gt;
  # Detect changes&lt;br&gt;
  if ! git diff --quiet 2&amp;gt;/dev/null || ! git diff --cached --quiet 2&amp;gt;/dev/null; then&lt;br&gt;
    dirty="*"&lt;br&gt;
  else&lt;br&gt;
    dirty=""&lt;br&gt;
  fi&lt;br&gt;
  # Ahead/behind against upstream&lt;br&gt;
  if git rev-parse --abbrev-ref @{u} &amp;gt;/dev/null 2&amp;gt;&amp;amp;1; then&lt;br&gt;
    local counts&lt;br&gt;
    counts=$(git rev-list --left-right --count HEAD...@{u} 2&amp;gt;/dev/null)&lt;br&gt;
    ahead=$(echo "$counts" | awk '{print $1}')&lt;br&gt;
    behind=$(echo "$counts" | awk '{print $2}')&lt;br&gt;
  fi&lt;br&gt;
  local ab=""&lt;br&gt;
  [[ -n "$ahead" &amp;amp;&amp;amp; "$ahead" -gt 0 ]] &amp;amp;&amp;amp; ab+="↑$ahead"&lt;br&gt;
  [[ -n "$behind" &amp;amp;&amp;amp; "$behind" -gt 0 ]] &amp;amp;&amp;amp; ab+="↓$behind"&lt;/p&gt;

&lt;p&gt;if [[ -n "$ab" ]]; then&lt;br&gt;
    echo -e "${MAGENTA} ${branch}${dirty} ${YELLOW}${ab}${RESET}"&lt;br&gt;
  else&lt;br&gt;
    echo -e "${MAGENTA} ${branch}${dirty}${RESET}"&lt;br&gt;
  fi&lt;br&gt;
}&lt;/p&gt;
&lt;h1&gt;
  
  
  Jobs segment (background jobs)
&lt;/h1&gt;

&lt;p&gt;__jobs_segment() {&lt;br&gt;
  local jcount&lt;br&gt;
  jcount=$(jobs -p | wc -l | tr -d ' ')&lt;br&gt;
  if [[ "$jcount" -gt 0 ]]; then&lt;br&gt;
    echo -e "${CYAN}⚙ ${jcount}${RESET} "&lt;br&gt;
  fi&lt;br&gt;
}&lt;/p&gt;
&lt;h1&gt;
  
  
  Build PS1
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;build_ps1() {&lt;br&gt;
  local exit_seg git_seg jobs_seg&lt;br&gt;
  exit_seg=$(&lt;/strong&gt;last_exit_segment)&lt;br&gt;
  git_seg=$(&lt;strong&gt;git_segment)&lt;br&gt;
  jobs_seg=$(&lt;/strong&gt;jobs_segment)&lt;br&gt;
  PS1="${exit_seg}${DIM}\u@\h${RESET} ${BOLD}${BLUE}\w${RESET}"&lt;br&gt;
  if [[ -n "$git_seg" ]]; then&lt;br&gt;
    PS1+=" ${git_seg}"&lt;br&gt;
  fi&lt;br&gt;
  if [[ -n "$jobs_seg" ]]; then&lt;br&gt;
    PS1+=" ${jobs_seg}"&lt;br&gt;
  fi&lt;br&gt;
  PS1+="\n${GREEN}➜${RESET} "&lt;br&gt;
}&lt;/p&gt;
&lt;h1&gt;
  
  
  Ensure the prompt rebuilds each time
&lt;/h1&gt;

&lt;p&gt;PROMPT_COMMAND="__build_ps1"&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;# -------- Modern Colored Bash Prompt --------&lt;/span&gt;
&lt;span class="c"&gt;# Colors (ANSI escape sequences, with Bash \[ \] wrapping for correct line editing)&lt;/span&gt;
&lt;span class="c"&gt;# Regular&lt;/span&gt;
&lt;span class="nv"&gt;BLACK&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[30m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;RED&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[31m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;GREEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[32m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;YELLOW&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[33m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nv"&gt;BLUE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[34m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;MAGENTA&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[35m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;CYAN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[36m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;WHITE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[37m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="c"&gt;# Styles&lt;/span&gt;
&lt;span class="nv"&gt;BOLD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[1m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;DIM&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[2m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;[0m&lt;/span&gt;&lt;span class="se"&gt;\]&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Show last exit code if non-zero&lt;/span&gt;
__last_exit_segment&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;ec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nv"&gt;$ec&lt;/span&gt; &lt;span class="nt"&gt;-ne&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="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RED&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;✖&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;ec&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; "&lt;/span&gt;
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# Git branch + dirty/clean + ahead/behind markers&lt;/span&gt;
__git_segment&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;command&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; git &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&amp;gt;&amp;amp;1 &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;return
  &lt;/span&gt;&lt;span class="nb"&gt;local &lt;/span&gt;branch dirty ahead behind
  &lt;span class="nv"&gt;branch&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-parse &lt;span class="nt"&gt;--abbrev-ref&lt;/span&gt; HEAD 2&amp;gt;/dev/null&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;
  &lt;span class="c"&gt;# Detect changes&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; git diff &lt;span class="nt"&gt;--quiet&lt;/span&gt; 2&amp;gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; git diff &lt;span class="nt"&gt;--cached&lt;/span&gt; &lt;span class="nt"&gt;--quiet&lt;/span&gt; 2&amp;gt;/dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nv"&gt;dirty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;
  &lt;span class="k"&gt;else
    &lt;/span&gt;&lt;span class="nv"&gt;dirty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="k"&gt;fi&lt;/span&gt;
  &lt;span class="c"&gt;# Ahead/behind against upstream&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;git rev-parse &lt;span class="nt"&gt;--abbrev-ref&lt;/span&gt; @&lt;span class="o"&gt;{&lt;/span&gt;u&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null 2&amp;gt;&amp;amp;1&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    &lt;/span&gt;&lt;span class="nb"&gt;local &lt;/span&gt;counts
    &lt;span class="nv"&gt;counts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;git rev-list &lt;span class="nt"&gt;--left-right&lt;/span&gt; &lt;span class="nt"&gt;--count&lt;/span&gt; HEAD...@&lt;span class="o"&gt;{&lt;/span&gt;u&lt;span class="o"&gt;}&lt;/span&gt; 2&amp;gt;/dev/null&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="nv"&gt;ahead&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$counts&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $1}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
    &lt;span class="nv"&gt;behind&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$counts&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{print $2}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;fi
  &lt;/span&gt;&lt;span class="nb"&gt;local &lt;/span&gt;&lt;span class="nv"&gt;ab&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;
  &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ahead&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ahead&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 0 &lt;span class="o"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ab+&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"↑&lt;/span&gt;&lt;span class="nv"&gt;$ahead&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$behind&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$behind&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-gt&lt;/span&gt; 0 &lt;span class="o"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ab+&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"↓&lt;/span&gt;&lt;span class="nv"&gt;$behind&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$ab&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &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="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAGENTA&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;branch&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;dirty&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;YELLOW&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;ab&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;else
    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;MAGENTA&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;branch&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;dirty&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# Jobs segment (background jobs)&lt;/span&gt;
__jobs_segment&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;local &lt;/span&gt;jcount
  &lt;span class="nv"&gt;jcount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;jobs&lt;/span&gt; &lt;span class="nt"&gt;-p&lt;/span&gt; | &lt;span class="nb"&gt;wc&lt;/span&gt; &lt;span class="nt"&gt;-l&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$jcount&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-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="nt"&gt;-e&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CYAN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;⚙ &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;jcount&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; "&lt;/span&gt;
  &lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# Build PS1&lt;/span&gt;
__build_ps1&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="nb"&gt;local &lt;/span&gt;exit_seg git_seg jobs_seg
  &lt;span class="nv"&gt;exit_seg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;__last_exit_segment&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="nv"&gt;git_seg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;__git_segment&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="nv"&gt;jobs_seg&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;__jobs_segment&lt;span class="si"&gt;)&lt;/span&gt;
  &lt;span class="nv"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;exit_seg&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;DIM&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\u&lt;/span&gt;&lt;span class="s2"&gt;@&lt;/span&gt;&lt;span class="se"&gt;\h&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;BOLD&lt;/span&gt;&lt;span class="k"&gt;}${&lt;/span&gt;&lt;span class="nv"&gt;BLUE&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\w&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$git_seg&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &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;PS1+&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;" &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;git_seg&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;fi
  if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$jobs_seg&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &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;PS1+&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;" &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;jobs_seg&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
  &lt;span class="k"&gt;fi
  &lt;/span&gt;PS1+&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;GREEN&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;➜&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RESET&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; "&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;# Ensure the prompt rebuilds each time&lt;/span&gt;
&lt;span class="nv"&gt;PROMPT_COMMAND&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"__build_ps1"&lt;/span&gt;
&lt;span class="c"&gt;#&lt;/span&gt;

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

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://www.debug.school/images/LSOCCXuAO5gQZhLWJ8HU_Ew92yH5D8Qt-RRS39YgHgk/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvbXlzMzZ1/NzhnOXpjNzI3bHE4/YzgucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/LSOCCXuAO5gQZhLWJ8HU_Ew92yH5D8Qt-RRS39YgHgk/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvbXlzMzZ1/NzhnOXpjNzI3bHE4/YzgucG5n" alt="Bash" width="61" height="182"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  ~/.bashrc: executed by bash(1) for non-login shells.
&lt;/h1&gt;
&lt;h1&gt;
  
  
  see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
&lt;/h1&gt;
&lt;h1&gt;
  
  
  for examples
&lt;/h1&gt;
&lt;h1&gt;
  
  
  If not running interactively, don't do anything
&lt;/h1&gt;

&lt;p&gt;case $- in&lt;br&gt;
    &lt;em&gt;i&lt;/em&gt;) ;;&lt;br&gt;
      *) return;;&lt;br&gt;
esac&lt;/p&gt;
&lt;h1&gt;
  
  
  don't put duplicate lines or lines starting with space in the history.
&lt;/h1&gt;
&lt;h1&gt;
  
  
  See bash(1) for more options
&lt;/h1&gt;

&lt;p&gt;HISTCONTROL=ignoreboth&lt;/p&gt;
&lt;h1&gt;
  
  
  append to the history file, don't overwrite it
&lt;/h1&gt;

&lt;p&gt;shopt -s histappend&lt;/p&gt;
&lt;h1&gt;
  
  
  for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
&lt;/h1&gt;

&lt;p&gt;HISTSIZE=1000&lt;br&gt;
HISTFILESIZE=2000&lt;/p&gt;
&lt;h1&gt;
  
  
  check the window size after each command and, if necessary,
&lt;/h1&gt;
&lt;h1&gt;
  
  
  update the values of LINES and COLUMNS.
&lt;/h1&gt;

&lt;p&gt;shopt -s checkwinsize&lt;/p&gt;
&lt;h1&gt;
  
  
  If set, the pattern "**" used in a pathname expansion context will
&lt;/h1&gt;
&lt;h1&gt;
  
  
  match all files and zero or more directories and subdirectories.
&lt;/h1&gt;
&lt;h1&gt;
  
  
  shopt -s globstar
&lt;/h1&gt;
&lt;h1&gt;
  
  
  make less more friendly for non-text input files, see lesspipe(1)
&lt;/h1&gt;

&lt;p&gt;[ -x /usr/bin/lesspipe ] &amp;amp;&amp;amp; eval "$(SHELL=/bin/sh lesspipe)"&lt;/p&gt;
&lt;h1&gt;
  
  
  set variable identifying the chroot you work in (used in the prompt below)
&lt;/h1&gt;

&lt;p&gt;if [ -z "${debian_chroot:-}" ] &amp;amp;&amp;amp; [ -r /etc/debian_chroot ]; then&lt;br&gt;
    debian_chroot=$(cat /etc/debian_chroot)&lt;br&gt;
fi&lt;/p&gt;
&lt;h1&gt;
  
  
  set a fancy prompt (non-color, unless we know we "want" color)
&lt;/h1&gt;

&lt;p&gt;case "$TERM" in&lt;br&gt;
    xterm-color|*-256color) color_prompt=yes;;&lt;br&gt;
esac&lt;/p&gt;
&lt;h1&gt;
  
  
  uncomment for a colored prompt, if the terminal has the capability; turned
&lt;/h1&gt;
&lt;h1&gt;
  
  
  off by default to not distract the user: the focus in a terminal window
&lt;/h1&gt;
&lt;h1&gt;
  
  
  should be on the output of commands, not on the prompt
&lt;/h1&gt;
&lt;h1&gt;
  
  
  force_color_prompt=yes
&lt;/h1&gt;

&lt;p&gt;if [ -n "$force_color_prompt" ]; then&lt;br&gt;
    if [ -x /usr/bin/tput ] &amp;amp;&amp;amp; tput setaf 1 &amp;gt;&amp;amp;/dev/null; then&lt;br&gt;
        # We have color support; assume it's compliant with Ecma-48&lt;br&gt;
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such&lt;br&gt;
        # a case would tend to support setf rather than setaf.)&lt;br&gt;
        color_prompt=yes&lt;br&gt;
    else&lt;br&gt;
        color_prompt=&lt;br&gt;
    fi&lt;br&gt;
fi&lt;/p&gt;

&lt;p&gt;if [ "$color_prompt" = yes ]; then&lt;br&gt;
    PS1='${debian_chroot:+($debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m]\$ '&lt;br&gt;
else&lt;br&gt;
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '&lt;br&gt;
fi&lt;br&gt;
unset color_prompt force_color_prompt&lt;/p&gt;
&lt;h1&gt;
  
  
  If this is an xterm set the title to user@host:dir
&lt;/h1&gt;

&lt;p&gt;case "$TERM" in&lt;br&gt;
xterm*|rxvt*)&lt;br&gt;
    PS1="[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a]$PS1"&lt;br&gt;
    ;;&lt;br&gt;
*)&lt;br&gt;
    ;;&lt;br&gt;
esac&lt;/p&gt;
&lt;h1&gt;
  
  
  enable color support of ls and also add handy aliases
&lt;/h1&gt;

&lt;p&gt;if [ -x /usr/bin/dircolors ]; then&lt;br&gt;
    test -r ~/.dircolors &amp;amp;&amp;amp; eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"&lt;br&gt;
    alias ls='ls --color=auto'&lt;br&gt;
    #alias dir='dir --color=auto'&lt;br&gt;
    #alias vdir='vdir --color=auto'&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;fi&lt;/p&gt;
&lt;h1&gt;
  
  
  colored GCC warnings and errors
&lt;/h1&gt;
&lt;h1&gt;
  
  
  export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
&lt;/h1&gt;
&lt;h1&gt;
  
  
  some more ls aliases
&lt;/h1&gt;

&lt;p&gt;alias ll='ls -alF'&lt;br&gt;
alias la='ls -A'&lt;br&gt;
alias l='ls -CF'&lt;/p&gt;
&lt;h1&gt;
  
  
  Add an "alert" alias for long running commands.  Use like so:
&lt;/h1&gt;
&lt;h1&gt;
  
  
  sleep 10; alert
&lt;/h1&gt;

&lt;p&gt;alias alert='notify-send --urgency=low -i "$([ $? = 0 ] &amp;amp;&amp;amp; echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]+\s*//;s/[;&amp;amp;|]\s*alert$//'\'')"'&lt;/p&gt;
&lt;h1&gt;
  
  
  Alias definitions.
&lt;/h1&gt;
&lt;h1&gt;
  
  
  You may want to put all your additions into a separate file like
&lt;/h1&gt;
&lt;h1&gt;
  
  
  ~/.bash_aliases, instead of adding them here directly.
&lt;/h1&gt;
&lt;h1&gt;
  
  
  See /usr/share/doc/bash-doc/examples in the bash-doc package.
&lt;/h1&gt;

&lt;p&gt;if [ -f ~/.bash_aliases ]; then&lt;br&gt;
    . ~/.bash_aliases&lt;br&gt;
fi&lt;/p&gt;
&lt;h1&gt;
  
  
  enable programmable completion features (you don't need to enable
&lt;/h1&gt;
&lt;h1&gt;
  
  
  this, if it's already enabled in /etc/bash.bashrc and /etc/profile
&lt;/h1&gt;
&lt;h1&gt;
  
  
  sources /etc/bash.bashrc).
&lt;/h1&gt;

&lt;p&gt;if ! shopt -oq posix; then&lt;br&gt;
  if [ -f /usr/share/bash-completion/bash_completion ]; then&lt;br&gt;
    . /usr/share/bash-completion/bash_completion&lt;br&gt;
  elif [ -f /etc/bash_completion ]; then&lt;br&gt;
    . /etc/bash_completion&lt;br&gt;
  fi&lt;br&gt;
fi&lt;br&gt;
[ -r /home/ubuntu/.config/byobu/prompt ] &amp;amp;&amp;amp; . /home/ubuntu/.config/byobu/prompt   #byobu-prompt#&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;# ~/.bashrc: executed by bash(1) for non-login shells.&lt;/span&gt;
&lt;span class="c"&gt;# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)&lt;/span&gt;
&lt;span class="c"&gt;# for examples&lt;/span&gt;

&lt;span class="c"&gt;# If not running interactively, don't do anything&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="nv"&gt;$-&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt;
    &lt;span class="k"&gt;*&lt;/span&gt;i&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;;;&lt;/span&gt;
      &lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;

&lt;span class="c"&gt;# don't put duplicate lines or lines starting with space in the history.&lt;/span&gt;
&lt;span class="c"&gt;# See bash(1) for more options&lt;/span&gt;
&lt;span class="nv"&gt;HISTCONTROL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ignoreboth

&lt;span class="c"&gt;# append to the history file, don't overwrite it&lt;/span&gt;
&lt;span class="nb"&gt;shopt&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; histappend

&lt;span class="c"&gt;# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)&lt;/span&gt;
&lt;span class="nv"&gt;HISTSIZE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1000
&lt;span class="nv"&gt;HISTFILESIZE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;2000

&lt;span class="c"&gt;# check the window size after each command and, if necessary,&lt;/span&gt;
&lt;span class="c"&gt;# update the values of LINES and COLUMNS.&lt;/span&gt;
&lt;span class="nb"&gt;shopt&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; checkwinsize

&lt;span class="c"&gt;# If set, the pattern "**" used in a pathname expansion context will&lt;/span&gt;
&lt;span class="c"&gt;# match all files and zero or more directories and subdirectories.&lt;/span&gt;
&lt;span class="c"&gt;#shopt -s globstar&lt;/span&gt;

&lt;span class="c"&gt;# make less more friendly for non-text input files, see lesspipe(1)&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; /usr/bin/lesspipe &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;SHELL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/bin/sh lesspipe&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# set variable identifying the chroot you work in (used in the prompt below)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-z&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;debian_chroot&lt;/span&gt;&lt;span class="k"&gt;:-}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; /etc/debian_chroot &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="nv"&gt;debian_chroot&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; /etc/debian_chroot&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# set a fancy prompt (non-color, unless we know we "want" color)&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$TERM&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="k"&gt;in
    &lt;/span&gt;xterm-color|&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="nt"&gt;-256color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nv"&gt;color_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;yes&lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;

&lt;span class="c"&gt;# uncomment for a colored prompt, if the terminal has the capability; turned&lt;/span&gt;
&lt;span class="c"&gt;# off by default to not distract the user: the focus in a terminal window&lt;/span&gt;
&lt;span class="c"&gt;# should be on the output of commands, not on the prompt&lt;/span&gt;
&lt;span class="c"&gt;#force_color_prompt=yes&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$force_color_prompt&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
    if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; /usr/bin/tput &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; tput setaf 1 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;/dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
        &lt;span class="c"&gt;# We have color support; assume it's compliant with Ecma-48&lt;/span&gt;
        &lt;span class="c"&gt;# (ISO/IEC-6429). (Lack of such support is extremely rare, and such&lt;/span&gt;
        &lt;span class="c"&gt;# a case would tend to support setf rather than setaf.)&lt;/span&gt;
        &lt;span class="nv"&gt;color_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;yes
    &lt;/span&gt;&lt;span class="k"&gt;else
        &lt;/span&gt;&lt;span class="nv"&gt;color_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;
    &lt;span class="k"&gt;fi
fi

if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$color_prompt&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;yes&lt;/span&gt; &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="nv"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '&lt;/span&gt;
&lt;span class="k"&gt;else
    &lt;/span&gt;&lt;span class="nv"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '&lt;/span&gt;
&lt;span class="k"&gt;fi
&lt;/span&gt;&lt;span class="nb"&gt;unset &lt;/span&gt;color_prompt force_color_prompt

&lt;span class="c"&gt;# If this is an xterm set the title to user@host:dir&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$TERM&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="k"&gt;in
&lt;/span&gt;xterm&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;rxvt&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nv"&gt;PS1&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\[\e&lt;/span&gt;&lt;span class="s2"&gt;]0;&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;debian_chroot&lt;/span&gt;:+&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$debian_chroot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\u&lt;/span&gt;&lt;span class="s2"&gt;@&lt;/span&gt;&lt;span class="se"&gt;\h&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="se"&gt;\w\a\]&lt;/span&gt;&lt;span class="nv"&gt;$PS1&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;

&lt;span class="c"&gt;# enable color support of ls and also add handy aliases&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt; /usr/bin/dircolors &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;test&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; ~/.dircolors &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;dircolors&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt; ~/.dircolors&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;dircolors&lt;/span&gt; &lt;span class="nt"&gt;-b&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="nb"&gt;alias ls&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ls --color=auto'&lt;/span&gt;
    &lt;span class="c"&gt;#alias dir='dir --color=auto'&lt;/span&gt;
    &lt;span class="c"&gt;#alias vdir='vdir --color=auto'&lt;/span&gt;

    &lt;span class="nb"&gt;alias grep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'grep --color=auto'&lt;/span&gt;
    &lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;fgrep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'fgrep --color=auto'&lt;/span&gt;
    &lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;egrep&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'egrep --color=auto'&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# colored GCC warnings and errors&lt;/span&gt;
&lt;span class="c"&gt;#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'&lt;/span&gt;

&lt;span class="c"&gt;# some more ls aliases&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;ll&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ls -alF'&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;la&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ls -A'&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;l&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'ls -CF'&lt;/span&gt;

&lt;span class="c"&gt;# Add an "alert" alias for long running commands.  Use like so:&lt;/span&gt;
&lt;span class="c"&gt;#   sleep 10; alert&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;&lt;span class="nv"&gt;alert&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'notify-send --urgency=low -i "$([ $? = 0 ] &amp;amp;&amp;amp; echo terminal || echo error)" "$(history|tail -n1|sed -e '&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;'s/^\s*[0-9]\+\s*//;s/[;&amp;amp;|]\s*alert$//'&lt;/span&gt;&lt;span class="se"&gt;\'&lt;/span&gt;&lt;span class="s1"&gt;')"'&lt;/span&gt;

&lt;span class="c"&gt;# Alias definitions.&lt;/span&gt;
&lt;span class="c"&gt;# You may want to put all your additions into a separate file like&lt;/span&gt;
&lt;span class="c"&gt;# ~/.bash_aliases, instead of adding them here directly.&lt;/span&gt;
&lt;span class="c"&gt;# See /usr/share/doc/bash-doc/examples in the bash-doc package.&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ~/.bash_aliases &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;.&lt;/span&gt; ~/.bash_aliases
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c"&gt;# enable programmable completion features (you don't need to enable&lt;/span&gt;
&lt;span class="c"&gt;# this, if it's already enabled in /etc/bash.bashrc and /etc/profile&lt;/span&gt;
&lt;span class="c"&gt;# sources /etc/bash.bashrc).&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nb"&gt;shopt&lt;/span&gt; &lt;span class="nt"&gt;-oq&lt;/span&gt; posix&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then
  if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /usr/share/bash-completion/bash_completion &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;.&lt;/span&gt; /usr/share/bash-completion/bash_completion
  &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; /etc/bash_completion &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;.&lt;/span&gt; /etc/bash_completion
  &lt;span class="k"&gt;fi
fi&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; /home/ubuntu/.config/byobu/prompt &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; /home/ubuntu/.config/byobu/prompt   &lt;span class="c"&gt;#byobu-prompt#&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>devops</category>
      <category>linux</category>
      <category>bash</category>
      <category>prompt</category>
    </item>
    <item>
      <title>VMware to RedHat Virtualization Migration</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Thu, 11 Dec 2025 00:47:14 +0000</pubDate>
      <link>https://www.debug.school/suyash/vmware-to-redhat-virtualization-migration-3fol</link>
      <guid>https://www.debug.school/suyash/vmware-to-redhat-virtualization-migration-3fol</guid>
      <description>&lt;h2&gt;
  
  
  Migration Toolkit for Virtualization
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Cold and warm migration in MTV
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Cold migration is when a powered off virtual machine (VM) is migrated to a separate host. The VM is powered off, and there is no need for common shared storage.&lt;/li&gt;
&lt;li&gt;Warm migration is when a powered on VM is migrated to a separate host. A source host state is cloned to the destination host.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stages:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Warm migration precopy stage&lt;/li&gt;
&lt;li&gt;Warm migration cutover stage&lt;/li&gt;
&lt;li&gt;Power off of virtual machines during cold migrations&lt;/li&gt;
&lt;li&gt;Power on of virtual machines during warm migrations &lt;/li&gt;
&lt;li&gt;Precopy stage&lt;/li&gt;
&lt;li&gt;Cutover stage&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install MTV
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;In the Red Hat OpenShift web console, click Operators → &lt;code&gt;OperatorHub&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Use the Filter by keyword field to search for mtv-operator.&lt;/li&gt;
&lt;li&gt;Click Migration Toolkit for Virtualization Operator and then click Install.&lt;/li&gt;
&lt;li&gt;Click Create &lt;code&gt;ForkliftController&lt;/code&gt; when the button becomes active.&lt;/li&gt;
&lt;li&gt;Click Create. Your &lt;code&gt;ForkliftController&lt;/code&gt; appears in the list that is displayed.&lt;/li&gt;
&lt;li&gt;Click Workloads → Pods to verify that the MTV pods are running.&lt;/li&gt;
&lt;li&gt;Click Operators → Installed Operators to verify that Migration Toolkit for Virtualization Operator appears in the &lt;code&gt;openshift-mtv&lt;/code&gt; project with the status Succeeded.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When the plugin is ready you will be prompted to reload the page. The Migration menu item is automatically added to the navigation bar, displayed on the left of the Red Hat OpenShift web console.&lt;/p&gt;

&lt;p&gt;Using CLI:&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="s"&gt;cat &amp;lt;&amp;lt; EOF | oc apply -f -&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;project.openshift.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Project&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&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;openshift-mtv&lt;/span&gt;
&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;cat &amp;lt;&amp;lt; EOF | oc apply -f -&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;operators.coreos.com/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;OperatorGroup&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&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;migration&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openshift-mtv&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;targetNamespaces&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;openshift-mtv&lt;/span&gt;
&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;cat &amp;lt;&amp;lt; EOF | oc apply -f -&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;operators.coreos.com/v1alpha1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Subscription&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&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;mtv-operator&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openshift-mtv&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;channel&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;release-v2.9&lt;/span&gt;
  &lt;span class="na"&gt;installPlanApproval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Automatic&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;mtv-operator&lt;/span&gt;
  &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;redhat-operators&lt;/span&gt;
  &lt;span class="na"&gt;sourceNamespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openshift-marketplace&lt;/span&gt;
  &lt;span class="na"&gt;startingCSV&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mtv-operator.v2.9.6"&lt;/span&gt;
&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="s"&gt;cat &amp;lt;&amp;lt; EOF | oc apply -f -&lt;/span&gt;
&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;forklift.konveyor.io/v1beta1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ForkliftController&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&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;forklift-controller&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;openshift-mtv&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;olm_managed&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="s"&gt;EOF&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;oc get pods &lt;span class="nt"&gt;-n&lt;/span&gt; openshift-mtv

NAME                                                    READY   STATUS    RESTARTS   AGE
forklift-api-bb45b8db4-cpzlg                            1/1     Running   0          6m34s
forklift-controller-7649db6845-zd25p                    2/2     Running   0          6m38s
forklift-must-gather-api-78fb4bcdf6-h2r4m               1/1     Running   0          6m28s
forklift-operator-59c87cfbdc-pmkfc                      1/1     Running   0          28m
forklift-ui-plugin-5c5564f6d6-zpd85                     1/1     Running   0          6m24s
forklift-validation-7d84c74c6f-fj9xg                    1/1     Running   0          6m30s
forklift-volume-populator-controller-85d5cb64b6-mrlmc   1/1     Running   0          6m36s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configure MTV
&lt;/h2&gt;

&lt;p&gt;You can configure the following settings of the MTV Operator by modifying the &lt;code&gt;ForkliftController&lt;/code&gt; custom resource (CR), or in the Settings section of the Overview page, unless otherwise indicated.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maximum number of virtual machines (VMs) or disks per plan that Migration Toolkit for Virtualization (MTV) can migrate simultaneously.&lt;/li&gt;
&lt;li&gt;How long &lt;code&gt;must gather&lt;/code&gt; reports are retained before being automatically deleted (&lt;code&gt;ForkliftController&lt;/code&gt; CR only).&lt;/li&gt;
&lt;li&gt;CPU limit allocated to the main controller container.&lt;/li&gt;
&lt;li&gt;Memory limit allocated to the main controller container.&lt;/li&gt;
&lt;li&gt;Interval at which a new snapshot is requested before initiating a warm migration.&lt;/li&gt;
&lt;li&gt;Frequency with which the system checks the status of snapshot creation or removal during a warm migration.&lt;/li&gt;
&lt;li&gt;Percentage of space in persistent volumes allocated as file system overhead when the storageclass is filesystem (&lt;code&gt;ForkliftController&lt;/code&gt; CR only).&lt;/li&gt;
&lt;li&gt;Fixed amount of additional space allocated in persistent block volumes. This setting is applicable for any &lt;code&gt;storageclass&lt;/code&gt; that is block-based (&lt;code&gt;ForkliftController&lt;/code&gt; CR only).&lt;/li&gt;
&lt;li&gt;Configuration map of operating systems to preferences for vSphere source providers (&lt;code&gt;ForkliftController&lt;/code&gt; CR only).&lt;/li&gt;
&lt;li&gt;Configuration map of operating systems to preferences for Red Hat Virtualization (RHV) source providers (&lt;code&gt;ForkliftController&lt;/code&gt; CR only).&lt;/li&gt;
&lt;li&gt;Whether to retain importer pods so that the Containerized Data Importer (CDI) does not delete them during migration (&lt;code&gt;ForkliftController&lt;/code&gt; CR only).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/agZS7jB5PiM2m-Eq-pY7ihM7VKx535eDoDwInLt4DQY/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvdW1seWNt/Mm05ZWF2cW5yZGhx/ankucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/agZS7jB5PiM2m-Eq-pY7ihM7VKx535eDoDwInLt4DQY/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvdW1seWNt/Mm05ZWF2cW5yZGhx/ankucG5n" alt="MTV" width="120" height="226"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Migration
&lt;/h2&gt;

&lt;p&gt;To Migrate from VMware to RedHat OpenShift Virtualization&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Access the Create provider page for VMware by doing one of the following:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;a. In the Red Hat OpenShift web console, click Migration for Virtualization &amp;gt; Providers.&lt;/p&gt;

&lt;p&gt;i. Click Create Provider.&lt;br&gt;
ii. Select a Project from the list. The default project shown depends on the active project of MTV. If the active project is All projects, then the default project is openshift-mtv. Otherwise, the default project is the same as the active project. If you have Administrator privileges, you can see all projects, otherwise, you can see only the projects you are authorized to work with.&lt;br&gt;
iii. Click VMware.&lt;/p&gt;

&lt;p&gt;b. If you have Administrator privileges, in the Red Hat OpenShift web console, click Migration for Virtualization &amp;gt; Overview.&lt;/p&gt;

&lt;p&gt;i. In the Welcome pane, click VMware. If the Welcome pane is not visible, click Show the welcome card in the upper-right corner of the page, and click VMware when the Welcome pane opens.&lt;br&gt;
ii. Select a Project from the list. The default project shown depends on the active project of MTV. If the active project is All projects, then the default project is openshift-mtv. Otherwise, the default project is the same as the active project. If you have Administrator privileges, you can see all projects, otherwise, you can see only the projects you are authorized to work with.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Specify the following fields:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;a. Provider details&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provider resource name: Name of the source provider.&lt;/li&gt;
&lt;li&gt;Endpoint type: Select the vSphere provider endpoint type. Options: vCenter or ESXi. You can migrate virtual machines from vCenter, an ESX/ESXi server that is not managed by vCenter, or from an ESX/ESXi server that is managed by vCenter but does not go through vCenter.&lt;/li&gt;
&lt;li&gt;URL: URL of the SDK endpoint of the vCenter on which the source VM is mounted. Ensure that the URL includes the sdk path, usually /sdk. For example, &lt;a href="https://vCenter-host-example.com/sdk" rel="noopener noreferrer"&gt;https://vCenter-host-example.com/sdk&lt;/a&gt;. If a certificate for FQDN is specified, the value of this field needs to match the FQDN in the certificate.&lt;/li&gt;
&lt;li&gt;VDDK init image: VDDKInitImage path. It is strongly recommended to create a VDDK init image to accelerate migrations. For more information, see Creating a VDDK image.&lt;/li&gt;
&lt;li&gt;Select the Skip VMWare Virtual Disk Development Kit (VDDK) SDK acceleration (not recommended).&lt;/li&gt;
&lt;li&gt;Enter the path in the VDDK init image text box. Format: /vddk:.&lt;/li&gt;
&lt;li&gt;Upload a VDDK archive and build a VDDK init image from the archive by doing the following:&lt;/li&gt;
&lt;li&gt;Click Browse next to the VDDK init image archive text box, select the desired file, and click Select.&lt;/li&gt;
&lt;li&gt;Click Upload.
The URL of the uploaded archive is displayed in the VDDK init image archive text box.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;b. Provider credentials&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Username: vCenter user or ESXi user. For example, &lt;a href="mailto:user@vsphere.local"&gt;user@vsphere.local&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Password: vCenter user password or ESXi user password.&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Choose one of the following options for validating CA certificates:&lt;/li&gt;
&lt;li&gt;Use a custom CA certificate: Migrate after validating a custom CA certificate.&lt;/li&gt;
&lt;li&gt;Use the system CA certificate: Migrate after validating the system CA certificate.&lt;/li&gt;
&lt;li&gt;Skip certificate validation : Migrate without validating a CA certificate.&lt;/li&gt;
&lt;li&gt;To use a custom CA certificate, leave the Skip certificate validation switch toggled to left, and either drag the CA certificate to the text box or browse for it and click Select.&lt;/li&gt;
&lt;li&gt;To use the system CA certificate, leave the Skip certificate validation switch toggled to the left, and leave the CA certificate text box empty.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;To skip certificate validation, toggle the Skip certificate validation switch to the right.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ask MTV to fetch a custom CA certificate from the provider’s API endpoint URL.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Fetch certificate from URL. The Verify certificate window opens.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If the details are correct, select the I trust the authenticity of this certificate checkbox, and then, click Confirm. If not, click Cancel, and then, enter the correct certificate information manually.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once confirmed, the CA certificate will be used to validate subsequent communication with the API endpoint.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click Create provider to add and save the provider.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The provider appears in the list of providers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note: It might take a few minutes for the provider to have the status Ready.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add access to the UI of the provider:&lt;/li&gt;
&lt;li&gt;On the Providers page, click the provider.&lt;/li&gt;
&lt;li&gt;The Provider details page opens.&lt;/li&gt;
&lt;li&gt;Click the Edit icon under External UI web link.&lt;/li&gt;
&lt;li&gt;Enter the link and click Save.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ref: &lt;a href="https://docs.redhat.com/en/documentation/migration_toolkit_for_virtualization/" rel="noopener noreferrer"&gt;https://docs.redhat.com/en/documentation/migration_toolkit_for_virtualization/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vmware</category>
      <category>redhat</category>
      <category>mtv</category>
      <category>devops</category>
    </item>
    <item>
      <title>MicroCode Update</title>
      <dc:creator>Suyash Sambhare</dc:creator>
      <pubDate>Thu, 04 Dec 2025 04:33:45 +0000</pubDate>
      <link>https://www.debug.school/suyash/microcode-update-8ij</link>
      <guid>https://www.debug.school/suyash/microcode-update-8ij</guid>
      <description>&lt;h2&gt;
  
  
  FIT Microcode Update
&lt;/h2&gt;

&lt;p&gt;The Firmware Interface Table (FIT) is a data structure located in the platform BIOS SPI flash that may contain pointers to one or more microcode updates. Loading a microcode update from the FIT is the preferred way to load a microcode update in Intel platforms, because it helps ensure all the update components1 are loaded at the earliest point in the boot process. Before executing the first instruction of the BIOS firmware at the Intel® architecture (IA) reset vector, the CPU processes the FIT to locate a microcode update suitable for that particular CPU. If a suitable update is found, the CPU loads the update before the first instruction of the BIOS firmware is fetched. After loading an update from the FIT, the bootstrap processor (BSP) begins fetching and executing the BIOS firmware from the IA reset vector, while the application processors (APs) enter into the Wait-for-SIPI state.&lt;/p&gt;

&lt;p&gt;On some processors, a microcode update is loaded from the FIT only on the BSP core, while on other processors, it may be loaded on all cores.&lt;/p&gt;

&lt;p&gt;A microcode update is loaded from the FIT after either a warm or cold hardware reset. It does not occur in response to an INIT event. It is BIOS’s responsibility to ensure the validity and the integrity of the microcode update before incorporating it into the IFWI in flash memory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.debug.school/images/96n1HK8r6Gma3OVYYMlOcbFrvmsJ-cJwpnIW2_2HJZ4/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvMWZxZDg4/Y3loMm94aDcwYmFq/NHIucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/96n1HK8r6Gma3OVYYMlOcbFrvmsJ-cJwpnIW2_2HJZ4/rt:fit/w:800/g:sm/q:0/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvMWZxZDg4/Y3loMm94aDcwYmFq/NHIucG5n" alt="Microcode" width="156" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Early BIOS Microcode Update
&lt;/h2&gt;

&lt;p&gt;Early BIOS microcode update is when a microcode update is loaded by BIOS before memory has been initialized.&lt;/p&gt;

&lt;p&gt;Early BIOS microcode update may be performed by early BIOS initialization on the BSP. BIOS may skip this microcode update if an update has already been loaded via the FIT. BIOS can determine whether an update was loaded from the FIT by executing the CPUID instruction and then reading &lt;code&gt;IA32_BIOS_SIGN_ID (MSR 8BH)&lt;/code&gt;. If &lt;code&gt;IA32_BIOS_SIGN_ID[63:32]&lt;/code&gt; is non-zero, then an update was already loaded from the FIT, and the early BIOS microcode update load point may be skipped.&lt;/p&gt;

&lt;p&gt;Intel recommends that updates are loaded very early in the BIOS initialization sequence, either via the FIT (preferred), or via early BIOS microcode update load before the BIOS Memory Reference Code is executed and before DRAM is available. This is needed to address issues that may affect the later BIOS code (like the BIOS Memory Reference Code).&lt;/p&gt;

&lt;p&gt;When a microcode update is loaded from the FIT, it may be loaded on all processors or only on the BSP. When an update is loaded during early BIOS, it may also be loaded only on the BSP core, since application processor (AP) cores may not be awake at this point in the boot sequence. Therefore, as soon as possible after receiving the Startup Inter-Processor Interrupt (SIPI), BIOS software on the AP cores should load the update if it has not already been loaded from the FIT.&lt;/p&gt;

&lt;h2&gt;
  
  
  Late BIOS Microcode Update
&lt;/h2&gt;

&lt;p&gt;On more recent processors, certain architectural features, such as Intel® Software Guard Extensions (Intel® SGX), require an additional late BIOS microcode update. In order to enable these architectural features, a late BIOS microcode update must be performed on all logical processors, even if the same microcode update has already been loaded from the FIT or during early BIOS. In that case, late BIOS must reload the same update that was loaded earlier. Failure to perform the late BIOS microcode update on all logical processors may prevent these architectural features from being used.&lt;/p&gt;

&lt;p&gt;During a late BIOS microcode update, the update may perform certain checks on the memory configuration and/or other settings required to enable these features. To facilitate the system checks, late BIOS load must occur after all of the following are completed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DRAM and memory map is configured&lt;/li&gt;
&lt;li&gt;Invocation of the first System Management Interrupt (SMI)&lt;/li&gt;
&lt;li&gt;System Management Mode (SMM) handler relocation&lt;/li&gt;
&lt;li&gt;Processor Reserved Memory Range Registers (PRMRR) are configured&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In a multisocket system, BIOS software must provide synchronization to perform the late BIOS microcode update on all sockets in parallel. During the update sequence, each CPU will attempt to synchronize with CPUs in other sockets. Failure to load the update in parallel across sockets may cause this synchronization to fail, which may prevent certain architectural features from being enabled. This multisocket synchronization is only necessary during the late BIOS microcode update on processors supporting features that specifically require it. It is not required when loading a microcode update from the OS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Early OS Microcode Update
&lt;/h2&gt;

&lt;p&gt;The operating system (OS) should check if it has a more recent microcode update (higher update revision) than the version applied by the BIOS. If it does, the OS should load that microcode update shortly after BIOS hands off control to the OS. This microcode update load point is called the early OS microcode update. This can be done by an early boot software layer such as a Unified Extensible Firmware Interface (UEFI) driver, a bootloader, the operating system, or any other software layer provided by the operating system (like early startup scripts). The early OS microcode update should be done on each core as early as possible in the OS boot sequence, before any CPUID feature flags or other enumeration values are cached by the OS software. It is also required to be loaded before any user-space applications or virtual machines are launched. This is necessary so that the update is loaded before the affected microcode is ever used, enabling any relevant mitigations for potential vulnerabilities as early as possible.&lt;/p&gt;

&lt;p&gt;If the BIOS does not load the most recent microcode update, Intel recommends loading that update during the early OS microcode update.&lt;/p&gt;

&lt;h2&gt;
  
  
  Runtime Microcode Update
&lt;/h2&gt;

&lt;p&gt;Runtime microcode update refers to loading an update while the system is fully operational and running workloads, possibly including user-space applications and virtual machines. Software should ensure that the same update is loaded on all cores. Some microcode updates may introduce new features and may change CPUID feature flags or other enumeration. Software that wishes to use features introduced via a runtime microcode update may need to reevaluate any CPUID feature flags or other enumeration after the update is loaded in order to take advantage of any new capabilities introduced by that microcode update.&lt;/p&gt;

&lt;p&gt;Runtime microcode update should be used when a system reset would be problematic (for example, when a system reset would impact server uptime requirements). Where possible, it is preferable to load microcode updates through BIOS or early OS.&lt;/p&gt;

&lt;p&gt;Ref: &lt;a href="https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/microcode-update-guidance.html" rel="noopener noreferrer"&gt;https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/best-practices/microcode-update-guidance.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>linux</category>
      <category>microcode</category>
      <category>intel</category>
    </item>
  </channel>
</rss>
