<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arun Kumar Singh</title>
    <description>The latest articles on DEV Community by Arun Kumar Singh (@arunksingh16).</description>
    <link>https://dev.to/arunksingh16</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F560423%2F148856a4-972c-4c20-aef4-0bd17a146b3b.jpg</url>
      <title>DEV Community: Arun Kumar Singh</title>
      <link>https://dev.to/arunksingh16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/arunksingh16"/>
    <language>en</language>
    <item>
      <title>Getting Started with AWS Bedrock AgentCore : Part 1</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Tue, 05 Aug 2025 13:32:31 +0000</pubDate>
      <link>https://dev.to/arunksingh16/getting-started-with-aws-bedrock-agentcore-part-1-4pi4</link>
      <guid>https://dev.to/arunksingh16/getting-started-with-aws-bedrock-agentcore-part-1-4pi4</guid>
      <description>&lt;p&gt;⚠️ Important: Amazon Bedrock AgentCore is in preview release and is subject to change. In this post, I will use an example from AWS and will extend it to have few more things.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Bedrock AgentCore
&lt;/h2&gt;

&lt;p&gt;Amazon Bedrock AgentCore is a complete set of capabilities to deploy and operate agents securely, at scale. It is a &lt;strong&gt;serverless&lt;/strong&gt; runtime purpose-built for deploying and scaling dynamic AI agents and tools using any open-source framework including &lt;strong&gt;Strands&lt;/strong&gt; Agents, &lt;strong&gt;LangChain&lt;/strong&gt;, &lt;strong&gt;LangGraph&lt;/strong&gt; and &lt;strong&gt;CrewAI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It supports any protocol such as MCP and A2A, and any model from any provider including Amazon Bedrock, OpenAI, Gemini, etc. Developers can securely and reliably run any type of agent including multi-modal, real-time, or long-running agents.&lt;/p&gt;

&lt;p&gt;The platform operates on a modular architecture with seven core components that can be used independently or together.&lt;/p&gt;

&lt;p&gt;AgentCore Runtime&lt;br&gt;
AgentCore Memory&lt;br&gt;
AgentCore Identity&lt;br&gt;
AgentCore Gateway&lt;br&gt;
AgentCore Observability&lt;br&gt;
AgentCore Built-in Tools&lt;br&gt;
I will not go through each and every component mentioned above but would like to cover the heart of this ecosystem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agent runtime&lt;/strong&gt;&lt;br&gt;
It represents a containerized application that processes user inputs, maintains context, and executes actions using AI capabilities. When you create an agent, you define its behavior, capabilities, and the tools it can access.&lt;/p&gt;

&lt;p&gt;Protocol support&lt;/p&gt;

&lt;p&gt;HTTP for simple request/response patterns&lt;br&gt;
Model Context Protocol (MCP) for standardized agent-tool interactions&lt;/p&gt;

&lt;p&gt;please note this service is available in 4 regions at the time of writing this post.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;How to deploy?&lt;/strong&gt;&lt;br&gt;
There are couple of ways how you can use Bedrock AgentCore. Let’s start with most basic way Bedrock AgentCore Runtime starter toolkit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Amazon Bedrock AgentCore Runtime starter toolkit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;this approach is good when you want to quickly deploy existing agent functions.&lt;/p&gt;

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

&lt;p&gt;Let’s build an agent using Strands framework and deploy it using toolkit.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To start with toolkit, you need following items →&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;An agent&lt;/li&gt;
&lt;li&gt;A role need to be created beforehand&lt;/li&gt;
&lt;li&gt;An ECR repository need to be created beforehand
Agent config you can find it here -&amp;gt; &lt;a href="https://github.com/arunksingh16/ai-projects/blob/main/aws-bedrock-agentcore-starter/agent.py" rel="noopener noreferrer"&gt;https://github.com/arunksingh16/ai-projects/blob/main/aws-bedrock-agentcore-starter/agent.py&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run agent or tool in AgentCore Runtime you need an AWS Identity and Access Management execution role. Starter toolkit package your agent as a container image so ECR repo is also required. Both of the item I have created using cdk. (make sure you update your account id in scripts where ever required).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Role and ECR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create required role and ECR using CDK script -&amp;gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/arunksingh16/ai-projects/tree/main/aws-bedrock-agentcore-starter/infra" rel="noopener noreferrer"&gt;https://github.com/arunksingh16/ai-projects/tree/main/aws-bedrock-agentcore-starter/infra&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you are done with role and ECR, lets try deploy the agentcore config. To run the config in the folder you need agentcore utility. That you can get it via -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install bedrock-agentcore-starter-toolkit

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

&lt;/div&gt;



&lt;p&gt;Now you are ready, make sure you have set AWS env variables and secret.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# this command will ask for ECR repository details and auth details. 
# please note i have used default IAM based auth
agentcore configure --entrypoint agent.py -n strands_agentcore -r us-east-1 -er "arn:aws:iam::&amp;lt;accountID&amp;gt;:role/MyBedrockAgentRol
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command will generate a Dockerfile, .dockerignore and .bedrock_agentcore.yaml configuration file in same folder.&lt;/p&gt;

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

