<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by hemant jangir on Medium]]></title>
        <description><![CDATA[Stories by hemant jangir on Medium]]></description>
        <link>https://medium.com/@h.jangir1998?source=rss-ec898468c83e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5wu_VoeH8AB1-amC</url>
            <title>Stories by hemant jangir on Medium</title>
            <link>https://medium.com/@h.jangir1998?source=rss-ec898468c83e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:20:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@h.jangir1998/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Image push to dockerHub]]></title>
            <link>https://medium.com/@h.jangir1998/image-push-to-dockerhub-5ba61edb2384?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ba61edb2384</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 13:47:34 GMT</pubDate>
            <atom:updated>2023-11-22T14:00:11.779Z</atom:updated>
            <content:encoded><![CDATA[<p>You need to tag your docker image</p><pre>docker image tag &lt;image_name&gt;:&lt;tag&gt; &lt;DockerHub_username&gt;/&lt;image_name&gt;:&lt;tag&gt;</pre><p>Now Image push to dockerHub</p><pre>docker push &lt;DockerHub_username&gt;/&lt;image_name&gt;:&lt;tag&gt;</pre><p>Example:</p><pre>docker image tag two-tier-app:latest hemantjangir/two-tier-app:latest</pre><pre>docker push hemantjangir/two-tier-app:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jYZSKUDR-XV18_5BnaL5FA.png" /></figure><p>Here you can see the docker image successfully push to dockerhub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*Om6-8DnaGvXiU74RsLuZIQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ba61edb2384" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker volume size reduce]]></title>
            <link>https://medium.com/@h.jangir1998/docker-volume-size-reduce-2ea43a80aadf?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ea43a80aadf</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 16:10:35 GMT</pubDate>
            <atom:updated>2023-11-21T16:41:55.304Z</atom:updated>
            <content:encoded><![CDATA[<pre>from flask import Flask, render_template<br><br>app = Flask(__name__)<br><br>@app.route(&#39;/&#39;)<br>def hello():<br>    return None<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=5000)</pre><pre>FROM python:3.9 <br><br>WORKDIR /app<br><br>COPY . .<br><br>RUN pip install flask <br><br>CMD [&quot;python&quot;,&quot;app.py&quot;]</pre><p>Here you can see the size of docker images is around 1 GB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*Y3oPh-ZWhtLhwX3ZTCRn3Q.png" /></figure><pre>#stage-1<br>FROM python:3.9 AS stage-1<br><br>WORKDIR /app<br><br>COPY . .<br><br>#stage-2<br>FROM python:3.9-slim-bullseye      # slim-bullseye is smaller base image <br><br>COPY --from=stage-1 /app /app <br><br>RUN pip install flask <br><br>CMD [&quot;python&quot;,&quot;app.py&quot;]</pre><p>Now after use slim-bullseye base image, you can see that size reduce from 1GB to 135 MB</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*y5iG-bK8H49Dqfr06JDuUQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ea43a80aadf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[two-tier-app]]></title>
            <link>https://medium.com/@h.jangir1998/two-tier-app-3635b0d5fa13?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3635b0d5fa13</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 16:06:11 GMT</pubDate>
            <atom:updated>2023-11-22T14:00:01.529Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Deploying a Two-Tire App with Docker-compose</strong></h3><p>Dockercompose — to run multiple container together. it build and run container on a single command so also save lot’s of time.</p><p>app.py</p><pre>import os<br>from flask import Flask, render_template, request, redirect, url_for<br>from flask_mysqldb import MySQL<br><br>app = Flask(__name__)<br><br># Configure MySQL from environment variables<br>app.config[&#39;MYSQL_HOST&#39;] = os.environ.get(&#39;MYSQL_HOST&#39;, &#39;localhost&#39;)<br>app.config[&#39;MYSQL_USER&#39;] = os.environ.get(&#39;MYSQL_USER&#39;, &#39;default_user&#39;)<br>app.config[&#39;MYSQL_PASSWORD&#39;] = os.environ.get(&#39;MYSQL_PASSWORD&#39;, &#39;default_password&#39;)<br>app.config[&#39;MYSQL_DB&#39;] = os.environ.get(&#39;MYSQL_DB&#39;, &#39;default_db&#39;)<br><br># Initialize MySQL<br>mysql = MySQL(app)<br><br>@app.route(&#39;/&#39;)<br>def hello():<br>    cur = mysql.connection.cursor()<br>    cur.execute(&#39;SELECT message FROM messages&#39;)<br>    messages = cur.fetchall()<br>    cur.close()<br>    return render_template(&#39;index.html&#39;, messages=messages)<br><br>@app.route(&#39;/submit&#39;, methods=[&#39;POST&#39;])<br>def submit():<br>    new_message = request.form.get(&#39;new_message&#39;)<br>    cur = mysql.connection.cursor()<br>    cur.execute(&#39;INSERT INTO messages (message) VALUES (%s)&#39;, [new_message])<br>    mysql.connection.commit()<br>    cur.close()<br>    return redirect(url_for(&#39;hello&#39;))<br><br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=5000, debug=True)</pre><p>make new folder name templates and inside this create a file index.html</p><p>index.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br><br>&lt;head&gt;<br>    <br>    &lt;title&gt;Flask App&lt;/title&gt;<br>    &lt;style&gt;<br>       /*............*/<br>    &lt;/style&gt;<br>&lt;/head&gt;<br><br>&lt;body&gt;<br>    &lt;div class=&quot;container&quot;&gt;<br>        &lt;h1&gt;Hello Dosto, <br>            Let&#39;s make a 2 Tier Application with Flask and MYSQL!&lt;/h1&gt;<br>        {% for message in messages %}<br>            &lt;p&gt;{{ message[0] }}&lt;/p&gt;<br>        {% endfor %}<br><br>        &lt;form action=&quot;/submit&quot; method=&quot;post&quot;&gt;<br>            &lt;input type=&quot;text&quot; name=&quot;new_message&quot; placeholder=&quot;Enter a new message&quot;&gt;<br>            &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;<br>        &lt;/form&gt;<br>    &lt;/div&gt;<br>&lt;/body&gt;<br><br>&lt;/html&gt;<br><br></pre><p>requirements.txt</p><pre>Flask==2.0.1<br>Flask-MySQLdb==0.2.0<br>requests==2.26.0</pre><p>Dockerfile</p><pre>FROM python:3.9-slim<br><br>WORKDIR /app<br><br>COPY  . .<br><br>RUN pip install -r requirements.txt<br><br>CMD [ &quot;python&quot;,&quot;app.py&quot; ]</pre><p>Now build a docker file</p><pre>docker build . -t two-tier-app</pre><p>Here if we build this dockerfile it gives an error because we take a slim size of a base images. here we copy this error and check form google.</p><p><strong>ERROR :-</strong></p><pre>Exception: Can not find valid pkg-config name.<br>      Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually<br>      [end of output]</pre><p>Now copy google code for resolve this problem</p><pre>FROM python:3.9-slim<br><br>RUN apt-get update \<br>    &amp;&amp; apt-get upgrade -y \<br>    &amp;&amp; apt-get install -y gcc default-libmysqlclient-dev pkg-config \<br>    &amp;&amp; rm -rf /var/lib/apt/lists/*<br><br>WORKDIR /app<br><br>COPY  . .<br><br>RUN pip install --upgrade pip \<br>    &amp;&amp; pip install mysqlclient \<br>    &amp;&amp; pip install -r requirements.txt<br><br>CMD [ &quot;python&quot;,&quot;app.py&quot; ]</pre><p>now run docker images</p><pre>docker run -d -p 5000:5000 two-tier-app:latest</pre><p>NOTE : — If your port not visible in docker ps cmd then, refresh your instance or restart your docker, otherwise change ec2 instance</p><p>Now open 5000 port on browser and here you see Operational Error . Because there isn’t any database connection.</p><p>Error : MySQLdb.OperationalError: (2002, “Can’t connect to local server through socket ‘/run/mysqld/mysqld.sock’ (2)”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bKScZZqE2z3tFlKgI9EEHQ.png" /></figure><p>Now we create a docker-compose file so our container build and run on single click.</p><p>docker-compose.yml</p><pre>version: &#39;3&#39;<br>services:<br>  backend:<br>    build:<br>      context: .<br>    ports:<br>      - 5000:5000</pre><pre>docker-compose up -d</pre><p>now docker build and run on single click</p><p>add database</p><p>docker network — it connect the 2 or more containers among themselves so that they can communicate to each other. like here backend and database connect with the help of docker network and we write backend and database code in he service of YML file.</p><pre>version: &#39;3&#39;<br>services:<br>  backend:<br>    build:<br>      context: .<br>    ports:<br>      - 5000:5000<br>    environment:<br>      MYSQL_HOST: mysql<br>      MYSQL_USER: devops<br>      MYSQL_PASSWORD: devops<br>      MYSQL_DB: two-tier<br><br>  mysql:<br>    image: mysql:5.7<br>    environment: <br>      MYSQL_ROOT_PASSWORD: test@123<br>      MYSQL_USER: devops <br>      MYSQL_DATABASE: two-tier<br>      MYSQL_PASSWORD: devops</pre><p>Error: MySQLdb.OperationalError: (2005, “Unknown server host ‘mysql’ (-2)”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ytlxWCd4oWDXB35JQd9Pg.png" /></figure><p>here we can see that our connect is stabilest between backend and database. But it show error unknown server host so we change the user from devops user to root user.</p><pre><br>    environment:<br>      MYSQL_HOST: mysql<br>      MYSQL_USER: root<br>      MYSQL_PASSWORD: test@123<br>      MYSQL_DB: two-tier<br></pre><p>Error : MySQLdb.ProgrammingError: (1146, “Table ‘two-tier.messages’ doesn’t exist”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQKWJ0nEosWrDYDU6lVa6w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ltXOio_jqbSU9E5oU8O2Yg.png" /></figure><p>Database name can’t be<strong> two-tier</strong> as ‘-’ isn’t allowed instead use <strong>two_tier</strong>. Attaching volume to MySQL by editing docker-compose.yml</p><p>vim messages.sql: to create SQL script to create table</p><p>Also attaeatched the volume</p><pre>version: &#39;3&#39;<br>services:<br>  backend:<br>    build:<br>      context: .<br>    ports:<br>      - 5000:5000<br>    environment:<br>      MYSQL_HOST: mysql<br>      MYSQL_USER: root<br>      MYSQL_PASSWORD: test@123<br>      MYSQL_DB: two_tier   #change &quot;_&quot; instid of &quot;-&quot;<br><br>  mysql:<br>    image: mysql:5.7<br>    environment:<br>      MYSQL_ROOT_PASSWORD: test@123<br>      MYSQL_USER: devops<br>      MYSQL_DATABASE: two_tier<br>      MYSQL_PASSWORD: devops<br>    volumes:  <br>      - my-datavolume:/var/lib/mysql<br>volumes:<br>  my-datavolume:</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*dU7wA-nLgLsJSxzzRxQapA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xnMJqK_hwGfJVtiUrVD4eQ.png" /></figure><p>Here you can see the all data store in the mysql database those name is two_tier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vcujaMEBbFFvMUTql8Ozjg.png" /></figure><p>So, we have successfully make and run 2-tier application and connect backend and database.</p><p><strong>Image push to dockerHub :-</strong></p><p>You need to tag your docker image</p><pre>docker image tag &lt;image_name&gt;:&lt;tag&gt; &lt;DockerHub_username&gt;/&lt;image_name&gt;:&lt;tag&gt;</pre><p>Now Image push to dockerHub</p><pre>docker push &lt;DockerHub_username&gt;/&lt;image_name&gt;:&lt;tag&gt;</pre><p>Example:</p><pre>docker image tag two-tier-app:latest hemantjangir/two-tier-app:latest<br></pre><pre>docker push hemantjangir/two-tier-app:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/0*kQUWZBsXugLrtAYg.png" /></figure><p>Here you can see the docker image successfully push to dockerhub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/0*hevddWWA0wj_JhiI.png" /></figure><p>Thank you .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3635b0d5fa13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker volume]]></title>
            <link>https://medium.com/@h.jangir1998/docker-volume-36e3247d7b07?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/36e3247d7b07</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 07:41:16 GMT</pubDate>
            <atom:updated>2023-11-21T07:58:35.098Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is a Docker Volume?</h3><p>In simple terms, a Docker Volume is a designated directory on the host machine which bypasses the Union File System, used to store and manage data in Docker. This directory becomes a reference point for Docker to save and retrieve data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6nYTSMenvpyB_-8I" /></figure><p>Docker Volumes offer three key benefits:</p><ol><li>Data Persistence: Even if the container shuts down, the data remains.</li><li>Data Sharing: Multiple containers can share access to a single volume.</li><li>Performance: Volumes offer better I/O performance as compared to Docker containers.</li></ol><p>First make a directory outside your code, and then give a fole name like — Volume and then inside this you can make a folder name where your app all data store. for example — mkdir -p volume/django_app_volume</p><p>To show docker volume in your system</p><pre>docker volume ls</pre><p>create docker volume</p><pre>docker volume create --name &lt;volume_name&gt; --opt type=none --opt device=/home/ubuntu/project/volumes/django-todo-volume --opt o=bind</pre><p>show all detail about your docker volume</p><pre>docker volume inspect &lt;volume_name&gt;</pre><p>To mount your docker volume to your system</p><p>you need to run this cmd inside where you create a volume -</p><pre>docker run -d --mount source=&lt;volume_name&gt;,target=/data(WORKDIR) -p 8000:8000 &lt;image_name&gt;:latest(img_tag)</pre><p>Now you can see same file and folder in your new volume creare directory.</p><p>Now go inside the container shell and create a file</p><pre>docker exec -it &lt;container_id&gt; sh<br>touch &lt;file_name&gt;<br>echo &quot;test@123&quot; &gt; &lt;file_name&gt;<br>exit </pre><p>after comming outside the container shell you can see a new file created same as created in your container shell. now if you delete your container and after recreate a ner container all data store in you new container shell.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36e3247d7b07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker]]></title>
            <link>https://medium.com/@h.jangir1998/docker-8a1c4e64fe5f?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a1c4e64fe5f</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Mon, 20 Nov 2023 10:17:36 GMT</pubDate>
            <atom:updated>2023-11-21T01:28:22.687Z</atom:updated>
            <content:encoded><![CDATA[<p>docker → java-app</p><p>Hello.java</p><pre>public class Hello{ <br> public static void main(String[] args) {<br>  System.out.println(&quot;Hello,dosto&quot;);<br> }<br>}</pre><p>Dockerfile</p><pre># gatting base image from dockerHub<br>FROM openjdk:11<br># working dir. where all code will be kept<br>WORKDIR app/<br># copy system (Hello.java) --&gt; docker container app/  (corrent working dir.)<br>COPY Hello.java .<br># code compile<br>RUN javac Hello.java  # run code line by line and it run only inside the container<br># run jaca compile code<br>CMD [&quot;java&quot;,&quot;Hello&quot;]   # for externally run the code after making container<br></pre><p>run flask app-&gt; a micro frame work to run application. in python we use flask and jango , in other language like java we use spring Boot</p><p>app.py file</p><pre>from flask import Flask<br><br># Create a Flask application<br>app = Flask(__name__)<br><br># Define a route for the root URL &#39;/&#39;<br>@app.route(&#39;/&#39;)<br>def hello_world():<br>    return &#39;Hello, World!&#39;<br><br># Run the app if this file is executed<br>if __name__ == &#39;__main__&#39;:<br>    app.run(host=&#39;0.0.0.0&#39;, port=5000, debug=True)</pre><p>Dockerfile</p><pre>FROM python:3.9<br><br>WORKDIR app/<br><br>COPY app.py .<br># run like a intermediate layer<br>RUN pip install Flask   # install flask app<br><br>CMD [ &quot;python&quot;, &quot;app.py&quot; ]  #give space inside bracket </pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a1c4e64fe5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Shell script]]></title>
            <link>https://medium.com/@h.jangir1998/shell-script-3099fa6dfa5f?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3099fa6dfa5f</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Sat, 18 Nov 2023 03:33:22 GMT</pubDate>
            <atom:updated>2023-11-18T03:37:16.281Z</atom:updated>
            <content:encoded><![CDATA[<p>What is shell ?</p><p>A shell is special user program which provide an interface to user to use operating system services. Shell accept human readable commands from user and convert them into something which kernel can understand. It is a command language interpreter that execute commands read from input devices such as keyboards or from files. The shell gets started when the user logs in or start the terminal.</p><p>what is shell script?</p><p>A shell script is a computer program designed to be run by a linux shell, a command-line interpreter.</p><p>if-else</p><pre>#!/bin/bash<br>val=hemant<br>if [ $val == &quot;hemant&quot; ]<br>then<br> echo &quot;name: $val is found&quot;<br>else<br> echo &quot;name does not match&quot;<br>fi</pre><p>Example of If else in Shell Scripting by comparing 2 numbers</p><pre>#!/bin/bash<br>echo &quot;Enter a number:  &quot;<br>read num<br>if [ $num -gt 0 ]; then<br>        echo &quot;$num : is +ve number&quot;<br>elif [ $num -lt 0 ]; then<br>        echo &quot;$num : is -ve numner&quot;<br>else<br>        echo &quot;Number is Zero &quot;<br>fi</pre><p>Create and delete multiple directories (day1 .. day 20)within seconds using a simple command.</p><pre>mkdir day{1..20} # for create dir.<br>rmdir day{1..20} # for delete dir.</pre><p>login script</p><pre>#!/bin/bash  #shebang<br># bash interpreter use those are commonly use. other interpreter are like ksh,c shell, Bourn.<br># Ask the user for login details<br>read -p &#39;Username: &#39; uservar<br>read -sp &#39;Password: &#39; passvar #-s indicates secure<br>echo &quot;Thankyou $uservar, Now we have your login details&quot;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3099fa6dfa5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[send file local ←→server]]></title>
            <link>https://medium.com/@h.jangir1998/send-file-local-server-4f89cbccd18b?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f89cbccd18b</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Thu, 16 Nov 2023 17:59:52 GMT</pubDate>
            <atom:updated>2023-11-16T17:59:52.552Z</atom:updated>
            <content:encoded><![CDATA[<p>server to local</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-fxeUuBQOjESiJ0LnSgo6Q.png" /></figure><p>send history from server to local</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-mFnrpGgo8Qw9ooeLMGpA.png" /></figure><p>local to server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KpIQVetW0z-RdAngMHrcLg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f89cbccd18b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Aws IAM]]></title>
            <link>https://medium.com/@h.jangir1998/aws-iam-a8d8efa6bcfb?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8d8efa6bcfb</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Thu, 09 Nov 2023 14:26:41 GMT</pubDate>
            <atom:updated>2023-11-09T14:26:41.942Z</atom:updated>
            <content:encoded><![CDATA[<p>AWS Identity and Access Management (IAM) is a web service that helps you securely control access to AWS resources. With IAM, you can centrally manage permissions that control which AWS resources users can access. You use IAM to control who is authenticated (signed in) and authorized (has permissions) to use resources.</p><h3>IAM features</h3><p>IAM gives you the following features:</p><p><strong>Shared access to your AWS account</strong></p><p>You can grant other people permission to administer and use resources in your AWS account without having to share your password or access key.</p><p><strong>Granular permissions</strong></p><p>You can grant different permissions to different people for different resources. For example, you might allow some users complete access to Amazon Elastic Compute Cloud (Amazon EC2), Amazon Simple Storage Service (Amazon S3), Amazon DynamoDB, Amazon Redshift, and other AWS services. For other users, you can allow read-only access to just some S3 buckets, or permission to administer just some EC2 instances, or to access your billing information but nothing else.</p><p><strong>Secure access to AWS resources for applications that run on Amazon EC2</strong></p><p>You can use IAM features to securely provide credentials for applications that run on EC2 instances. These credentials provide permissions for your application to access other AWS resources. Examples include S3 buckets and DynamoDB tables.</p><p><strong>Multi-factor authentication (MFA)</strong></p><p>You can add two-factor authentication to your account and to individual users for extra security. With MFA you or your users must provide not only a password or access key to work with your account, but also a code from a specially configured device. If you already use a FIDO security key with other services, and it has an AWS supported configuration, you can use WebAuthn for MFA security.</p><p><strong>Identity federation</strong></p><p>You can allow users who already have passwords elsewhere — for example, in your corporate network or with an internet identity provider — to get temporary access to your AWS account.</p><p><strong>Identity information for assurance</strong></p><p>If you use <a href="https://aws.amazon.com/cloudtrail/">AWS CloudTrail</a>, you receive log records that include information about those who made requests for resources in your account. That information is based on IAM identities.</p><p><strong>PCI DSS Compliance</strong></p><p>IAM supports the processing, storage, and transmission of credit card data by a merchant or service provider, and has been validated as being compliant with Payment Card Industry (PCI) Data Security Standard (DSS).</p><p><strong>Integrated with many AWS services</strong></p><p>For a list of AWS services that work with IAM, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html">AWS services that work with IAM</a>.</p><p><strong>Eventually Consistent</strong></p><p>IAM, like many other AWS services, is <a href="https://wikipedia.org/wiki/Eventual_consistency">eventually consistent</a>. IAM achieves high availability by replicating data across multiple servers within Amazon’s data centers around the world. If a request to change some data is successful, the change is committed and safely stored. However, the change must be replicated across IAM, which can take some time. Such changes include creating or updating users, groups, roles, or policies. We recommend that you do not include such IAM changes in the critical, high-availability code paths of your application. Instead, make IAM changes in a separate initialization or setup routine that you run less frequently. Also, be sure to verify that the changes have been propagated before production workflows depend on them.</p><p><strong>Free to use</strong></p><p>AWS Identity and Access Management (IAM) and AWS Security Token Service (AWS STS) are features of your AWS account offered at no additional charge. You are charged only when you access other AWS services using your IAM users or AWS STS temporary security credentials.</p><h3>Accessing IAM</h3><p>You can work with AWS Identity and Access Management in any of the following ways.</p><p><strong>AWS Management Console</strong></p><p>The console is a browser-based interface to manage IAM and AWS resources.</p><p><strong>AWS Command Line Tools</strong></p><p>You can use the AWS command line tools to issue commands at your system’s command line to perform IAM and AWS tasks. Using the command line can be faster and more convenient than the console. The command line tools are also useful if you want to build scripts that perform AWS tasks.</p><p>AWS provides two sets of command line tools: the <a href="https://aws.amazon.com/cli/">AWS Command Line Interface</a> (AWS CLI) and the <a href="https://aws.amazon.com/powershell/">AWS Tools for Windows PowerShell</a>. For information about installing and using the AWS CLI, see the <a href="https://docs.aws.amazon.com/cli/latest/userguide/">AWS Command Line Interface User Guide</a>.</p><p>After signing in to the console, you can use AWS CloudShell from your browser to run CLI or SDK commands. The permissions for accessing AWS resources are based on the credentials you used to sign-in to the console. Depending on your experience, you may find the CLI to be a more efficient method of managing your AWS account.</p><p><strong>AWS SDKs</strong></p><p>AWS provides SDKs (software development kits) that consist of libraries and sample code for various programming languages and platforms (Java, Python, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient way to create programmatic access to IAM and AWS. For example, the SDKs take care of tasks such as cryptographically signing requests, managing errors, and retrying requests automatically.</p><p><strong>IAM Query API</strong></p><p>You can access IAM and AWS programmatically by using the IAM Query API, which lets you issue HTTPS requests directly to the service. When you use the Query API, you must include code to digitally sign requests using your credentials.</p><h3>Create user</h3><h3>CLI</h3><p>for installation aws CLI in linux you can follow given link -</p><p><a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8d8efa6bcfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create Template and Auto scaling]]></title>
            <link>https://medium.com/@h.jangir1998/auto-scaling-cb52f10b4b44?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb52f10b4b44</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Thu, 09 Nov 2023 11:45:38 GMT</pubDate>
            <atom:updated>2023-11-10T07:25:00.315Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>create template</li></ol><p>first of all create a ec2 instace and in this instance we take a os image of Amazon linux</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/1*yp5NyerQ_RYPr_A0owo93g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*m1TuTIFL_LQn3mionYRciQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*3wTe6gQ4b8L5dUNPUFKGZQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Eh9UJv-ZbEkw4sGPrWEQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v9FFAPGCikCtA1j3sngVXQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KaELE8jU-FZqIrLEHxrqXw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GodMEY4B5Uy326KFwbTVxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KIbzCzVRT1gDaRTJOoYFzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ej1iqvq2-eyusMdvHNFTnA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N8TJyGvkTY7-KYR4xWKc8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1cCBwLCkx1UlvhADS7Jq5Q.png" /></figure><p>Here if you want Version-2, only one instace then you and select Number of instances in 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rR1EWlEGEuQJmPM2BXfK_w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGpGb_WZoHU3OrKatPkz1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKEct2k7KpwXRmRJXuW3Bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdER28GBg4sbogGZ1wz-wg.png" /></figure><h3>2. Auto Scaling</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*6JSRsU6SjwCDQ8T46ytkMw.png" /></figure><p>Auto Scaling groups are collections of Amazon EC2 instances that enable automatic scaling and fleet management features. These features help you maintain the health and availability of your applications.</p><h3>Benefits and features</h3><h4>1. Fault tolerance</h4><p>Detect when an instance is unhealthy, terminate it, and launch an instance to replace it.</p><h4>2.Cost Management</h4><p>Save money by dynamically launching instances when they are needed and terminating them when they aren’t.</p><h4>3.Availability</h4><p>Ensure that your application always has the right amount of capacity to handle the current traffic demand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pbo3aqbw7m_5OjNujxb1yQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rjAyCpyNNLtBsL0y6xGrYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-0wddnu8saQ8eG2E89DGmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NTTz1t5ZEFUWF016o0N5lg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r99HC6Bv2Sc7-cs6zeowNA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvpv8auYQqj47gwgw_kPvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDwFfoSpdz0-Bv1BKNkjcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDwFfoSpdz0-Bv1BKNkjcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EuHem3UOOlvuDvqNH4vAkg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mx347MuKukYAMO_n2Lefqw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lFbtvicSGgJ9wMYVa1A2fw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iupLDX8Xl8hlI2bwJVzDJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*O89YS7zFiOYUnFCguoNHuQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYu4MP9gZFNN6iq3VYsiWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H1kLa5rpzUDSmB5GBBBG5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*n-wEF8JhKu6af_R0SYgphA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kZmHwMxH0zXyndEji-cQ8g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aNfRzmyrWRFX95fjVW5gZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3nrM2CY5AxW_KE2M9v5qWg.png" /></figure><p>if you want to change or reset your email -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*qc8pf0iB3zGJ4sS-P4lxZg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*enqYEzX1u8oETkdAkeHuvg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb52f10b4b44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[jenkins job,agents,nodes]]></title>
            <link>https://medium.com/@h.jangir1998/jenkins-job-agents-nodes-b19a40f216ea?source=rss-ec898468c83e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b19a40f216ea</guid>
            <dc:creator><![CDATA[hemant jangir]]></dc:creator>
            <pubDate>Mon, 30 Oct 2023 07:57:10 GMT</pubDate>
            <atom:updated>2023-10-31T07:11:48.056Z</atom:updated>
            <content:encoded><![CDATA[<p>jenkins job,agents,nodes</p><p>add nodes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X2X4xrjaxmqhG82nrQzkGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spN3yfk4_ry-FVrgLq68pg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*amVC2mJrUOBEOYeAHWT1bw.png" /></figure><p>in host, public ip of, demo-agent server</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tfki6gW2Kor7GBBuJZOWhQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRcbOC98cLtu7rDxMdTJAQ.png" /></figure><p>add credentials</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Onmx7X9asGalHCTx8IWdBw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*n5f34vtM1wRPPPWGy6FRvA.png" /></figure><p>and after fill press add button. and now your new creadential add. you can also add credential</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jXCHmP9TQKQzDRDo719aTw.png" /></figure><p>after save configure, your agent successfully connect and you see you node screen like this-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3TqD1xWeChzZ9Vh_VE7vog.png" /></figure><p>if your agent not in sync. then refresh nodes or check log. if in logs give some error then generate new key because maximum time this error fix using new key</p><p>New key generate- go to master terminal and in .ssh directory then .</p><pre>ssh-keygen -t ed25519</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*lRNuh7rXeoCoKR0XBwp23A.png" /></figure><p>after press enter 3 times your jenkins private and public key generate and now you follow previous steps for connect agent. then your agent node successfully connect and sync. this time.</p><p>pipeline for agent.</p><p>open master jenkins and create a new jobs .</p><pre>pipeline {<br>    agent {label &#39;agent-2&#39;} // any agent name <br>    stages{<br>        stage (&#39;code clone&#39;){<br>            steps {<br>                git url: &#39;https://github.com/Hemantjangir53/django-notes-app.git&#39;, branch: &#39;main&#39;<br>            }<br>        }<br>        stage (&#39;Build&#39;){<br>            steps {<br>                echo &quot;code build&quot;<br>            }<br>        }<br>        stage (&#39;push&#39;){<br>            steps {<br>                echo &quot;deploy&quot;<br>            }<br>        }<br>    }<br>}</pre><p>for push to docker Hub we need to install environment plugins</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*83Q2g5w3ssmCysrzBpDcGQ.png" /></figure><p>after install and restart jenkins, set environment variable</p><p>final groovy code</p><pre>pipeline {<br>    agent {label &#39;agent-2&#39;}<br>    stages{<br>        stage (&#39;code clone&#39;){<br>            steps {<br>                git url: &#39;https://github.com/Hemantjangir53/django-notes-app.git&#39;, branch: &#39;main&#39;<br>            }<br>        }<br>        stage (&#39;Build&#39;){<br>            steps {<br>                sh &#39;docker build . -t django-notes&#39;<br>                echo &quot;code build&quot;<br>            }<br>        }<br>        stage (&#39;push to docker HUb&#39;){<br>            steps {<br>                withCredentials([<br>                        usernamePassword(<br>                            credentialsId: &#39;dockerHub&#39;,<br>                            usernameVariable: &#39;DOCKERHUB_USERNAME&#39;,<br>                            passwordVariable: &#39;DOCKERHUB_PASSWORD&#39;)]){<br>                                sh &quot;docker tag django-notes ${env.DOCKERHUB_USERNAME}/django-notes &quot;<br>                                sh &quot;docker login -u ${env.DOCKERHUB_USERNAME} -p ${env.DOCKERHUB_PASSWORD}&quot;<br>                                sh &quot;docker push ${env.DOCKERHUB_USERNAME}/django-notes:latest&quot;<br>                    }<br>            }<br>        }<br>        stage (&#39;deploy&#39;){<br>            steps {<br>                sh &#39;docker-compose down &amp;&amp; docker-compose up -d &#39;<br>                echo &quot;deploy&quot;<br>            }<br>        }<br>        <br>    }<br>}</pre><p>Build triggers- for autorun after commit on github</p><p>GITScm(Git Source Code Management) polling</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*p0tczg_x9fI3JEbc2-21Pw.png" /></figure><p>now any commit on github code and you can see pipeline automatically run</p><p>pipeline script from SCM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*mFe70g4ROWYDqH4MlEUTfg.png" /></figure><p>create new Jenkins file on gitHub and after any changes on code and commit this, you can see stage view</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oluoQid2SUdDBYRLvR0TRQ.png" /></figure><p>here now our all code run via Declarative CI/CD(Continuous Integration/Continuous Delivery).</p><p>we can see code management work in the master server But docker images and docker container available in agent server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b19a40f216ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>