&lt;p&gt;Please note&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Amazon Bedrock AgentCore requires ARM64 architecture for all deployed agents.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Launch your agent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# agentcore launch
agentcore launch --code-build
# the above command will create a docker image and push it to repository
# i have selected option of code-build so it will utilise AWS code
# build pipeline for that
# At last it will deploy it in AgentCore runtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;I noticed that the deployment started failing. In the latest version of the Bedrock AgentCore Starter Toolkit, there’s a new --&lt;code&gt;codebuild&lt;/code&gt; flag for the agentcore launch command, which enables &lt;code&gt;ARM64&lt;/code&gt; container builds. You can view the build process directly in AWS.&lt;/p&gt;

&lt;p&gt;Upon reviewing the logs, I realized it was referencing the wrong ECR. I updated the ECR value in the &lt;code&gt;.bedrock_agentcore.yaml&lt;/code&gt; file and re-ran the &lt;code&gt;agentcore launch&lt;/code&gt; command this time, it worked successfully.&lt;/p&gt;

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

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

&lt;p&gt;You can view your deployments in runtime console.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1qwunkuz7ys4x22vdjtx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1qwunkuz7ys4x22vdjtx.png" alt=" " width="800" height="337"&gt;&lt;/a&gt;&lt;br&gt;
Time to run some tests from cli.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;(myenv) ➜  my-strands-agent agentcore invoke '{"prompt": "What is 2+2?"}'
Payload:
{
  "prompt": "What is 2+2?"
}
Invoking BedrockAgentCore agent 'strands_agentcore' via cloud endpoint
Session ID: aa53199a-1760-4a60-ba62-5a8d511b216f

Response:
{
  "ResponseMetadata": {
    "RequestId": "ebacaf55-1750-434b-963c-41bfea5cde8e",
    "HTTPStatusCode": 200,
    "HTTPHeaders": {
      "date": "Mon, 04 Aug 2025 10:09:11 GMT",
      "content-type": "application/json",
      "transfer-encoding": "chunked",
      "connection": "keep-alive",
      "x-amzn-requestid": "ebacaf55-1750-434b-963c-41bfea5cde8e",
      "baggage": "Self=1-689086c2-61df3327557ffd33689d8f7b,session.id=aa53199a-1760-4a60-ba62-5a8d511b216f",
      "x-amzn-bedrock-agentcore-runtime-session-id": "aa53199a-1760-4a60-ba62-5a8d511b216f",
      "x-amzn-trace-id": "Root=1-689086c2-37bd21e07a967574243b50d0;Self=1-689086c2-61df3327557ffd33689d8f7b"
    },
    "RetryAttempts": 0
  },
  "runtimeSessionId": "aa53199a-1760-4a60-ba62-5a8d511b216f",
  "traceId": "Root=1-689086c2-37bd21e07a967574243b50d0;Self=1-689086c2-61df3327557ffd33689d8f7b",
  "baggage": "Self=1-689086c2-61df3327557ffd33689d8f7b,session.id=aa53199a-1760-4a60-ba62-5a8d511b216f",
  "contentType": "application/json",
  "statusCode": 200,
  "response": [
    "b'\"The answer is **4**.\"'"
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This was a valuable exercise. Another important takeaway is that performance and monitoring data can be viewed in the &lt;code&gt;CloudWatch GenAI Observability dashboard&lt;/code&gt; a newly released feature from AWS.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Can I place a streamlit front end?
&lt;/h2&gt;

&lt;p&gt;Lets modify the agent code to handle streaming response first. The Strands Agents SDK includes a special function, stream_async(prompt), that enables streaming. When you use this method, the agent starts processing the request such as a user question and as each part of the response (like a word or sentence or agent action) is generated, it is sent back immediately to the requester.&lt;/p&gt;

&lt;p&gt;So update the agent code entrypoint as -&amp;gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@app.entrypoint
async def invoke(payload):
    """Answer the user's question with streaming."""    
    user_message = payload.get("prompt")

    # Generate a response with streaming
    stream = agent.stream_async(user_message)
    async for event in stream:
        yield event
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Deploy the agent again using same command as earlier&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;agentcore launch --code-build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a steamlit frontend as following code link, make sure you update the &lt;code&gt;arn&lt;/code&gt; for &lt;code&gt;agentcore runtime&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/arunksingh16/ai-projects/blob/main/aws-bedrock-agentcore-starter/fronend.py" rel="noopener noreferrer"&gt;https://github.com/arunksingh16/ai-projects/blob/main/aws-bedrock-agentcore-starter/fronend.py&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;run the front end&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;streamlit run frontend.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now pass your prompt here !&lt;/p&gt;

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

&lt;h2&gt;
  
  
  How it is different from Strands Framework
&lt;/h2&gt;

&lt;p&gt;While both AgentCore and Strands Agents are AWS offerings for building AI agents, they serve distinctly different purposes and complement each other rather than compete.&lt;/p&gt;

&lt;p&gt;Strands Agents is an open-source SDK that focuses on simplifying the development of AI agents through a model-driven approach.&lt;/p&gt;

&lt;p&gt;AgentCore, in contrast, is an infrastructure and deployment platform that provides the production-grade foundation for running any agent framework, including Strands. The relationship is complementary.&lt;/p&gt;

&lt;p&gt;As one technical analysis noted: “Strands gives you the tools to build the agent, AgentCore gives you the infrastructure to run it at scale”. AgentCore explicitly supports Strands Agents as one of its compatible frameworks, allowing developers to build with Strands and deploy on AgentCore infrastructure&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features in AgentCore
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;Framework Agnostic&lt;/code&gt;: Works with any AI agent framework (Strands, LangGraph, CrewAI, AutoGen, or custom logic)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Enterprise Infrastructure&lt;/code&gt;: AWS-managed infrastructure with built-in gateway and memory integrations&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Memory Management&lt;/code&gt;: Sophisticated conversation memory with semantic strategies and branching&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Async Task Management&lt;/code&gt;: Built-in support for long-running background tasks&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Health Monitoring&lt;/code&gt;: Real-time health status and monitoring capabilities&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I would like to cover majority of this in next posts.&lt;/p&gt;

&lt;p&gt;Till then, Stay Safe and Take Care.&lt;/p&gt;




&lt;p&gt;💬 Let’s Connect&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;LinkedIn: &lt;a href="https://www.linkedin.com/in/arunksingh16/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/arunksingh16/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/arunksingh16" rel="noopener noreferrer"&gt;https://github.com/arunksingh16&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Twitter: &lt;a href="https://twitter.com/arun16" rel="noopener noreferrer"&gt;https://twitter.com/arun16&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Medium: &lt;a href="https://arunksingh16.medium.com/" rel="noopener noreferrer"&gt;https://arunksingh16.medium.com/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>bedrock</category>
      <category>aws</category>
      <category>ai</category>
      <category>agentcore</category>
    </item>
    <item>
      <title>Introducing aws cdk drift</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Thu, 29 May 2025 20:37:14 +0000</pubDate>
      <link>https://dev.to/arunksingh16/introducing-aws-cdk-drift-572p</link>
      <guid>https://dev.to/arunksingh16/introducing-aws-cdk-drift-572p</guid>
      <description>&lt;p&gt;As AWS CDK (Cloud Development Kit) continues to evolve, so does its tooling to ensure infrastructure consistency. A significant addition to the CDK CLI is the cdk drift command, &lt;code&gt;introduced in version 2.1017.0 (build f227c9b) yesterday&lt;/code&gt;. It facilitates drift detection. - a critical feature for maintaining the integrity of your cloud resources. This blog post aims to demystify drift detection in AWS CDK, contrasting it with the cdk diff command, and providing a practical example to illustrate its application.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Drift Detection?
&lt;/h2&gt;

&lt;p&gt;Drift detection in AWS CloudFormation identifies discrepancies between the actual state of your stack resources and their expected configurations as defined in your templates. Such drifts often result from manual changes made outside the CDK or CloudFormation workflows, leading to potential inconsistencies, security vulnerabilities, or operational issues. The cdk drift command integrates with CloudFormation's drift detection capabilities, enabling CDK users to detect and address these inconsistencies directly from the CLI.&lt;/p&gt;

&lt;h2&gt;
  
  
  cdk drift vs. cdk diff: Understanding the Difference
&lt;/h2&gt;

&lt;p&gt;While both &lt;code&gt;cdk drift&lt;/code&gt; and &lt;code&gt;cdk diff&lt;/code&gt; are tools for comparing infrastructure states, they serve distinct purposes:&lt;br&gt;
&lt;strong&gt;cdk diff&lt;/strong&gt;: Compares your local CDK application's synthesized CloudFormation template with the last deployed stack template. It highlights changes you intend to deploy but does not consider the current state of live resources. It is useful for previewing changes before deployment to avoid surprises.&lt;br&gt;
&lt;strong&gt;cdk drift&lt;/strong&gt;: Compares the last deployed stack template with the actual live configuration of resources in your AWS account. It detects changes made outside of the CDK or CloudFormation, such as manual modifications via the AWS Console or CLI.&lt;/p&gt;

&lt;p&gt;In essence, cdk diff is proactive, showing what will change upon deployment, whereas cdk drift is reactive, revealing unauthorized or unintended changes that have already occurred.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Getting Started with cdk drift&lt;/strong&gt;&lt;br&gt;
To use the cdk drift command, make sure you're using AWS CDK CLI version 2.1017.0&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g aws-cdk@2.1017.0
npx cdk --version
# Should output something like: 2.1017.0 (build f227c9b)
npx cdk -h # it will start listing command option for drift
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;h2&gt;
  
  
  POC: Detecting Drift in an S3 Bucket
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Let's walk through a scenario to understand how cdk drift operates.
Define and Deploy an S3 Bucket Using CDK.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
// import * as sqs from 'aws-cdk-lib/aws-sqs';
import * as s3 from 'aws-cdk-lib/aws-s3';
export class CdkdriftStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new s3.Bucket(this, 'MyBucket', {
      versioned: true,
      removalPolicy: cdk.RemovalPolicy.DESTROY,
    });
  }
}

const app = new cdk.App();
new CdkdriftStack(app, 'CdkdriftStack');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Verify the bucket created and run cdk diff.&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Lets do some manual changes, After deployment, navigate to the AWS Console, manually disable the bucket versioning&lt;/li&gt;
&lt;/ul&gt;

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

&lt;ul&gt;
&lt;li&gt;Run the &lt;code&gt;cdk diff&lt;/code&gt; again and this shows no difference because your local CDK code still defines the bucket as versioned. cdk diffonly compares your local template with the last deployed template, which still expects versioning enabled.
Run &lt;code&gt;cdk drift&lt;/code&gt; - This triggers drift detection against the live stack. It detects that the bucket's versioning property has drifted (disabled manually).&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;The introduction of the cdk drift command enhances AWS CDK's capabilities, providing developers with a powerful tool to ensure their infrastructure remains consistent with defined configurations. By understanding and utilizing drift detection, teams can proactively manage their cloud resources, reduce unexpected issues, and maintain compliance with organizational standards.&lt;/p&gt;




&lt;p&gt;References&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/aws/aws-cdk/issues/1723" rel="noopener noreferrer"&gt;https://github.com/aws/aws-cdk/issues/1723&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;💬 Let's Connect&lt;br&gt;
LinkedIn: &lt;a href="https://www.linkedin.com/in/arunksingh16/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/arunksingh16/&lt;/a&gt;&lt;br&gt;
GitHub: &lt;a href="https://github.com/arunksingh16" rel="noopener noreferrer"&gt;https://github.com/arunksingh16&lt;/a&gt;&lt;br&gt;
Twitter: &lt;a href="https://twitter.com/arun16" rel="noopener noreferrer"&gt;https://twitter.com/arun16&lt;/a&gt;&lt;br&gt;
Medium: &lt;a href="https://medium.com/@arunksingh16" rel="noopener noreferrer"&gt;https://medium.com/@arunksingh16&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cdk</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>Terraform: Good to know features - Post 1</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Sun, 12 Sep 2021 18:00:18 +0000</pubDate>
      <link>https://dev.to/arunksingh16/terraform-good-to-know-features-post-1-3ofa</link>
      <guid>https://dev.to/arunksingh16/terraform-good-to-know-features-post-1-3ofa</guid>
      <description>&lt;h2&gt;
  
  
  Terraform Validation
&lt;/h2&gt;

&lt;p&gt;Starting Terraform 0.13, Hashicorp has released Custom Variable Validation in HCL. Each variable block can have zero or more validation blocks and an error message. It's quite useful feature which gives you an edge to control the values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable "cloudenv" {
  type        = string
  description = "Cloud Environment"

  validation {
    condition = anytrue([
      var.cloudenv == "prd",
      var.cloudenv == "qa",
      var.cloudenv == "uat",
      var.cloudenv == "dev"
    ])
    error_message = "Must be a valid Cloud Env, values can be prd, qa, uat, or dev."
  }
}

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Terraform Suppressing Values
&lt;/h2&gt;

&lt;p&gt;There are certain cases in which you want terraform not to print the information when you run &lt;code&gt;plan&lt;/code&gt; or &lt;code&gt;apply&lt;/code&gt;. Good part is terraform has a way for you. Setting a variable as sensitive prevents Terraform from showing its value in the plan or apply output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;variable "user_information" {
  type = object({
    name    = string
    address = string
  })
  sensitive = true
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Debug terraform
&lt;/h2&gt;

&lt;p&gt;You can set TF_LOG to one of the log levels TRACE, DEBUG, INFO, WARN or ERROR to change the verbosity of the logs and push it to one of the files on disk for analysis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir logs
export TF_LOG_PATH="./logs/terraform.log"
export TF_LOG="INFO" 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>terraform</category>
      <category>devops</category>
    </item>
    <item>
      <title>My Git Notebook!</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Thu, 05 Aug 2021 17:13:17 +0000</pubDate>
      <link>https://dev.to/arunksingh16/my-git-notebook-32i6</link>
      <guid>https://dev.to/arunksingh16/my-git-notebook-32i6</guid>
      <description>&lt;p&gt;&lt;code&gt;This is Just another post on Git. Nothing new, everything is available in web! I have just collected few important concepts for day to day work.&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Git Remote Server
&lt;/h2&gt;

&lt;p&gt;Remote repositories are versions of your project that are hosted on the Internet or network somewhere.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# origin - default name for remote server
git remote add origin &amp;lt;remote url&amp;gt;
# list remote urls
git remote -v
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To track any remote branch&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout --track origin/feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;receive changes from remote repo -&lt;br&gt;
&lt;code&gt;git fetch&lt;/code&gt; - download changes and then you can evaluate &lt;br&gt;
&lt;code&gt;git pull&lt;/code&gt; - combination of fetch and merge&lt;/p&gt;
&lt;h2&gt;
  
  
  Use diff
&lt;/h2&gt;

&lt;p&gt;diff command is pretty useful while working with git.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# what changed since last commit
git diff HEAD
# diff between branches
git diff feature master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Branching is helpful !
&lt;/h2&gt;

&lt;p&gt;Think of a situation you have checked out on a &lt;code&gt;master&lt;/code&gt; branch and found a code bug. You start making changes to fix that and in the meantime you realised that you are directly making changes in master!&lt;br&gt;
You thought to press &lt;code&gt;ctrl+Z&lt;/code&gt; but you don't want to loose the potential solution. In this situation branching can help. Checkout your solution with new branch and keep it in new branch until you are ok with the solution. This is  simple scenario but there can be number of others. Branching is beautiful just you need to know, how to handle it!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Checkout a branch
git checkout &amp;lt;existing branch&amp;gt;

# Checkout and create a new branch
git checkout -b &amp;lt;new branch name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Picking specific changes(folder/file) from another branch
&lt;/h2&gt;

&lt;p&gt;Consider you have few changes on branch &lt;code&gt;features/myFix&lt;/code&gt; and you want to merge it in &lt;code&gt;features/BugRel&lt;/code&gt; . All changes are in a folder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# checkout your features/BugRel branch
git checkout features/BugRel

# pick changes from folder
git checkout features/myFix -- MyFixChanges/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all you have to do. Now that folder is in your branch, commit it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rename/Delete Branch
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git branch -m &amp;lt;oldname&amp;gt; &amp;lt;newname&amp;gt;
git branch -d &amp;lt;branchname&amp;gt;
# force delete
git branch -D &amp;lt;branchname&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Merge and Compare Branches
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Fast-forward&lt;/code&gt; - Because there was no conflicting activity in the target branch when we are merging changes from source, commits happen in sequence&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git checkout &amp;lt;target branch&amp;gt;
git merge &amp;lt;source branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use diff always before merging&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git diff &amp;lt;target branch&amp;gt; &amp;lt;source branch&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before starting merge always update from remote.&lt;/p&gt;

&lt;p&gt;Aborting a merge&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git merge --abort
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rebase
&lt;/h2&gt;

&lt;p&gt;An advance feature, Clean-up your local history(Squashing multiple commit into one) or pull changes from a branch into your branch without performing a merge. Use it only &lt;code&gt;your&lt;/code&gt; working branch not on public branch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git log --oneline
git rebase -i &amp;lt;sha&amp;gt;
# to visit what happened after rebase
git reflog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cherry Pick
&lt;/h2&gt;

&lt;p&gt;Cherry picking is the act of picking a commit from a branch and applying it to another.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# find the commit details
git log &amp;lt;branch name&amp;gt; --oneline
# checkout the branch where you want to put the commit
git checkout &amp;lt;b-name&amp;gt;
# perform the cherry pick commit to HEAD
git cherry-pick &amp;lt;commit&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's All for this post. Thanks&lt;/p&gt;

</description>
      <category>github</category>
      <category>devops</category>
    </item>
    <item>
      <title>Activation Failure / 504 Gateway Timeout in Atlassian Jira</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Tue, 08 Jun 2021 17:39:40 +0000</pubDate>
      <link>https://dev.to/arunksingh16/activation-failure-504-gateway-timeout-in-atlassian-jira-200h</link>
      <guid>https://dev.to/arunksingh16/activation-failure-504-gateway-timeout-in-atlassian-jira-200h</guid>
      <description>&lt;p&gt;While deploying Jira in Kubernetes or Docker you might have faced &lt;code&gt;Activation Failure / 504 Gateway Timeout&lt;/code&gt; issues while working with plugins load. There can be other root causes but most prominent one is that your Jira Universal Plugin Manager is trying to connect to Marketplace. We can disable the same in Jira to avoid these errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;Switching UPM to offline mode in Jira&lt;/code&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://marketplace.atlassian.com" rel="noopener noreferrer"&gt;https://marketplace.atlassian.com&lt;/a&gt;&lt;br&gt;
&lt;a href="https://marketplace-cdn.atlassian.com" rel="noopener noreferrer"&gt;https://marketplace-cdn.atlassian.com&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To fix that you can disable it via system property&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Set the system property upm.pac.disable to true. When this property is set to true, UPM does not try to access the Atlassian Marketplace. Example:
-Dupm.pac.disable=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or Login in application and follow the steps below :-&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;From the top navigation bar in your application, choose  &amp;gt; Add-ons or Manage apps&lt;/li&gt;
&lt;li&gt;Click the Settings link at the bottom of the page.&lt;/li&gt;
&lt;li&gt;Uncheck the Connect to the Atlassian Marketplace checkbox. This option is enabled by default.&lt;/li&gt;
&lt;li&gt;Click Apply&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;References:&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://confluence.atlassian.com/upm/disabling-and-enabling-apps-273875716.html" rel="noopener noreferrer"&gt;https://confluence.atlassian.com/upm/disabling-and-enabling-apps-273875716.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://confluence.atlassian.com/upm/problems-connecting-to-the-atlassian-marketplace-273875718.html" rel="noopener noreferrer"&gt;https://confluence.atlassian.com/upm/problems-connecting-to-the-atlassian-marketplace-273875718.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://confluence.atlassian.com/upm/configuring-marketplace-connectivity-306350947.html" rel="noopener noreferrer"&gt;https://confluence.atlassian.com/upm/configuring-marketplace-connectivity-306350947.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>jira</category>
      <category>atlassian</category>
    </item>
    <item>
      <title>Configure Proxy credentials in docker-desktop windows?</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Fri, 21 May 2021 10:55:58 +0000</pubDate>
      <link>https://dev.to/arunksingh16/configure-proxy-credentials-in-docker-desktop-windows-1hj4</link>
      <guid>https://dev.to/arunksingh16/configure-proxy-credentials-in-docker-desktop-windows-1hj4</guid>
      <description>&lt;p&gt;Open Docker Desktop Settings &amp;gt; Proxies &amp;gt; Set Manual proxy configuration&lt;/p&gt;

&lt;p&gt;Put proxy details and give it a try&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;format: proxy:port
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this does not work. try this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;format: domain\username:password@proxy:port
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please encode special characters in password at &lt;a href="https://www.url-encode-decode.com" rel="noopener noreferrer"&gt;https://www.url-encode-decode.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure you add URLs which need to Bypass. Thanks&lt;/p&gt;

</description>
      <category>tip</category>
      <category>docker</category>
    </item>
    <item>
      <title>Shell Tips</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Sun, 25 Apr 2021 20:03:58 +0000</pubDate>
      <link>https://dev.to/arunksingh16/shell-tips-544b</link>
      <guid>https://dev.to/arunksingh16/shell-tips-544b</guid>
      <description>&lt;h3&gt;
  
  
  Extract File name in bash:-
&lt;/h3&gt;

&lt;p&gt;You can use &lt;code&gt;basename&lt;/code&gt; to Strip directory and suffix from filenames&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for i in /tmp/files/*/*; do
 key=$(basename $i)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add Date in File or folder Name:-
&lt;/h3&gt;

&lt;p&gt;In case you have requirement of adding date in your file or folder name&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;now=$(date +"%m-%d-%Y")
printf "%s\n" $now
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  User Input:-
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;read&lt;/code&gt; command can be used to take input from user.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;read -p "Please input $inp? [yn]" answer
if [[ $answer = y ]] ; then
  # run the command
  echo "Yes"
fi

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Use set -x to watch execution
&lt;/h3&gt;

&lt;p&gt;By default, after the script is executed, it only displays the results. You can use &lt;code&gt;set -x&lt;/code&gt; to output the executed command line before its execution result.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root@bd92bbce2f7d:/# cat dummy.sh
#!/usr/bin/env bash
set -x
echo Step 1
echo Step 2


root@bd92bbce2f7d:/# sh dummy.sh
+ echo Step 1
Step 1
+ echo Step 2
Step 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I will keep updating this post, if I find something useful. Thanks&lt;/p&gt;

</description>
      <category>shell</category>
      <category>bash</category>
    </item>
    <item>
      <title>How to run multiple commands in Docker Container</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Sun, 25 Apr 2021 20:02:27 +0000</pubDate>
      <link>https://dev.to/arunksingh16/how-to-run-multiple-commands-in-docker-container-3bid</link>
      <guid>https://dev.to/arunksingh16/how-to-run-multiple-commands-in-docker-container-3bid</guid>
      <description>&lt;p&gt;There can be scenarios in which you may have to run/execute commands using a container to get something done.  &lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run &amp;lt;your container&amp;gt; /bin/bash -c "command1; command2"&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arun@mymachine:~ sudo docker run singharunk/dev /bin/bash -c "date; whoami"
Sun Apr 25 19:58:50 UTC 2021
root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






</description>
      <category>devops</category>
      <category>docker</category>
      <category>container</category>
    </item>
    <item>
      <title>How to delete Kubernetes pods hanging in Terminating state</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Tue, 06 Apr 2021 10:20:17 +0000</pubDate>
      <link>https://dev.to/arunksingh16/how-to-delete-kubernetes-pods-hanging-in-terminating-state-4609</link>
      <guid>https://dev.to/arunksingh16/how-to-delete-kubernetes-pods-hanging-in-terminating-state-4609</guid>
      <description>&lt;p&gt;While working on Kubernetes environment you may see hanging PODs after termination. You will see the state of &lt;code&gt;Terminating&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl get pods
 NAME        READY     STATUS        RESTARTS   AGE
 nginx       0/1       Terminating   0          1d
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This can hold your work for sometime. In these cases you need to find the root cause of this issue but in the mean time if you want to quickly get rid of those pods, run following command -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ kubectl delete pod &amp;lt;pod-name&amp;gt; -n &amp;lt;namespace&amp;gt; --grace-period=0 --force
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>kubernetes</category>
      <category>devops</category>
    </item>
    <item>
      <title>My Azure Notebook: Key Things</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Tue, 23 Mar 2021 17:23:02 +0000</pubDate>
      <link>https://dev.to/arunksingh16/my-azure-notebook-key-things-2d6m</link>
      <guid>https://dev.to/arunksingh16/my-azure-notebook-key-things-2d6m</guid>
      <description>&lt;p&gt;&lt;strong&gt;Organisation&lt;/strong&gt;— An organization represents a business entity that is using Microsoft cloud offerings. The organization is a container for subscriptions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure subscription&lt;/strong&gt;— A subscription is an agreement with Microsoft to use one or more Microsoft cloud platforms or services&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User Acccount&lt;/strong&gt;— User accounts for all of Microsoft’s cloud offerings are stored in an Azure Active Directory (Azure AD) tenant. An Azure AD tenant can be synchronized with your existing Active Directory Domain Services. Multiple subscriptions of an organization can use the same Azure AD tenant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure AD tenant&lt;/strong&gt;— A dedicated and trusted instance of Azure AD that’s automatically created when your organization signs up for a Microsoft cloud service subscription, such as Microsoft Azure, Microsoft Intune, or Microsoft 365. An Azure tenant represents a single organization.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource&lt;/strong&gt;— A manageable item that is available through Azure. Virtual machines, storage accounts, web apps, databases, and virtual networks are examples of resources. Resource groups, subscriptions, management groups, and tags are also examples of resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource group&lt;/strong&gt;— A container that holds related resources for an Azure solution. The resource group includes those resources that you want to manage as a group. You decide which resources belong in a resource group based on what makes the most sense for your organization. See Resource groups.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resource provider&lt;/strong&gt;— A service that supplies Azure resources. For example, a common resource provider is Microsoft.Compute, which supplies the virtual machine resource. Microsoft.Storage is another common resource provider. See Resource providers and types.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure Stock Keeping Unit(SKU)&lt;/strong&gt;— It represents a purchasable Stock Keeping Unit (SKU) under a product. It can be of different type depends on product. Kind of Item for sale !&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure compute unit (ACU)&lt;/strong&gt;— The Azure Compute Unit (ACU) is used in understanding the relative compute performance between different Azure compute series VMs. Microsoft uses the ACU concept to help you compare computing performance across the different types of compute VM SKUs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure Service principal&lt;/strong&gt;— An Azure service principal is an identity created for use with applications, hosted services, and automated tools to access Azure resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Azure App Registration&lt;/strong&gt;- In order to delegate Identity and Access Management functions to Azure AD, an application must be registered with an Azure AD tenant. When you register your application with Azure AD, you are creating an identity configuration for your application that allows it to integrate with Azure AD.&lt;/p&gt;

</description>
      <category>azure</category>
      <category>devops</category>
    </item>
    <item>
      <title>PowerShell Tricks 💡</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Fri, 19 Mar 2021 18:54:33 +0000</pubDate>
      <link>https://dev.to/arunksingh16/powershell-tricks-2n24</link>
      <guid>https://dev.to/arunksingh16/powershell-tricks-2n24</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Finding Version of your powershell&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17763.1490
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1490
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;List AD Groups which you are part of :&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; $id = [Security.Principal.WindowsIdentity]::GetCurrent()
PS C:\&amp;gt; $groups = $id.Groups | foreach-object {$_.Translate([Security.Principal.NTAccount])}
PS C:\&amp;gt; $groups | select *
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;List Processes&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; Get-Process | Sort-Object CPU -descending | Select-Object -first 1

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   2593      97   154056     174068     458.39  18020   1 chrome

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Filter Example&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get-Process | Select-Object -Property 'Id','StartTime','HandleCount' | Where-Object -FilterScript { $_.Id -eq "1"  } | Format-Table -AutoSize
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;To list what modules are loaded in current powershell session&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}
Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}


# List Available Modules

PS C:\&amp;gt; Get-Module -ListAvailable
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Locate your command&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; Get-Command -Name *service*

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           Get-ASRServicesProvider                            0.2.4      AzureRM.RecoveryServices.SiteRecovery
Alias           Get-AzureRmRecoveryServicesAsrNotificationSetting  0.2.4      AzureRM.RecoveryServices.SiteRecovery
Alias           Get-AzureRmRecoveryServicesAsrVaultSettings        0.2.4      AzureRM.RecoveryServices.SiteRecovery
Alias           Get-AzureRmRecoveryServicesBackupProperties        4.1.2      AzureRM.RecoveryServices
Alias           New-AzureRmDataFactoryV2LinkedService              0.5.3      AzureRM.DataFactoryV2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Using Get-Help&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; Get-Help -Name *TIME*

Name                              Category  Module                    Synopsis
----                              --------  ------                    --------
New-TimeSpan                      Cmdlet    Microsoft.PowerShell.U... ...
Get-TimeZone                      Cmdlet    Microsoft.PowerShell.M... ...
Set-TimeZone                      Cmdlet    Microsoft.PowerShell.M... ...

PS C:\&amp;gt; Get-Help Get-TimeZone

NAME
    Get-TimeZone

SYNTAX
    Get-TimeZone [[-Name] &amp;lt;string[]&amp;gt;]  [&amp;lt;CommonParameters&amp;gt;]

    Get-TimeZone -Id &amp;lt;string[]&amp;gt;  [&amp;lt;CommonParameters&amp;gt;]

    Get-TimeZone -ListAvailable  [&amp;lt;CommonParameters&amp;gt;]


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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;To find out the information attached with an object use “Get-Member” cmdlet.&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; Get-Service | Get-Member


   TypeName: System.ServiceProcess.ServiceController

Name                      MemberType    Definition
----                      ----------    ----------
Name                      AliasProperty Name = ServiceName
RequiredServices          AliasProperty RequiredServices = ServicesDependedOn
Disposed                  Event         System.EventHandler Disposed(System.Object, System.EventArgs)
Close                     Method        void Close()
Continue                  Method        void Continue()
CreateObjRef              Method        System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
Dispose                   Method        void Dispose(), void IDisposable.Dispose()
Equals                    Method        bool Equals(System.Object obj)
ExecuteCommand            Method        void ExecuteCommand(int command)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Repository from where packages are coming&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\&amp;gt; Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Grep Examples&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\Temp&amp;gt; Select-String -Path *.yaml -Pattern "kind" | Select Filename, LineNumber, Line, Path | Format-Table

Filename          LineNumber Line                        Path
--------          ---------- ----                        ----
lgl.yaml                   4 kind: ConfigMap             C:\Temp\lgl.yaml
lgl.yaml                  19 kind: ConfigMap             C:\Temp\lgl.yaml
lgl.yaml                  33 kind: Service               C:\Temp\lgl.yaml
lgl.yaml                  51 kind: Service               C:\Temp\lgl.yaml

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Place output of command in a file&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Get-Process | Select-Object -Property 'Id','StartTime' | Out-File a.txt

Select-String -Path *.yaml -Pattern "kind" | Select Filename, LineNumber, Line, Path | Format-Table | Export-Csv -path output.csv -NoTypeInformation

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Path&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$Env:Path += ";c:\temp"
Set-Item -Path Env:Path -Value ($Env:Path + ";C:\Temp")

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Command History&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PS C:\Temp&amp;gt; Get-History

  Id CommandLine
  -- -----------
   1 cd c:/
   2 $id = [Security.Principal.WindowsIdentity]::GetCurrent()
   3 $groups = $id.Groups | foreach-object {$_.Translate([Security.Principal.NTAccount])}
   4 $groups | select *

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Copy Data&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Copy-Item -Filter *.yaml -Path c:\temp -Recurse -Destination D:\temp\
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;I will keep updating this post if I find something useful. Thanks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://arunksingh16.medium.com/how-to-work-with-powershell-6a2c3fc38d0f" rel="noopener noreferrer"&gt;more on PowerShell&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>powershell</category>
      <category>devops</category>
      <category>tricks</category>
    </item>
    <item>
      <title>Docker: Running Linux Container with a Non-Root user</title>
      <dc:creator>Arun Kumar Singh</dc:creator>
      <pubDate>Fri, 19 Mar 2021 17:50:10 +0000</pubDate>
      <link>https://dev.to/arunksingh16/docker-running-linux-container-with-a-non-root-user-2dg</link>
      <guid>https://dev.to/arunksingh16/docker-running-linux-container-with-a-non-root-user-2dg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Common way of Running Container&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arun@controller:~$ sudo docker run -it ubuntu bash 
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
83ee3a23efb7: Already exists 
db98fc6f11f0: Already exists 
f611acd52c6c: Already exists 
Digest: sha256:703218c0465075f4425e58fac086e09e1de5c340b12976ab9eb8ad26615c3715
Status: Downloaded newer image for ubuntu:latest
root@27e9f62a1021:/# 
root@27e9f62a1021:/# whoami 
root
root@27e9f62a1021:/# 

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

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;You can pass user-id and group-id as a argument to run a container with different user&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;arun@controller:~$ sudo docker run --rm -it -u $(id -u ${USER}):$(id -g ${USER}) ubuntu bash 
groups: cannot find name for group ID 1000
I have no name!@186e2848baf1:/$ whoami
whoami: cannot find name for user ID 1000
I have no name!@186e2848baf1:/$ id
uid=1000 gid=1000 groups=1000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>container</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
