<?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 Aung Ko Htet on Medium]]></title>
        <description><![CDATA[Stories by Aung Ko Htet on Medium]]></description>
        <link>https://medium.com/@alexiscloud?source=rss-3853d59abca0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*6sG90xxCFrJNoLAicDP1gg.jpeg</url>
            <title>Stories by Aung Ko Htet on Medium</title>
            <link>https://medium.com/@alexiscloud?source=rss-3853d59abca0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 04:50:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexiscloud/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[Getting Started with Keycloak for Identity and Access Control]]></title>
            <link>https://aws.plainenglish.io/getting-started-with-keycloak-for-identity-and-access-control-933d3fe10496?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/933d3fe10496</guid>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[keycloak]]></category>
            <category><![CDATA[jwt-token]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[sso]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Mon, 07 Apr 2025 10:08:03 GMT</pubDate>
            <atom:updated>2025-04-09T09:29:04.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bj0fZ2lxHOG1ba44xyWHcQ.png" /></figure><p>Today, cloud-based applications and services need strong security, including user login and access control. Instead of building a custom login system, you can use a reliable open-source solution like Keycloak.</p><p>Keycloak, developed by Red Hat, is a free tool that was first released in 2014. It allows cloud engineers and developers to easily add authentication and user management features to their applications — without writing extra code.</p><p>Keycloak supports modern identity standards such as Single Sign-On (SSO), OAuth2, and OpenID Connect. It also integrates well with external systems like LDAP and Active Directory, making it a good choice for hybrid or enterprise environments.</p><p>In this guide, you’ll learn how to set up Keycloak, manage users, and protect your cloud-based applications — all in a simple, step-by-step way.</p><h4>Setup</h4><p>To set up Keycloak, ensure you have Docker installed. We’ll pull a Keycloak image to our local Docker Desktop application.</p><p>Keycloak offers multiple setup and installation methods. Check them out <a href="https://www.keycloak.org/getting-started/getting-started-docker">here</a></p><h4>Installing Keycloak</h4><p>Open a terminal window and enter the following command to pull and run a Keycloak image:</p><pre>docker run -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:26.1.4 start-dev </pre><ul><li>open Docker and verify that both an image and a container have been created.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mc2EzxrJ50dV9EDV.png" /></figure><ul><li>and than access Keycloak by visiting <a href="http://localhost:8080/">http://localhost:8080</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fQ1IKKSKJC58L3mt.png" /></figure><ul><li>Login with User: admin, Password: admin</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cobpxgSBDFdMzGJm.png" /></figure><h4>Setting up a Realm</h4><p>A realm in Keycloak is like a tenant. It lets admins create separate groups of applications and users. By default, Keycloak has a “master” realm, but it’s only for managing Keycloak itself, not applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x3t4qaQFMS0xKp7E.png" /></figure><ul><li>Create Realm</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_7kmHuc0Gai0Dort.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dS7i2hDoUTzrHkbn.png" /></figure><h4>Creating a User</h4><p>In the left navigation, select “Users” and click “Create New User”. Input the username and any additional details you wish to include.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k0yp-zUvFWzFzR0h.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hky0s7pn0pTI9zXi.png" /></figure><ul><li>Credential add Password</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SjgL8Sr1MOsraksz.png" /></figure><h4>Testing Login</h4><ul><li>In my case, the URL will be <a href="http://localhost:8080/realms/akhtech/account">http://localhost:8080/realms/akhtech/account</a></li></ul><h4>Create a Client</h4><p>In Keycloak, an application is a Client. To secure an application, we must add it as a client</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0ugkuTqmu_7ClTtk.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6B8I1lW_uY5HmYmf.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UKE-kKNohzoRZEI5.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*T6IgPq9z9vgIg2AV.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M4FSx05GzLtXqTsW.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UNSI6Lj6Evq1iywh.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sj0meOb4LMZDq0Ud.png" /></figure><h4>Create another Client</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gWpooJz7bNFpbELK.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DQJXIFL6KD0HjD6L.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V_HAH4HqeOJG-Aph.png" /></figure><h4>Test Token Using Podman</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BK3ldWcL5PvHSZ3O.png" /></figure><h4>Using JWT Decodded</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f9VYXjj6zxNWXPgK.png" /></figure><p>That’s it! We set up Keycloak on our machine, made a realm, added a user, and set up a client. Now it’s ready to use for login and access control.</p><blockquote>Happy Using Keycloak…!!!</blockquote><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://differ.blog/inplainenglish"><strong>Differ</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://cofeed.app/"><strong>Check out CoFeed, the smart way to stay up-to-date with the latest in tech</strong></a> <strong>🧪</strong></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=933d3fe10496" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/getting-started-with-keycloak-for-identity-and-access-control-933d3fe10496">Getting Started with Keycloak for Identity and Access Control</a> was originally published in <a href="https://aws.plainenglish.io/">AWS in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Spring Boot Banking Application with Docker]]></title>
            <link>https://medium.com/@alexiscloud/deploying-a-spring-boot-banking-application-with-docker-0b625e8726a4?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/0b625e8726a4</guid>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 06:11:15 GMT</pubDate>
            <atom:updated>2024-10-28T06:11:15.282Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FhFeu4gfL8Hocr0MmeCbsw.png" /><figcaption>bangkin app docker deployment</figcaption></figure><p>Containerizing applications is becoming increasingly important. In this guide, I’ll walk you through deploying a Spring Boot banking application using Docker, first manually and then with Docker Compose. We’ll cover everything from setting up the environment to running the application in containers.</p><h3>Prerequisites</h3><p>Before we begin, make sure you have:</p><ul><li>An AWS Account</li><li>An Ubuntu EC2 instance (t2.medium)</li><li>Docker installed</li><li>Docker Compose installed</li><li>Basic understanding of Spring Boot and MySQL</li><li><strong><em>(I already used vagrant box my local environment)</em></strong></li></ul><h3>Project Overview</h3><p>Our banking application is built with:</p><ul><li>Spring Boot (Java)</li><li>MySQL Database</li><li>Maven for build management</li><li>Docker for containerization</li></ul><h3>Setup My Local Using Vangrant</h3><ul><li>cloning the repo from github and navigating to project code using git clone command</li></ul><pre>Aungs-MacBook-Pro:cloud-native-box aungkohtet$ git clone https://github.com/aungkohtat/banking-app-project.git<br>Cloning into &#39;banking-app-project&#39;...<br>warning: You appear to have cloned an empty repository.<br>Aungs-MacBook-Pro:cloud-native-box aungkohtet$ cd banking-app-project/<br>Aungs-MacBook-Pro:banking-app-project aungkohtet$ ls -la<br>total 56<br>drwxr-xr-x  10 aungkohtet  staff    320 Oct 28 09:06 .<br>drwxr-xr-x  28 aungkohtet  staff    896 Oct 28 09:05 ..<br>drwxr-xr-x   9 aungkohtet  staff    288 Oct 28 09:04 .git<br>-rw-r--r--@  1 aungkohtet  staff    905 Oct 28 07:51 Dockerfile<br>-rw-r--r--@  1 aungkohtet  staff   2781 Oct 28 07:51 README.md<br>-rw-r--r--@  1 aungkohtet  staff   1940 Oct 28 07:51 docker-compose.yml<br>drwxr-xr-x   5 aungkohtet  staff    160 Oct 28 07:52 images<br>-rw-r--r--@  1 aungkohtet  staff  10666 Oct 28 07:51 mvnw<br>-rw-r--r--@  1 aungkohtet  staff   2503 Oct 28 07:51 pom.xml<br>drwxr-xr-x   4 aungkohtet  staff    128 Oct 28 07:52 src<br>Aungs-MacBook-Pro:banking-app-project aungkohtet$ </pre><h3>Part 1: Manual Deployment with Docker</h3><h3>Step 1: Create the Dockerfile</h3><p>First, let’s create a multi-stage Dockerfile to optimize our build:</p><pre># Stage 1: Build Environment<br>FROM maven:3.8.3-openjdk-17 AS builder<br>WORKDIR /app<br>COPY . /app<br>RUN mvn clean install -DskipTests=true<br><br># Stage 2: Production Environment<br>FROM openjdk:17-jdk-alpine<br>COPY --from=builder /app/target/*.jar /app/target/bankapp.jar<br>EXPOSE 8080<br>ENTRYPOINT [&quot;java&quot;, &quot;-jar&quot;, &quot;/app/target/bankapp.jar&quot;]</pre><h3>Step 2: Set Up Docker Infrastructure</h3><ol><li>Create a volume for MySQL data:</li></ol><pre>docker volume create mysql-bankapp</pre><p>2. Create a network for container communication:</p><pre>docker network create bankapp</pre><p>3. Run MySQL container:</p><pre>docker run -d --name mysql \<br>  -e MYSQL_ROOT_PASSWORD=Test@123 \<br>  -e MYSQL_DATABASE=BankDB \<br>  --network=bankapp \<br>  mysql:latest</pre><h3>Step 3: Build and Run the Application</h3><ol><li>Build the application image:</li></ol><pre>docker build -t bankapp-mini .</pre><p>2. Run the application container:</p><pre>docker run -d --name bankapp-mini \<br>  -e SPRING_DATASOURCE_USERNAME=&quot;root&quot; \<br>  -e SPRING_DATASOURCE_URL=&quot;jdbc:mysql://mysql:3306/BankDB?useSSL=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=UTC&quot; \<br>  -e SPRING_DATASOURCE_PASSWORD=&quot;Test@123&quot; \<br>  --network=bankapp \<br>  -p 8080:8080 \<br>  bankapp-mini:latest</pre><ol><li>Now we are ready to see our banking application</li><li>Which works properly, all functions works properly which you can see in images</li><li>take a look of images to see output :</li></ol><ul><li>Login</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DM3TwKq9y_OXeIpZO95zGw.png" /></figure><ul><li>Register Account</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sjsX7NsHbKOJT9D6MjDNTA.png" /></figure><ul><li>My Dashboard</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a5ljDavPH_Po20xQJJhAvw.png" /></figure><ul><li>Deposit</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sCWd6O791kjSpyOa8W0eEQ.png" /></figure><ul><li>withdraw</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ePS31EBe9WKXyy8mnAOVA.png" /></figure><ul><li>transfer money</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2leaEy6GqUmaAjBScMunBQ.png" /></figure><ul><li>Transaction History</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*av8JE-sfdnNFFmGLo5jqMg.png" /></figure><ul><li>Now stoping and deleting the exisiting container of bankapp-mini using command</li></ul><pre>docker stop 4f35135bde6c &amp;&amp; docker rm 4f35135bde6c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nKg33umxvCzk06Npza1rWA.png" /></figure><h3>Part 2: Deployment with Docker Compose</h3><blockquote><em>Now building same application by creating docker-compose.yml</em></blockquote><p>Step 1: Create docker-compose.yml</p><p>Create a docker-compose.yml file to simplify deployment:</p><pre>version: &quot;3.8&quot;<br><br>services:<br>  mysql:<br>    image: mysql:latest<br>    container_name: mysql<br>    environment:<br>      MYSQL_ROOT_PASSWORD: Test@123<br>      MYSQL_DATABASE: BankDB<br>    volumes:<br>      - mysql-bankapp:/var/lib/mysql<br>    networks:<br>      - bankapp<br>    restart: always<br>    healthcheck:<br>      test: [&quot;CMD&quot;, &quot;mysqladmin&quot;, &quot;ping&quot;, &quot;-h&quot;, &quot;localhost&quot;, &quot;-uroot&quot;, &quot;-pTest@123&quot;]<br>      interval: 10s<br>      timeout: 5s<br>      retries: 3<br>      start_period: 30s<br><br>  bankapp:<br>    image: bankapp-mini<br>    container_name: bankapp-mini<br>    environment:<br>      SPRING_DATASOURCE_USERNAME: root<br>      SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/BankDB?useSSL=false&amp;allowPublicKeyRetrieval=true&amp;serverTimezone=UTC<br>      SPRING_DATASOURCE_PASSWORD: Test@123<br>    ports:<br>      - &quot;8080:8080&quot;<br>    depends_on:<br>      - mysql<br>    networks:<br>      - bankapp<br>    restart: always<br><br>volumes:<br>  mysql-bankapp:<br><br>networks:<br>  bankapp:</pre><p>Step 2: Deploy with Docker Compose</p><pre>docker compose up</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YPJ7kaCs3E9iVzEMBU0dJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LRzrrAX1da-QM2Z85hT0Bw.png" /></figure><ul><li>Dashboard</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ugkgL3sCPwJrg6WCTdUpCw.png" /></figure><h3>Key Features of Our Docker Setup</h3><ol><li><strong>Multi-Stage Builds</strong>: We use multi-stage builds to keep our final image size small by separating the build environment from the runtime environment.</li><li><strong>Volume Management</strong>: Persistent storage for MySQL data ensures we don’t lose data when containers restart.</li><li><strong>Network Isolation</strong>: Custom network ensures secure communication between containers.</li><li><strong>Health Checks</strong>: MySQL container includes health checks to ensure the database is ready before the application starts.</li><li><strong>Environment Variables</strong>: Configuration is handled through environment variables, making the setup flexible and secure.</li></ol><h3>Security Considerations</h3><ol><li>Configure AWS security groups to only allow necessary ports (8080 for the application).</li><li>Use environment variables for sensitive data instead of hardcoding values.</li><li>Implement proper database credentials and access controls.</li></ol><h3>Common Issues and Solutions</h3><ol><li><strong>Connection Issues</strong>: If the application can’t connect to MySQL, ensure both containers are on the same network and the MySQL container is healthy.</li><li><strong>Port Conflicts</strong>: If port 8080 is already in use, map to a different port in your docker-compose.yml.</li><li><strong>Volume Permissions</strong>: If MySQL can’t write to the volume, check volume permissions and ownership.</li></ol><h3>Conclusion</h3><p>Docker and Docker Compose significantly simplify the deployment of Spring Boot applications. While manual deployment gives you more control, Docker Compose offers a more maintainable and reproducible solution. Choose the approach that best fits your needs, considering factors like environment complexity and team expertise.</p><p>Remember to always follow security best practices and properly manage your AWS resources to avoid unnecessary costs.</p><h3>Additional Resources</h3><ul><li><a href="https://docs.docker.com/">Docker Documentation</a></li><li><a href="https://spring.io/guides/gs/spring-boot-docker/">Spring Boot with Docker</a></li><li><a href="https://docs.docker.com/compose/">Docker Compose Documentation</a></li></ul><p>The complete source code for this project is available on <a href="https://github.com/aungkohtat/banking-app-project/blob/main/README.md">GitHub</a> at: <a href="https://github.com/aungkohtat/banking-app-project/blob/main/README.md"><strong>my github repo</strong></a></p><p><em>Happy Learning …!!!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0b625e8726a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building and Deploying a Dockerized Web Application]]></title>
            <link>https://medium.com/@alexiscloud/building-and-deploying-a-dockerized-web-application-d8e251ef8d62?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8e251ef8d62</guid>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[web-app-development]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Sat, 12 Oct 2024 09:11:27 GMT</pubDate>
            <atom:updated>2024-10-12T09:35:37.266Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*xVx27aBxFNdnVBqFgQwriw.jpeg" /></figure><p>In today’s fast-paced development world, containerization has become a crucial skill for developers and DevOps professionals alike. In this tutorial, we’ll walk through the process of creating a simple web application, containerizing it with Docker, and preparing it for deployment on a cloud platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*LoPBskXnSOWkE9UY.png" /></figure><h3>Project Overview</h3><p>Our project will consist of four main steps:</p><ol><li>Creating a simple web application</li><li>Writing a Dockerfile</li><li>Building and running the Docker container</li><li>Preparing for deployment on a cloud platform</li></ol><p>Let’s dive in!</p><h3>Step 1: Create a Simple Web App</h3><p>For this tutorial, we’ll use Node.js and Express to create a basic web application. If you don’t have Node.js installed, you can download it from the official website.</p><p>First, initialize a new Node.js project:</p><pre>mkdir dockerized-web-app<br>cd dockerized-web-app<br>sudo apt update<br>sudo apt install nodejs npm<br>npm init -y<br>npm install express</pre><p>Now, create a file named app.js with the following content:</p><pre>const express = require(&#39;express&#39;);<br>const app = express();<br>const port = 3000;<br><br>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  res.send(&#39;Hello, Docker!&#39;);<br>});<br><br>app.listen(port, () =&gt; {<br>  console.log(`App listening at http://localhost:${port}`);<br>});</pre><p>This creates a simple Express server that responds with “Hello, Docker!” when you visit the root URL.</p><h3>Step 2: Write a Dockerfile</h3><p>Next, we’ll create a Dockerfile to containerize our application. Create a file named Dockerfile in your project directory with the following content</p><pre># Base image<br>FROM node:14<br><br># Set working directory<br>WORKDIR /app<br><br># Copy app files<br>COPY . .<br><br># Install dependencies<br>RUN npm install<br><br># Expose port<br>EXPOSE 3000<br><br># Start the app<br>CMD [&quot;node&quot;, &quot;app.js&quot;]</pre><p>This Dockerfile does the following:</p><ul><li>Uses Node.js 14 as the base image</li><li>Sets the working directory to /app</li><li>Copies our application files into the container</li><li>Installs dependencies</li><li>Exposes port 3000</li><li>Specifies the command to start our application</li></ul><h3>Step 3: Build and Run the Container</h3><p>Now that we have our Dockerfile, let’s build and run our container:</p><pre># Build the Docker image<br>docker build -t my-web-app .<br># Run the container<br>docker run -p 3000:3000 my-web-app</pre><p>If everything went well, you should be able to visit http://localhost:3000 your browser and see &quot;Hello, Docker!&quot;.</p><h3>Step 4: Prepare for Cloud Deployment</h3><p>The final step is to prepare our application for deployment on a cloud platform. For this example, we’ll use AWS Elastic Container Service (ECS), but the process is similar for other cloud providers.</p><ol><li>Push your image to Docker Hub:</li></ol><pre>docker tag my-web-app:latest akhlab/my-web-app:latest <br>docker push akhlab/my-web-app:latest</pre><p>2. Create an ECS cluster in the AWS Console.</p><p>3. Create a task definition using your Docker Hub image.</p><p>4. Create a service in your ECS cluster using the task definition.</p><p>The exact steps for cloud deployment can vary based on your specific requirements and the cloud provider you’re using. Be sure to consult your cloud provider’s documentation for detailed instructions.</p><h3>Conclusion</h3><p>In this tutorial, we’ve walked through the process of creating a simple web application, containerizing it with Docker, and preparing it for cloud deployment. This is just the beginning of what you can do with Docker and containerization.</p><p>Some next steps you might consider:</p><ul><li>Add more complex functionality to your web application</li><li>Implement a CI/CD pipeline for automated testing and deployment</li><li>Explore Docker Compose for multi-container applications</li></ul><h4>Reference</h4><p><a href="https://github.com/aungkohtat/DevOps_Projects/blob/main/dockerized-web-app/project-01.md">https://github.com/aungkohtat/DevOps_Projects/blob/main/dockerized-web-app/project-01.md</a></p><p>Happy learning, and may your containers always be light and your deployments smooth!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8e251ef8d62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Beginner’s Guide to HashiCorp Vault for Secrets Management]]></title>
            <link>https://medium.com/@alexiscloud/a-beginners-guide-to-hashicorp-vault-for-secrets-management-ff7add5c2c82?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/ff7add5c2c82</guid>
            <category><![CDATA[vault-setup]]></category>
            <category><![CDATA[management-secrets]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <category><![CDATA[security-vault]]></category>
            <category><![CDATA[dynamic-secrets]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Wed, 28 Aug 2024 17:14:08 GMT</pubDate>
            <atom:updated>2024-08-28T17:14:08.304Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aKgObCUOHAAReyI9" /></figure><h4>Introduction Vault</h4><p>HashiCorp Vault is a powerful and flexible tool for securely managing sensitive data, known as secrets, across multiple platforms and environments. As a beginner, it’s important to understand the core concepts and features of Vault to effectively utilize it for your secrets management needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/0*Y1a5YThkXbgtFijE.png" /></figure><h4>What is HashiCorp Vault?</h4><p>HashiCorp Vault is an open-source tool for securely managing sensitive data, such as passwords, API keys, certificates, and other secrets. It provides a unified interface to any secret, while providing tight access control and recording a detailed audit log.</p><h4>Key Features of HashiCorp Vault</h4><ol><li>Secure Storage: Vault encrypts all data before it is stored, so even privileged users of the underlying storage system cannot access sensitive data.</li><li>Dynamic Secrets: Vault can generate secrets on-the-fly for some supported systems, such as AWS, Azure, GCP, etc., without needing to persist them to disk.</li><li>Leasing and Renewal: All secrets in Vault have a lease associated with them. At the end of the lease, Vault will automatically revoke that secret.</li><li>Revocation: Vault has built-in support for secret revocation, either by lease or by path. This allows revoking secrets for specific clients or all secrets under a path.</li><li>Multiple Authentication Methods: Vault supports multiple authentication methods, such as GitHub, AWS, Azure, etc., allowing you to authenticate based on your environment.</li></ol><h4>Getting Started with HashiCorp Vault</h4><ol><li>Install and configure Vault: Download and install Vault on your system, then configure it with a storage backend and unseal it.</li><li>Enable secrets engines: Enable the desired secrets engines, such as the key-value engine, to store your secrets.</li><li>Configure authentication methods: Set up authentication methods to allow users and applications to authenticate with Vault.</li><li>Write and read secrets: Use the Vault CLI or API to write secrets to the enabled secrets engines and read them when needed.</li><li>Manage policies: Create policies to define which operations are allowed on which paths within Vault.</li></ol><h4>Types of Vault Runs</h4><ol><li>Dev Mode: 🛠️<br>For testing, run Vault in dev mode using the binary file.</li><li>VM Mode: 🖥️<br>Run Vault as a VM, ideal for a 3-node or 5-node cluster with one leader and two followers.</li><li>Kubernetes Pod: 🚀<br>Deploy Vault as a Kubernetes pod. Since Kubernetes secrets are only base64 encoded, Vault ensures secure secret management.</li></ol><h4>Use Cases</h4><p>Vault is versatile 🔒, used for secure storage like bank credit storage, reward points, and encryption of sensitive data.</p><h4>Enterprise Deployment</h4><ul><li>In enterprises 🌐, Vault is deployed for disaster recovery and performance across regions and clouds.</li><li>From a Kubernetes perspective, Vault is seen as an application and requires server mesh support, running on every node.</li></ul><h4>Secret Engines</h4><p>Vault has various secret engines ⚙️ for tasks like storing, generating, and encrypting data.</p><p>Common engines include kv, PKI Certificate, SSH, Transit, TOTP, LDAP, and Kubernetes.</p><p>These engines are categorized under Cloud ☁️ (e.g., AWS, Azure, Google Cloud) and Infrastructure 🏗️ (e.g., Consul, Database, RabbitMQ).</p><h4>Installing Vault</h4><ul><li><a href="https://developer.hashicorp.com/vault/install">https://developer.hashicorp.com/vault/install</a></li><li>For Ubuntu</li></ul><pre>wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg<br><br>echo &quot;deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot; | sudo tee /etc/apt/sources.list.d/hashicorp.list<br><br>sudo apt update &amp;&amp; sudo apt install vault</pre><h4>Starting the Vault Dev Server</h4><pre>vault server -dev</pre><p>output</p><pre>vagrant@cloud-native-box:~/hand-on-vault/vault-secret-management$ vault server -dev<br>==&gt; Vault server configuration:<br><br>Administrative Namespace: <br>             Api Address: http://127.0.0.1:8200<br>                     Cgo: disabled<br>         Cluster Address: https://127.0.0.1:8201<br>   Environment Variables: DBUS_SESSION_BUS_ADDRESS, GOTRACEBACK, HOME, LANG, LC_CTYPE, LOGNAME, MOTD_SHOWN, OLDPWD, PATH, PWD, SHELL, SHLVL, SSH_AUTH_SOCK, SSH_CLIENT, SSH_CONNECTION, SSH_TTY, TERM, USER, XDG_DATA_DIRS, XDG_RUNTIME_DIR, XDG_SESSION_CLASS, XDG_SESSION_ID, XDG_SESSION_TYPE, _<br>              Go Version: go1.22.5<br>              Listener 1: tcp (addr: &quot;127.0.0.1:8200&quot;, cluster address: &quot;127.0.0.1:8201&quot;, disable_request_limiter: &quot;false&quot;, max_request_duration: &quot;1m30s&quot;, max_request_size: &quot;33554432&quot;, tls: &quot;disabled&quot;)<br>               Log Level: <br>                   Mlock: supported: true, enabled: false<br>           Recovery Mode: false<br>                 Storage: inmem<br>                 Version: Vault v1.17.3, built 2024-08-06T14:28:45Z<br>             Version Sha: c91c85442144e1228c02123fc4b19337f7d52700<br><br>==&gt; Vault server started! Log data will stream in below:<br><br>2024-08-22T19:22:54.712Z [INFO]  proxy environment: http_proxy=&quot;&quot; https_proxy=&quot;&quot; no_proxy=&quot;&quot;<br>2024-08-22T19:22:54.712Z [INFO]  incrementing seal generation: generation=1<br>2024-08-22T19:22:54.712Z [WARN]  no `api_addr` value specified in config or in VAULT_API_ADDR; falling back to detection if possible, but this value should be manually set<br>2024-08-22T19:22:54.712Z [INFO]  core: Initializing version history cache for core<br>2024-08-22T19:22:54.712Z [INFO]  events: Starting event system<br>2024-08-22T19:22:54.714Z [INFO]  core: security barrier not initialized<br>2024-08-22T19:22:54.714Z [INFO]  core: security barrier initialized: stored=1 shares=1 threshold=1<br>2024-08-22T19:22:54.714Z [INFO]  core: post-unseal setup starting<br>2024-08-22T19:22:54.721Z [INFO]  core: loaded wrapping token key<br>2024-08-22T19:22:54.721Z [INFO]  core: successfully setup plugin runtime catalog<br>2024-08-22T19:22:54.721Z [INFO]  core: successfully setup plugin catalog: plugin-directory=&quot;&quot;<br>2024-08-22T19:22:54.722Z [INFO]  core: no mounts; adding default mount table<br>2024-08-22T19:22:54.723Z [INFO]  core: successfully mounted: type=cubbyhole version=&quot;v1.17.3+builtin.vault&quot; path=cubbyhole/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.724Z [INFO]  core: successfully mounted: type=system version=&quot;v1.17.3+builtin.vault&quot; path=sys/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.724Z [INFO]  core: successfully mounted: type=identity version=&quot;v1.17.3+builtin.vault&quot; path=identity/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.725Z [INFO]  core: successfully mounted: type=token version=&quot;v1.17.3+builtin.vault&quot; path=token/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.725Z [INFO]  rollback: Starting the rollback manager with 256 workers<br>2024-08-22T19:22:54.726Z [INFO]  core: restoring leases<br>2024-08-22T19:22:54.726Z [INFO]  rollback: starting rollback manager<br>2024-08-22T19:22:54.727Z [INFO]  expiration: lease restore complete<br>2024-08-22T19:22:54.727Z [INFO]  identity: entities restored<br>2024-08-22T19:22:54.727Z [INFO]  identity: groups restored<br>2024-08-22T19:22:54.728Z [INFO]  core: Recorded vault version: vault version=1.17.3 upgrade time=&quot;2024-08-22 19:22:54.72790631 +0000 UTC&quot; build date=2024-08-06T14:28:45Z<br>2024-08-22T19:22:54.728Z [INFO]  core: post-unseal setup complete<br>2024-08-22T19:22:54.729Z [INFO]  core: root token generated<br>2024-08-22T19:22:54.729Z [INFO]  core: pre-seal teardown starting<br>2024-08-22T19:22:54.729Z [INFO]  rollback: stopping rollback manager<br>2024-08-22T19:22:54.729Z [INFO]  core: pre-seal teardown complete<br>2024-08-22T19:22:54.729Z [INFO]  core.cluster-listener.tcp: starting listener: listener_address=127.0.0.1:8201<br>2024-08-22T19:22:54.729Z [INFO]  core.cluster-listener: serving cluster requests: cluster_listen_address=127.0.0.1:8201<br>2024-08-22T19:22:54.729Z [INFO]  core: post-unseal setup starting<br>2024-08-22T19:22:54.729Z [INFO]  core: loaded wrapping token key<br>2024-08-22T19:22:54.729Z [INFO]  core: successfully setup plugin runtime catalog<br>2024-08-22T19:22:54.729Z [INFO]  core: successfully setup plugin catalog: plugin-directory=&quot;&quot;<br>2024-08-22T19:22:54.730Z [INFO]  core: successfully mounted: type=system version=&quot;v1.17.3+builtin.vault&quot; path=sys/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.730Z [INFO]  core: successfully mounted: type=identity version=&quot;v1.17.3+builtin.vault&quot; path=identity/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.730Z [INFO]  core: successfully mounted: type=cubbyhole version=&quot;v1.17.3+builtin.vault&quot; path=cubbyhole/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.731Z [INFO]  core: successfully mounted: type=token version=&quot;v1.17.3+builtin.vault&quot; path=token/ namespace=&quot;ID: root. Path: &quot;<br>2024-08-22T19:22:54.731Z [INFO]  rollback: Starting the rollback manager with 256 workers<br>2024-08-22T19:22:54.731Z [INFO]  core: restoring leases<br>2024-08-22T19:22:54.731Z [INFO]  expiration: lease restore complete<br>2024-08-22T19:22:54.731Z [INFO]  rollback: starting rollback manager<br>2024-08-22T19:22:54.731Z [INFO]  identity: entities restored<br>2024-08-22T19:22:54.731Z [INFO]  identity: groups restored<br>2024-08-22T19:22:54.731Z [INFO]  core: post-unseal setup complete<br>2024-08-22T19:22:54.731Z [INFO]  core: vault is unsealed<br>2024-08-22T19:22:54.737Z [INFO]  core: successful mount: namespace=&quot;&quot; path=secret/ type=kv version=&quot;v0.19.0+builtin&quot;<br>WARNING! dev mode is enabled! In this mode, Vault runs entirely in-memory<br>and starts unsealed with a single unseal key. The root token is already<br>authenticated to the CLI, so you can immediately begin using Vault.<br><br>You may need to set the following environment variables:<br><br>    $ export VAULT_ADDR=&#39;http://127.0.0.1:8200&#39;<br><br>The unseal key and root token are displayed below in case you want to<br>seal/unseal the Vault or re-authenticate.<br><br>Unseal Key: wxxxxxxxxxxxxxxxzxxxx<br>Root Token: hvs.xxxxxxxxxx<br><br>Development mode should NOT be used in production installations!</pre><h4>If your vault is running on vagrant</h4><pre>vault server -dev -dev-listen-address=&quot;0.0.0.0:8200&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v8hIZpIawc50PXOQ.png" /></figure><h4>Set environment variable</h4><pre>export VAULT_ADDR=&#39;http://127.0.0.1:8200&#39;</pre><h4>vault status</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZRDw7UjJUTQxX1bF.png" /></figure><blockquote>Verify via Vault HTTP API /sys/seal-status endpoint</blockquote><pre>curl http://127.0.0.1:8200/v1/sys/seal-status | jq</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0uFCPNxHKkWenQO9.png" /></figure><p><em>Verify vault auth list</em></p><pre>vagrant@cloud-native-box:~$ vault auth list<br>Path      Type     Accessor               Description                Version<br>----      ----     --------               -----------                -------<br>token/    token    auth_token_fff07cc9    token based credentials    n/a<br>vagrant@cloud-native-box:~$</pre><pre>curl --header &quot;X-Vault-Token:  hvs.xxxxxxxxxxxxxxxxxxxx&quot; http://127.0.0.1:8200/v1/sys/auth | jq</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hjkksCIMIGHH8RTy.png" /></figure><ul><li><strong>Enable kv v1 Secrets Engine</strong></li><li><strong>Enable </strong><strong>kv secrets engine. If we don’t define path, it will set </strong><strong>kv itself.</strong></li></ul><pre>vagrant@cloud-native-box:~$ vault secrets enable kv<br>Success! Enabled the kv secrets engine at: kv/</pre><h4>Check Vault UI</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*noTLvoRpp0_MP6Ir.png" /></figure><p>vault secrets enable kv is equivalent to vault secrets -version=1 -path=kv kv</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6DS8sTqz0MLsQ5s7.png" /></figure><p>enable kv secrets engine and define — path=payment-team, — path=reward-points-team , — path=database-team</p><pre>vagrant@cloud-native-box:~$ vault secrets enable --path=payment-team kv<br>Success! Enabled the kv secrets engine at: payment-team/<br>vagrant@cloud-native-box:~$ vault secrets enable --path=rewardpoints-team kv<br>Success! Enabled the kv secrets engine at: rewardpoints-team/<br>vagrant@cloud-native-box:~$ vault secrets enable --path=database-team kv<br>Success! Enabled the kv secrets engine at: database-team/<br>vagrant@cloud-native-box:~$</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s7NCx7grkL0jpb9p.png" /></figure><pre>vagrant@cloud-native-box:~$ vault secrets list<br>Path                  Type         Accessor              Description<br>----                  ----         --------              -----------<br>cubbyhole/            cubbyhole    cubbyhole_929c7693    per-token private secret storage<br>database-team/        kv           kv_8965d9d0           n/a<br>identity/             identity     identity_a910bf17     identity store<br>kv/                   kv           kv_4bd556c6           n/a<br>payment-team/         kv           kv_ef1de43f           n/a<br>rewardpoints-team/    kv           kv_bec6d677           n/a<br>secret/               kv           kv_563aeb0e           key/value secret storage<br>sys/                  system       system_aa247248       system endpoints used for control, policy and debugging<br>vagrant@cloud-native-box:~$</pre><p>Happy Learning Vault …!!!</p><p>Let’s connect on LinkedIn! 👉 <a href="http://www.linkedin.com/in/aungkohtat">www.linkedin.com/in/aungkohtat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ff7add5c2c82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up Ansible Home Environment]]></title>
            <link>https://medium.com/@alexiscloud/how-to-set-up-ansible-home-environment-4ab0c3bc046d?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ab0c3bc046d</guid>
            <category><![CDATA[ansible]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[ansible-playbook]]></category>
            <category><![CDATA[vagrant]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Fri, 07 Jun 2024 19:40:59 GMT</pubDate>
            <atom:updated>2024-06-07T19:40:59.626Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbC3Nqpxx-UBH1MYkrMpgw.png" /><figcaption>AKH Ansible home lab</figcaption></figure><p>Setting up an Ansible home lab can be a great way to learn and experiment with automation. This guide will walk you through the process of setting up a simple home lab using Ansible, Vagrant, and VirtualBox. Let’s dive in!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KO2gjsCBeeF5AlmWzbUcLQ.png" /><figcaption>Ansible Architecture for home lab</figcaption></figure><blockquote><strong>my github repo</strong></blockquote><p><a href="https://github.com/aungkohtat/akh-ansible-home-lab">https://github.com/aungkohtat/akh-ansible-home-lab</a></p><h3>Prerequisites</h3><p>Before we start, make sure you have the following tools installed on your machine:</p><ul><li>Windows or Mac</li><li>VirtualBox</li><li>Vagrant</li><li>Code Editor</li></ul><h3>Lab Set Up</h3><p>I’ve created the necessary Vagrant files and scripts to spin up this lab. You can clone them from my GitHub repository using the following command:</p><pre>git clone https://github.com/aungkohtat/akh-ansible-home-lab.git</pre><h4>Vagrantfile Overview</h4><p>The repository contains a Vagrantfile, which sets up a lab environment with four virtual machines (VMs):</p><pre># -*- mode: ruby -*-<br># vi: set ft=ruby :<br><br>Vagrant.configure(&quot;2&quot;) do |config|<br><br>  #config.ssh.insert_key = false<br><br>  config.vm.synced_folder &quot;.&quot;, &quot;/vagrant&quot;, disabled: true<br>  config.vm.boot_timeout = 900<br><br>  # master server.<br>  config.vm.define &quot;master-server&quot; do |master|<br>    master.vm.box = &quot;geerlingguy/rockylinux8&quot;<br>    master.vm.hostname = &quot;master-server&quot;<br>    master.vm.network :private_network, ip: &quot;192.168.56.4&quot;<br>    master.vm.provider &quot;virtualbox&quot; do |v|<br>      v.memory = 2048 # 2GB RAM<br>    end<br>  end<br><br>  # Application server 1.<br>  config.vm.define &quot;app01&quot; do |app|<br>    app.vm.box = &quot;ubuntu/jammy64&quot;<br>    app.vm.hostname = &quot;app-server-01&quot;<br>    app.vm.network :private_network, ip: &quot;192.168.56.5&quot;<br>    app.vm.provider &quot;virtualbox&quot; do |v|<br>      v.memory = 512 # 1GB RAM<br>    end<br>    app.vm.provision &quot;shell&quot;, path: &quot;enable_ssh_password_auth.sh&quot;<br>  end<br><br>  # Application server 2.<br>  config.vm.define &quot;app02&quot; do |app|<br>    app.vm.box = &quot;ubuntu/jammy64&quot;<br>    app.vm.hostname = &quot;app-server-02&quot;<br>    app.vm.network :private_network, ip: &quot;192.168.56.6&quot;<br>    app.vm.provider &quot;virtualbox&quot; do |v|<br>      v.memory = 512 # 1GB RAM<br>    end<br>    app.vm.provision &quot;shell&quot;, path: &quot;enable_ssh_password_auth.sh&quot;<br>  end<br><br>  # Database server 1.<br>  config.vm.define &quot;db&quot; do |db|<br>    db.vm.box = &quot;geerlingguy/rockylinux8&quot;<br>    db.vm.hostname = &quot;db-server-01&quot;<br>    db.vm.network :private_network, ip: &quot;192.168.56.7&quot;<br>    db.vm.provider &quot;virtualbox&quot; do |v|<br>      v.memory = 512 # 1GB RAM<br>    end<br>  end<br><br>end</pre><p><strong>Key Points:</strong></p><ul><li><strong>Base Images:</strong></li><li>Master/Database: “geerlingguy/rockylinux8”</li><li>Application: “ubuntu/jammy64”</li><li><strong>Synced Folder:</strong> Disabled</li><li><strong>Node Configuration:</strong></li><li>Each node has a hostname and private IP.</li><li>Master: 2GB RAM; others: 512MB.</li><li>App nodes run “enable_ssh_password_auth.sh” for SSH password authentication.</li><li><strong>Node Roles:</strong></li><li>Master: Ansible control.</li><li>App nodes: Web server simulation.</li><li>Database node: Data storage.</li></ul><h3>Installing Ansible on the Master Node</h3><p>Start by bringing up the VMs:</p><pre>vagrant up</pre><p>If you encounter any SSH issues, use the following script to fix it:</p><pre>#!/bin/bash<br><br># Enable password auth in sshd so we can use ssh-copy-id<br>sed -i --regexp-extended &#39;s/#?PasswordAuthentication (yes|no)/PasswordAuthentication yes/&#39; /etc/ssh/sshd_config<br>sed -i --regexp-extended &#39;s/#?Include \/etc\/ssh\/sshd_config.d\/\*.conf/#Include \/etc\/ssh\/sshd_config.d\/\*.conf/&#39; /etc/ssh/sshd_config<br>sed -i &#39;s/KbdInteractiveAuthentication no/KbdInteractiveAuthentication yes/&#39; /etc/ssh/sshd_config<br>systemctl restart sshd<br><br>if [ ! -d /home/vagrant/.ssh ]; then<br>    mkdir /home/vagrant/.ssh<br>    chmod 700 /home/vagrant/.ssh<br>    chown vagrant:vagrant /home/vagrant/.ssh<br>fi</pre><h3>Log into the Master Node</h3><pre>vagrant ssh master-server</pre><p>Install EPEL Repository</p><pre>sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y</pre><p>Update Packages</p><pre>sudo dnf update</pre><p>Install Ansible</p><pre>sudo dnf install ansible -y</pre><p>Verify the installation by checking the Ansible version:</p><pre>ansible --version</pre><p>Alternatively, you can install Ansible via PIP:</p><pre>sudo dnf update<br>sudo dnf install python3-pip -y<br>pip3 install ansible</pre><h3>Set Up SSH Key-Based Authentication for Ansible</h3><p>Generate an SSH key pair on the master node:</p><pre>ssh-keygen</pre><p>Copy the SSH key to the other nodes:</p><pre>ssh-copy-id vagrant@192.168.56.5<br>ssh-copy-id vagrant@192.168.56.6<br>ssh-copy-id vagrant@192.168.56.7</pre><h3>Create Ansible Configuration File</h3><p>On the master node, create a directory for Ansible files:</p><pre>mkdir ~/ansible-lab</pre><p>Create and edit the ansible.cfg file:</p><pre>vim ansible.cfg</pre><p>Add the following lines:</p><pre>[defaults]<br>host_key_checking = False<br>private_key_file = ~/.ssh/id_rsa<br><br>[privilege_escalation]<br>become=True</pre><h3>Test SSH Key-Based Authentication</h3><p>Log in to each managed node from the master node to verify:</p><pre>ssh vagrant@192.168.56.5<br>ssh vagrant@192.168.56.6<br>ssh vagrant@192.168.56.7</pre><p>Create an Ansible Inventory File</p><pre>sudo vim /etc/ansible/hosts</pre><p>Add the following lines:</p><pre>192.168.56.5<br>192.168.56.6<br>192.168.56.7</pre><p>Test the connection to the nodes:</p><pre>ansible all -i hosts -m ping</pre><p>Expected Output:</p><pre>192.168.56.5 | SUCCESS =&gt; {<br>    &quot;ansible_facts&quot;: {<br>        &quot;discovered_interpreter_python&quot;: &quot;/usr/bin/python3&quot;<br>    },<br>    &quot;changed&quot;: false,<br>    &quot;ping&quot;: &quot;pong&quot;<br>}<br>192.168.56.6 | SUCCESS =&gt; {<br>    &quot;ansible_facts&quot;: {<br>        &quot;discovered_interpreter_python&quot;: &quot;/usr/bin/python3&quot;<br>    },<br>    &quot;changed&quot;: false,<br>    &quot;ping&quot;: &quot;pong&quot;<br>}</pre><p>Modify ansible.cfg</p><p>You can modify ansible.cfg to specify the inventory file:</p><pre>[defaults]<br>inventory = hosts<br>host_key_checking = False<br>private_key_file = ~/.ssh/id_rsa<br><br>[privilege_escalation]<br>become=True</pre><p>And that’s it! You’ve successfully set up your Ansible home lab. Happy automating!</p><p><strong><em>Work Done…!!!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ab0c3bc046d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Docker NGINX Image and Pushing to AWS ECR and Docker Hub]]></title>
            <link>https://medium.com/@alexiscloud/building-a-docker-nginx-image-and-pushing-to-aws-ecr-and-docker-hub-9ec42191c048?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ec42191c048</guid>
            <category><![CDATA[ecr]]></category>
            <category><![CDATA[cloud9]]></category>
            <category><![CDATA[dockerhub]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Tue, 26 Mar 2024 07:01:40 GMT</pubDate>
            <atom:updated>2024-03-26T07:01:40.008Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*ZprZYk_q2LxG5ugNJiv2YQ.png" /></figure><ol><li>Docker Installed Environment. Utilizing AWS Cloud9 with Docker and AWS CLI Preinstalled.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvY25H4O9nttlrImuPPoxA.png" /></figure><p>2. Create Project Directory</p><pre>mkdir docker_project<br>cd docker_project</pre><p>3. Next we will pull the image from registry</p><pre>docker pull nginx:latest</pre><p>Output</p><pre>ec2-user:~/environment $ docker --version<br>Docker version 25.0.3, build 4debf41<br>ec2-user:~/environment $ ls <br>README.md<br>ec2-user:~/environment $ cat README.md <br>         ___        ______     ____ _                 _  ___  <br><br><br>Hi there! Welcome to AWS Cloud9!<br><br>To get started, create some files, play with the terminal,<br>or visit https://docs.aws.amazon.com/console/cloud9/ for our documentation.<br><br>Happy coding!<br>ec2-user:~/environment $ clear<br>ec2-user:~/environment $ clear<br>ec2-user:~/environment $ docker --version<br>Docker version 25.0.3, build 4debf41<br>ec2-user:~/environment $ ls -la<br>total 20<br>drwxr-xr-x.  3 ec2-user ec2-user    34 Mar 26 03:11 .<br>drwx------. 13 ec2-user ec2-user 16384 Mar 26 03:11 ..<br>drwxr-xr-x.  4 ec2-user ec2-user   173 Mar 26 03:11 .c9<br>-rw-r--r--.  1 ec2-user ec2-user   569 Mar 19 13:12 README.md<br>ec2-user:~/environment $ mkdir docker_project<br>ec2-user:~/environment $ cd docker_project/<br>ec2-user:~/environment/docker_project $ docker pull nginx:latest<br>latest: Pulling from library/nginx<br>8a1e25ce7c4f: Pull complete <br>e78b137be355: Pull complete <br>39fc875bd2b2: Pull complete <br>035788421403: Pull complete <br>87c3fb37cbf2: Pull complete <br>c5cdd1ce752d: Pull complete <br>33952c599532: Pull complete <br>Digest: sha256:6db391d1c0cfb30588ba0bf72ea999404f2764febf0f1f196acd5867ac7efa7e<br>Status: Downloaded newer image for nginx:latest<br>docker.io/library/nginx:latest<br>ec2-user:~/environment/docker_project $ </pre><p>4. check docker images</p><pre>docker images</pre><p>output</p><pre>ec2-user:~/environment/docker_project $ docker images<br>REPOSITORY   TAG       IMAGE ID       CREATED       SIZE<br>nginx        latest    92b11f67642b   5 weeks ago   187MB<br>ec2-user:~/environment/docker_project $ </pre><p>5. Create the image using the text editor Vim for the Dockerfile.</p><pre>FROM nginx<br>COPY index.html /usr/share/nginx/html<br>EXPOSE 8080</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QSuaNbh6LKbq-nz855ZTbg.png" /></figure><p>6. We will create the index.html file in the same directory</p><pre>ec2-user:~/environment/docker_project $ echo &#39;&lt;!DOCTYPE html&gt;<br>&gt; &lt;html&gt;<br>&gt;     &lt;body style=&quot;background-color:rgb(200, 200, 200);&quot;&gt;&lt;center&gt;<br>&gt;         &lt;h1&gt;The current date &amp; time is : &lt;/h1&gt;<br>&gt;         &lt;p&gt;&lt;span id=&quot;datetime&quot;&gt;&lt;/span&gt;&lt;/p&gt;<br>&gt;         &lt;script&gt;<br>&gt;             var dt = new Date();<br>&gt;             document.getElementById(&quot;datetime&quot;).innerHTML = dt.toLocaleString();<br>&gt;         &lt;/script&gt;<br>&gt;     &lt;/center&gt;&lt;/body&gt;<br>&gt; &lt;/html&gt;&#39; &gt;&gt; index.html<br>ec2-user:~/environment/docker_project $ ls<br>Dockerfile  index.html<br>ec2-user:~/environment/docker_project $ cat index.html <br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>    &lt;body style=&quot;background-color:rgb(200, 200, 200);&quot;&gt;&lt;center&gt;<br>        &lt;h1&gt;The current date &amp; time is : &lt;/h1&gt;<br>        &lt;p&gt;&lt;span id=&quot;datetime&quot;&gt;&lt;/span&gt;&lt;/p&gt;<br>        &lt;script&gt;<br>            var dt = new Date();<br>            document.getElementById(&quot;datetime&quot;).innerHTML = dt.toLocaleString();<br>        &lt;/script&gt;<br>    &lt;/center&gt;&lt;/body&gt;<br>&lt;/html&gt;<br>ec2-user:~/environment/docker_project $ </pre><pre>ec2-user:~/environment/docker_project $ ls <br>Dockerfile  index.html<br>ec2-user:~/environment/docker_project $ </pre><p>7. Build container images.</p><pre>ec2-user:~/environment/docker_project $ docker build -t my-nginx .<br>[+] Building 0.4s (7/7) FINISHED                                                                                                     docker:default<br> =&gt; [internal] load build definition from Dockerfile                                                                                           0.1s<br> =&gt; =&gt; transferring dockerfile: 157B                                                                                                           0.0s<br> =&gt; [internal] load metadata for docker.io/library/nginx:latest                                                                                0.0s<br> =&gt; [internal] load .dockerignore                                                                                                              0.0s<br> =&gt; =&gt; transferring context: 2B                                                                                                                0.0s<br> =&gt; [internal] load build context                                                                                                              0.1s<br> =&gt; =&gt; transferring context: 453B                                                                                                              0.0s<br> =&gt; [1/2] FROM docker.io/library/nginx:latest                                                                                                  0.1s<br> =&gt; [2/2] COPY index.html /usr/share/nginx/html                                                                                                0.0s<br> =&gt; exporting to image                                                                                                                         0.0s<br> =&gt; =&gt; exporting layers                                                                                                                        0.0s<br> =&gt; =&gt; writing image sha256:eb25e4dd1628a1d5d6098b3501b0a0c12be6f67f1310289bb82ba1df35eb891b                                                   0.0s<br> =&gt; =&gt; naming to docker.io/library/my-nginx                                                                                                    0.0s<br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KlGJF80DzsAvjD3yQWCHXQ.png" /></figure><p>8. We’ll create a new container using the NGINX image with port 8080 exposed.</p><pre> docker container run -d --name akhlab -p 8080:80 my-nginx</pre><pre>ec2-user:~/environment/docker_project $ docker container run -d --name akhlab -p 8080:80 my-nginx<br>1103e4d5d420be063381dcd298528a9912cccd3bf3bef291d2282b91f6b51a19<br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YklWmTkTBPpZ9c56rZxldQ.png" /></figure><p>9. check to make sure our container is running</p><pre>ec2-user:~/environment/docker_project $ docker container ls<br>CONTAINER ID   IMAGE      COMMAND                  CREATED              STATUS              PORTS                                             NAMES<br>1103e4d5d420   my-nginx   &quot;/docker-entrypoint.…&quot;   About a minute ago   Up About a minute   8080/tcp, 0.0.0.0:8080-&gt;80/tcp, :::8080-&gt;80/tcp   akhlab<br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jz_t-326SbzADecPk47GNg.png" /></figure><p>10. Next, we’ll verify that our Docker container is running and accessible by running a curl command</p><pre>ec2-user:~/environment/docker_project $ curl localhost:8080<br>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>    &lt;body style=&quot;background-color:rgb(200, 200, 200);&quot;&gt;&lt;center&gt;<br>        &lt;h1&gt;The current date &amp; time is : &lt;/h1&gt;<br>        &lt;p&gt;&lt;span id=&quot;datetime&quot;&gt;&lt;/span&gt;&lt;/p&gt;<br>        &lt;script&gt;<br>            var dt = new Date();<br>            document.getElementById(&quot;datetime&quot;).innerHTML = dt.toLocaleString();<br>        &lt;/script&gt;<br>    &lt;/center&gt;&lt;/body&gt;<br>&lt;/html&gt;<br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vyu0Nu_g7SqEF5FC64Ol5g.png" /></figure><p>11. Checking cloud9 public ip address</p><pre>ec2-user:~/environment/docker_project $ curl http://checkip.amazonaws.com<br>13.212.196.75<br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*1Q4nOTnnWlmNDYbhBj8wyQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rqrn6keNimG4MQOe0OvseA.png" /></figure><p>12. Let’s save and push the container data to AWS ECR.</p><pre>Check aws - - version</pre><ul><li>To check the AWS region</li></ul><pre>aws configure get region</pre><ul><li>save and push the container data to AWS ECR</li></ul><pre>aws ecr create-repository --repository-name docker_project --region ap-southeast-1</pre><pre>ec2-user:~/environment/docker_project $ aws --version<br>aws-cli/2.15.30 Python/3.11.8 Linux/6.1.79-99.164.amzn2023.x86_64 exe/x86_64.amzn.2023 prompt/off<br>ec2-user:~/environment/docker_project $ aws configure get region<br>ap-southeast-1<br>ec2-user:~/environment/docker_project $ aws ecr create-repository --repository-name docker_project --region ap-southeast-1<br>{<br>    &quot;repository&quot;: {<br>        &quot;repositoryArn&quot;: &quot;arn:aws:ecr:ap-southeast-1:669745465514:repository/docker_project&quot;,<br>        &quot;registryId&quot;: &quot;669745465514&quot;,<br>        &quot;repositoryName&quot;: &quot;docker_project&quot;,<br>        &quot;repositoryUri&quot;: &quot;669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project&quot;,<br>        &quot;createdAt&quot;: &quot;2024-03-26T04:03:04.186000+00:00&quot;,<br>        &quot;imageTagMutability&quot;: &quot;MUTABLE&quot;,<br>        &quot;imageScanningConfiguration&quot;: {<br>            &quot;scanOnPush&quot;: false<br>        },<br>        &quot;encryptionConfiguration&quot;: {<br>            &quot;encryptionType&quot;: &quot;AES256&quot;<br>        }<br>    }<br>}<br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ttve4eZAeAgOU1cbYNCEuw.png" /></figure><p>13. Confirm that the repository has been created by checking the AWS ECR console</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LAoDLHwRuEDH5CLtsfhpdw.png" /></figure><p>14. Next lets create a token and log into the Docker CLI.</p><pre>aws ecr get-login-password --region ap-southeast-1</pre><pre>ec2-user:~/environment/docker_project $ aws ecr get-login-password --region ap-southeast-1<br>eyJwYXlsb2FkIjoia1Y4aXdja3E0VG5JbXFMT2kyY0h1R1poU3JBcDlKU2ptL3o1YlBwMmU5RGhCSU1MQ3Voa1JQajNOMndqbVdPZk5XOS9XU2hqcFpXa2JsejNQNmlycHE3RHk1ZVBseHNlZElXcGVrTElaVEJPSjY3b1RkczA3VGgzbmk0cHd6YWswSnl0SjMwWjNlWXFIZDlyNExwMUhLREtiNXpiWGRldXJVWWdqQUM5MHNrMEN5bGxlOG9zYzFIR1FMTGpNSis4TGJDVjJtRlhSeHl6R1ljMXprTkhtM1ZvZ1huU09rbnE1Qi9KYk1MUXF6WnNKTWNmUHZrdDBJSTN6eVM4czdJR3JaejRtb1lBK0ppdXNaM1cxSWtRNEJEZUQ4WWJjQXAvYm03cjlEazl6ZHpUc2lRN1BxVGdUNWZXRjhQOXlSMWorRk9jN2dMK0txN3ZOcnlsVUltUXc5SkVMeTVqNm1vMGdVVEZtUDczSWIvcWxtaHUwRW4zRDNIU2VOK2RHeUNwNzNuVzhNNlhXWkJRQWR6MlVXUjJEUnZ6V2twcDFzSk5VMVZ3SnFZQnBuVnlUS2NqUXJzN2dPVFExeHdZY1kwK3VDTmdpTVFsWXVURytyUE9JdkpuL2pTNFZIRlBReTc2WVd4RDNPUVY3emRQd0NjaXpCQ2w5d2RKVlJhb1I1cVVEdzRaa24ydi9Mek1mM2lsaFh0ZkU1b29XR21maXlnSElkTSs1UG81U0Z3WGkxNDZyNzBHVlh5Tlh1VGMvY28wcUhJdWZCOGVyTkwzUk9lSTgvcWRQc3U3d3NFaDNQdE5hMy8vUWh2eTNPQ09XZ1YvTlhDVWgrYmpIZm0yeWt6QmNJbm16eFpRRFF4ek95T21NVW5vQVVWc05LcUV1TVFrR1ZUUWpxNk8vbTNEeEM5VU10SUQ0Z0tpNHBHeEpwVXlWN3pjWHEzS05JUDNIOEplZC9iL05DUUw2WFlKUGJhWUlzdlM1c0FzaGg3Tm9hbTRHai9jQ3pQV01UQ1V6YTNXbzZwTVd5UkJxcGhxSXp2MlRVRWRZUzA3NVZnN0pBWEtzWWViV2JDUVJUOVFuTE5ud2RwV3Z5bDRYYnJxOFJmMW5BTCs2V1ROWVhlMkR5YVUxZ3VzL09FNUZOM2YrYmlHbmhnQUU5RTI1dERFTldnTW15bkFpVkZQOVRveWkvMnhYYUVvMlBZNXpBUnZxNjYvYm00WWtJOVVmKzl5Q250aWJCTERUY3cyL0JSSmJUTU81N1hGcGh0RTByUHhUMHQ3TkhvWjR2Z0NoVllDWWFwc1FIZXluaWtYYkh5NG9kL25mMnFnNzhuaGlTWDRNWmVZL3lUZG5FMSs0TDluSUZGZlVZeFVnK2VvWGQzay9UWnJLVUhtcU5FWXBpZiszSXVWOVRiT0N6ZTlGeng1cXppRUYwQ2FXN1NwbVpObE1SYW4ySmxaS2RiZzJ2aGN5V2MzdUY0cC9WQy9PQmN3ZHcvSUdvOHZMWkVYV1BOeGZVcngwNEJQMlo5VG1aeTBSZGdBYlF0Z1VnZkh3WWhDbjFGT3V6R01yZ3NYRno1NW8zaDk5R1JnR1lKcDR4TzFvVWdmTXhNTUlNOEI2ZFVpM0VRa3hoWHR0bmpnSExpQkw3S3VDUEpGK29lWVZqZmt6Z3Y1OXFHTWJZVUtuQTVzeFlPYmJkK2ExNWtUSENBakRJSWZTOEtUZkFBU1JzMFB3bUF3VHU2NjNNWXBoZmlDTlhoUGpMRm1paHAyZGhlL0xKaUdQbkhYOEtOYjBZWTV3Y0R5eVZia21aa1dNSFV5WnlPNjhoQmN6bGNEeEUxMCIsImRhdGFrZXkiOiJBUUVCQUhpZEVyWkNmaEtPZURNMDgrY1A1ZnR5anZROVhNTVNRNHBLMEZabnZBWlhKZ0FBQUg0d2ZBWUpLb1pJaHZjTkFRY0dvRzh3YlFJQkFEQm9CZ2txaGtpRzl3MEJCd0V3SGdZSllJWklBV1VEQkFFdU1CRUVEUFVmTGowMTFOSXYxRk9xOHdJQkVJQTdVaGEyTUkxRDJ4R1dDWUZoK3BpRGE1bGNYTS9MaVpaUG5OaDBPOEVoZlU1VXFIdDAyTWJyM2daNWE4RHgrWEI3cStFYndKcFJlbXI4MTdjPSIsInZlcnNpb24iOiIyIiwidHlwZSI6IkRBVEFfS0VZIiwiZXhwaXJhdGlvbiI6MTcxMTQ2OTMwNH0=</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x-Fn5-K5shl7ddSQ2ugIDw.png" /></figure><pre>aws ecr --region &lt;region&gt;| docker login -u AWS -p &lt;Token&gt; &lt;ECR URI&gt;</pre><pre>aws ecr --region ap-southeast-1| docker login -u AWS -p eyJwYXlsb2FkIjoia1Y4aXdja3E0VG5JbXFMT2kyY0h1R1poU3JBcDlKU2ptL3o1YlBwMmU5RGhCSU1MQ3Voa1JQajNOMndqbVdPZk5XOS9XU2hqcFpXa2JsejNQNmlycHE3RHk1ZVBseHNlZElXcGVrTElaVEJPSjY3b1RkczA3VGgzbmk0cHd6YWswSnl0SjMwWjNlWXFIZDlyNExwMUhLREtiNXpiWGRldXJVWWdqQUM5MHNrMEN5bGxlOG9zYzFIR1FMTGpNSis4TGJDVjJtRlhSeHl6R1ljMXprTkhtM1ZvZ1huU09rbnE1Qi9KYk1MUXF6WnNKTWNmUHZrdDBJSTN6eVM4czdJR3JaejRtb1lBK0ppdXNaM1cxSWtRNEJEZUQ4WWJjQXAvYm03cjlEazl6ZHpUc2lRN1BxVGdUNWZXRjhQOXlSMWorRk9jN2dMK0txN3ZOcnlsVUltUXc5SkVMeTVqNm1vMGdVVEZtUDczSWIvcWxtaHUwRW4zRDNIU2VOK2RHeUNwNzNuVzhNNlhXWkJRQWR6MlVXUjJEUnZ6V2twcDFzSk5VMVZ3SnFZQnBuVnlUS2NqUXJzN2dPVFExeHdZY1kwK3VDTmdpTVFsWXVURytyUE9JdkpuL2pTNFZIRlBReTc2WVd4RDNPUVY3emRQd0NjaXpCQ2w5d2RKVlJhb1I1cVVEdzRaa24ydi9Mek1mM2lsaFh0ZkU1b29XR21maXlnSElkTSs1UG81U0Z3WGkxNDZyNzBHVlh5Tlh1VGMvY28wcUhJdWZCOGVyTkwzUk9lSTgvcWRQc3U3d3NFaDNQdE5hMy8vUWh2eTNPQ09XZ1YvTlhDVWgrYmpIZm0yeWt6QmNJbm16eFpRRFF4ek95T21NVW5vQVVWc05LcUV1TVFrR1ZUUWpxNk8vbTNEeEM5VU10SUQ0Z0tpNHBHeEpwVXlWN3pjWHEzS05JUDNIOEplZC9iL05DUUw2WFlKUGJhWUlzdlM1c0FzaGg3Tm9hbTRHai9jQ3pQV01UQ1V6YTNXbzZwTVd5UkJxcGhxSXp2MlRVRWRZUzA3NVZnN0pBWEtzWWViV2JDUVJUOVFuTE5ud2RwV3Z5bDRYYnJxOFJmMW5BTCs2V1ROWVhlMkR5YVUxZ3VzL09FNUZOM2YrYmlHbmhnQUU5RTI1dERFTldnTW15bkFpVkZQOVRveWkvMnhYYUVvMlBZNXpBUnZxNjYvYm00WWtJOVVmKzl5Q250aWJCTERUY3cyL0JSSmJUTU81N1hGcGh0RTByUHhUMHQ3TkhvWjR2Z0NoVllDWWFwc1FIZXluaWtYYkh5NG9kL25mMnFnNzhuaGlTWDRNWmVZL3lUZG5FMSs0TDluSUZGZlVZeFVnK2VvWGQzay9UWnJLVUhtcU5FWXBpZiszSXVWOVRiT0N6ZTlGeng1cXppRUYwQ2FXN1NwbVpObE1SYW4ySmxaS2RiZzJ2aGN5V2MzdUY0cC9WQy9PQmN3ZHcvSUdvOHZMWkVYV1BOeGZVcngwNEJQMlo5VG1aeTBSZGdBYlF0Z1VnZkh3WWhDbjFGT3V6R01yZ3NYRno1NW8zaDk5R1JnR1lKcDR4TzFvVWdmTXhNTUlNOEI2ZFVpM0VRa3hoWHR0bmpnSExpQkw3S3VDUEpGK29lWVZqZmt6Z3Y1OXFHTWJZVUtuQTVzeFlPYmJkK2ExNWtUSENBakRJSWZTOEtUZkFBU1JzMFB3bUF3VHU2NjNNWXBoZmlDTlhoUGpMRm1paHAyZGhlL0xKaUdQbkhYOEtOYjBZWTV3Y0R5eVZia21aa1dNSFV5WnlPNjhoQmN6bGNEeEUxMCIsImRhdGFrZXkiOiJBUUVCQUhpZEVyWkNmaEtPZURNMDgrY1A1ZnR5anZROVhNTVNRNHBLMEZabnZBWlhKZ0FBQUg0d2ZBWUpLb1pJaHZjTkFRY0dvRzh3YlFJQkFEQm9CZ2txaGtpRzl3MEJCd0V3SGdZSllJWklBV1VEQkFFdU1CRUVEUFVmTGowMTFOSXYxRk9xOHdJQkVJQTdVaGEyTUkxRDJ4R1dDWUZoK3BpRGE1bGNYTS9MaVpaUG5OaDBPOEVoZlU1VXFIdDAyTWJyM2daNWE4RHgrWEI3cStFYndKcFJlbXI4MTdjPSIsInZlcnNpb24iOiIyIiwidHlwZSI6IkRBVEFfS0VZIiwiZXhwaXJhdGlvbiI6MTcxMTQ2OTMwNH0= 669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project</pre><pre>ec2-user:~/environment/docker_project $ aws ecr --region ap-southeast-1| docker login -u AWS -p eyJwYXlsb2FkIjoia1Y4aXdja3E0VG5JbXFMT2kyY0h1R1poU3JBcDlKU2ptL3o1YlBwMmU5RGhCSU1MQ3Voa1JQajNOMndqbVdPZk5XOS9XU2hqcFpXa2JsejNQNmlycHE3RHk1ZVBseHNlZElXcGVrTElaVEJPSjY3b1RkczA3VGgzbmk0cHd6YWswSnl0SjMwWjNlWXFIZDlyNExwMUhLREtiNXpiWGRldXJVWWdqQUM5MHNrMEN5bGxlOG9zYzFIR1FMTGpNSis4TGJDVjJtRlhSeHl6R1ljMXprTkhtM1ZvZ1huU09rbnE1Qi9KYk1MUXF6WnNKTWNmUHZrdDBJSTN6eVM4czdJR3JaejRtb1lBK0ppdXNaM1cxSWtRNEJEZUQ4WWJjQXAvYm03cjlEazl6ZHpUc2lRN1BxVGdUNWZXRjhQOXlSMWorRk9jN2dMK0txN3ZOcnlsVUltUXc5SkVMeTVqNm1vMGdVVEZtUDczSWIvcWxtaHUwRW4zRDNIU2VOK2RHeUNwNzNuVzhNNlhXWkJRQWR6MlVXUjJEUnZ6V2twcDFzSk5VMVZ3SnFZQnBuVnlUS2NqUXJzN2dPVFExeHdZY1kwK3VDTmdpTVFsWXVURytyUE9JdkpuL2pTNFZIRlBReTc2WVd4RDNPUVY3emRQd0NjaXpCQ2w5d2RKVlJhb1I1cVVEdzRaa24ydi9Mek1mM2lsaFh0ZkU1b29XR21maXlnSElkTSs1UG81U0Z3WGkxNDZyNzBHVlh5Tlh1VGMvY28wcUhJdWZCOGVyTkwzUk9lSTgvcWRQc3U3d3NFaDNQdE5hMy8vUWh2eTNPQ09XZ1YvTlhDVWgrYmpIZm0yeWt6QmNJbm16eFpRRFF4ek95T21NVW5vQVVWc05LcUV1TVFrR1ZUUWpxNk8vbTNEeEM5VU10SUQ0Z0tpNHBHeEpwVXlWN3pjWHEzS05JUDNIOEplZC9iL05DUUw2WFlKUGJhWUlzdlM1c0FzaGg3Tm9hbTRHai9jQ3pQV01UQ1V6YTNXbzZwTVd5UkJxcGhxSXp2MlRVRWRZUzA3NVZnN0pBWEtzWWViV2JDUVJUOVFuTE5ud2RwV3Z5bDRYYnJxOFJmMW5BTCs2V1ROWVhlMkR5YVUxZ3VzL09FNUZOM2YrYmlHbmhnQUU5RTI1dERFTldnTW15bkFpVkZQOVRveWkvMnhYYUVvMlBZNXpBUnZxNjYvYm00WWtJOVVmKzl5Q250aWJCTERUY3cyL0JSSmJUTU81N1hGcGh0RTByUHhUMHQ3TkhvWjR2Z0NoVllDWWFwc1FIZXluaWtYYkh5NG9kL25mMnFnNzhuaGlTWDRNWmVZL3lUZG5FMSs0TDluSUZGZlVZeFVnK2VvWGQzay9UWnJLVUhtcU5FWXBpZiszSXVWOVRiT0N6ZTlGeng1cXppRUYwQ2FXN1NwbVpObE1SYW4ySmxaS2RiZzJ2aGN5V2MzdUY0cC9WQy9PQmN3ZHcvSUdvOHZMWkVYV1BOeGZVcngwNEJQMlo5VG1aeTBSZGdBYlF0Z1VnZkh3WWhDbjFGT3V6R01yZ3NYRno1NW8zaDk5R1JnR1lKcDR4TzFvVWdmTXhNTUlNOEI2ZFVpM0VRa3hoWHR0bmpnSExpQkw3S3VDUEpGK29lWVZqZmt6Z3Y1OXFHTWJZVUtuQTVzeFlPYmJkK2ExNWtUSENBakRJSWZTOEtUZkFBU1JzMFB3bUF3VHU2NjNNWXBoZmlDTlhoUGpMRm1paHAyZGhlL0xKaUdQbkhYOEtOYjBZWTV3Y0R5eVZia21aa1dNSFV5WnlPNjhoQmN6bGNEeEUxMCIsImRhdGFrZXkiOiJBUUVCQUhpZEVyWkNmaEtPZURNMDgrY1A1ZnR5anZROVhNTVNRNHBLMEZabnZBWlhKZ0FBQUg0d2ZBWUpLb1pJaHZjTkFRY0dvRzh3YlFJQkFEQm9CZ2txaGtpRzl3MEJCd0V3SGdZSllJWklBV1VEQkFFdU1CRUVEUFVmTGowMTFOSXYxRk9xOHdJQkVJQTdVaGEyTUkxRDJ4R1dDWUZoK3BpRGE1bGNYTS9MaVpaUG5OaDBPOEVoZlU1VXFIdDAyTWJyM2daNWE4RHgrWEI3cStFYndKcFJlbXI4MTdjPSIsInZlcnNpb24iOiIyIiwidHlwZSI6IkRBVEFfS0VZIiwiZXhwaXJhdGlvbiI6MTcxMTQ2OTMwNH0= 669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project<br>WARNING! Using --password via the CLI is insecure. Use --password-stdin.<br>WARNING! Your password will be stored unencrypted in /home/ec2-user/.docker/config.json.<br>Configure a credential helper to remove this warning. See<br>https://docs.docker.com/engine/reference/commandline/login/#credentials-store<br><br>Login Succeeded<br><br>usage: aws [options] &lt;command&gt; &lt;subcommand&gt; [&lt;subcommand&gt; ...] [parameters]<br>To see help text, you can run:<br><br>  aws help<br>  aws &lt;command&gt; help<br>  aws &lt;command&gt; &lt;subcommand&gt; help<br><br>aws: error: the following arguments are required: operation<br><br>ec2-user:~/environment/docker_project $ </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3_9XRvWyU-DRSqe0pfsxw.png" /></figure><p>15. Next step is tag the image</p><pre>docker tag &lt;ECR URI&gt;</pre><pre>ec2-user:~/environment $ docker tag my-nginx 669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project<br>ec2-user:~/environment $ </pre><p>16. Use the following command to push the image to ECR</p><pre>docker push &lt;ECR URI&gt;</pre><pre>ec2-user:~/environment $ docker push 669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project<br>Using default tag: latest<br>The push refers to repository [669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project]<br>5bead8460ac5: Pushed <br>fd31601f0be4: Pushed <br>93b4c8c4ac05: Pushed <br>b7df9f234b50: Pushed <br>ab75a0b61bd1: Pushed <br>c1b1bf2f95dc: Pushed <br>4d99aab1eed4: Pushed <br>a483da8ab3e9: Pushed <br>latest: digest: sha256:6dd65</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n8aD8iKmBQ-MfgBNkdpc5Q.png" /></figure><p>17. check the ECR console…!!!!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJgpo6Kpo-RcWv8Gt9sIaQ.png" /></figure><p>18. Also push to Docker Hub</p><pre>docker login</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xN6B6rNLcapNlfM2X5e8Mw.png" /></figure><pre>docker commit &lt;container name&gt; &lt;dockerhub_username&gt;/&lt;repo_name&gt;:tag</pre><pre>docker commit akhlab akhlab/docker_project:nginx</pre><pre>ec2-user:~/environment $ docker commit akhlab akhlab/docker_project:nginx<br>sha256:b838874872526ce41aaf724b45a7dc0de4aeda6a367d04364b1bbbf0ed03238a<br>ec2-user:~/environment $ </pre><pre>docker push akhlab/docker_project:nginx</pre><pre>ec2-user:~/environment $ docker tag my-nginx 669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project<br>ec2-user:~/environment $ docker push 669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project<br>Using default tag: latest<br>The push refers to repository [669745465514.dkr.ecr.ap-southeast-1.amazonaws.com/docker_project]<br>5bead8460ac5: Pushed <br>fd31601f0be4: Pushed <br>93b4c8c4ac05: Pushed <br>b7df9f234b50: Pushed <br>ab75a0b61bd1: Pushed <br>c1b1bf2f95dc: Pushed <br>4d99aab1eed4: Pushed <br>a483da8ab3e9: Pushed <br>latest: digest: sha256:6dd651200e59274619df49b61dcdb31d3df5e110bed64d0775776ef31ea6d216 size: 1985<br>ec2-user:~/environment $ docker login<br>Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don&#39;t have a Docker ID, head over to https://hub.docker.com/ to create one.<br>You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQ0VQG2mhb1Eamp7ev8ylw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ys4ztM0RnEbjQz58aKeghg.png" /></figure><blockquote>It&#39;s complete. Thank you for your time and attention.!!!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ec42191c048" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Terraform: A Beginner’s Guide]]></title>
            <link>https://medium.com/@alexiscloud/understanding-terraform-a-beginners-guide-f3f1c6be0e8b?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3f1c6be0e8b</guid>
            <category><![CDATA[terraform-modules]]></category>
            <category><![CDATA[terraform-cli]]></category>
            <category><![CDATA[shebang]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[hashicorp]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Sun, 21 Jan 2024 01:41:07 GMT</pubDate>
            <atom:updated>2024-01-22T13:41:22.830Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/834/1*SBhGdmLZ7JhWFVi5BDl7Lg.png" /><figcaption>photo credit spacelift.io</figcaption></figure><p>Terraform is a robust Infrastructure as Code (IaC) tool that allows you to define and provision infrastructure using a declarative configuration language. In this beginner-friendly guide, we’ll cover some essential Terraform basics to help you kickstart your journey.</p><h3>Terraform Registry</h3><p>The <a href="https://registry.terraform.io/">Terraform Registry</a> serves as a central hub where you can discover providers and modules to enhance your Terraform projects.</p><ul><li><strong>Providers:</strong> These serve as interfaces to APIs, enabling the creation of resources in Terraform. A variety of providers can be found on the registry, including the <a href="https://registry.terraform.io/providers/hashicorp/random">Random Terraform Provider</a>.</li><li><strong>Modules:</strong> Modules help you organize your Terraform code, making it modular, portable, and easily shareable. They encapsulate reusable components of your infrastructure.</li></ul><h3>Terraform Console</h3><p>To explore a list of all Terraform commands, simply type terraform in your terminal. This provides an overview of available commands along with their descriptions.</p><h3>Terraform Init</h3><p>When starting a new Terraform project, the initial step is to run terraform init. This command downloads the necessary binaries for the providers you&#39;ll be using in your project.</p><h3>Terraform Plan</h3><p>The terraform plan command generates a changeset outlining proposed modifications to your infrastructure. It provides insights into what Terraform will modify or create. You can output this plan for review or pass it directly to an apply.</p><h3>Terraform Apply</h3><p>To execute the planned changes, utilize terraform apply. This command prompts you to confirm the changes before applying them. For automated approval, use the --auto-approve flag, such as terraform apply --auto-approve.</p><h3>Terraform Lock Files</h3><p>The .terraform.lock.hcl file contains versioning information for the providers or modules used in your project. It&#39;s crucial to commit this file to your Version Control System (VCS), like GitHub.</p><h3>Terraform State Files</h3><p>The .terraform.tfstate file holds information about the current state of your infrastructure. Never commit this file to your VCS, as it may contain sensitive data. Losing this file means losing track of your infrastructure state. The .terraform.tfstate.backup file is a backup of the previous state.</p><h3>Terraform Directory</h3><p>The .terraform directory contains the binaries of Terraform providers.</p><h3>Issues with Terraform Cloud Login and Gitpod Workspace</h3><p>When attempting to run terraform login in Gitpod VSCode, there might be issues launching the interactive view. A workaround is to manually generate a token in Terraform Cloud:</p><ol><li>Visit <a href="https://app.terraform.io/app/settings/tokens?source=terraform-login">Terraform Cloud Tokens</a>.</li><li>Create and copy your token.</li></ol><p>Open a terminal and create the credentials file:</p><pre>touch /home/gitpod/.terraform.d/credentials.tfrc.json<br>open /home/gitpod/.terraform.d/credentials.tfrc.json</pre><p>Provide the following code, replacing “YOUR-TERRAFORM-CLOUD-TOKEN” with your actual token:</p><pre>{<br>  &quot;credentials&quot;: {<br>    &quot;app.terraform.io&quot;: {<br>      &quot;token&quot;: &quot;YOUR-TERRAFORM-CLOUD-TOKEN&quot;<br>    }<br>  }<br>}</pre><h3>Semantic Versioning</h3><p>This project follows <a href="https://semver.org/">semantic versioning</a>, with versions formatted as MAJOR.MINOR.PATCH. Major versions indicate incompatible API changes, minor versions add backward-compatible functionality, and patch versions include backward-compatible bug fixes.</p><h3>Install the Terraform CLI</h3><p>Ensure you follow the latest Terraform CLI installation instructions via the <a href="https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli">official documentation</a>. Considerations for Linux distribution are mentioned, so adapt accordingly.</p><h3>Refactoring into Bash Scripts</h3><p>To address Terraform CLI GPG keyring changes, a bash script (./bin/install_terraform_cli) has been created. This allows for a cleaner Gitpod Task File (./.gitpod.yml), easier debugging, manual execution, and better portability for installing Terraform CLI in other projects.</p><h3>Shebang Considerations</h3><p>The recommended shebang for bash scripts is #!/usr/bin/env bash for portability across different OS distributions.</p><h3>Execution Considerations</h3><p>Execute bash scripts using the ./ shorthand notation. If using a script in .gitpod.yml, use source to interpret the script.</p><h3>Linux Permissions Considerations</h3><p>Make bash scripts executable with the following commands:</p><pre>chmod u+x ./bin/install_terraform_cli</pre><p>Alternatively:</p><pre>chmod 744 ./bin/install_terraform_cli</pre><h3>GitHub Lifecycle (Before, Init, Command)</h3><p>Exercise caution with terraform init as it won&#39;t rerun if you restart an existing workspace. Refer to Gitpod <a href="https://www.gitpod.io/docs/configure/workspaces/tasks">workspace tasks</a> for more information.</p><h3>Working Environment Variables</h3><p>List environment variables using the env command. Filter specific variables with grep, e.g., env | grep AWS_.</p><h3>Setting and Unsetting Environment Variables</h3><p>Set variables using export VAR_NAME=&#39;value&#39; and unset using unset VAR_NAME. For temporary setting during command execution:</p><pre>#!/usr/bin/env bash</pre><pre>VAR_NAME=&#39;value&#39; ./bin/print_message</pre><h3>Printing Variables</h3><p>Print an environment variable using echo $VAR_NAME.</p><h3>Scoping of Environment Variables</h3><p>New bash terminals in VSCode won’t be aware of variables set in other windows. To persist across all terminals, set environment variables in your bash profile (.bash_profile).</p><h3>Persisting Environment Variables in Gitpod</h3><p>Persist environment variables in Gitpod using:</p><pre>gp env VAR_NAME=&#39;value&#39;</pre><p>This stores variables in Gitpod Secrets Storage for all future workspaces.</p><h3>AWS CLI Installation</h3><p>Install the AWS CLI using the bash script ./bin/install_aws_cli. Verify AWS credentials with aws sts get-caller-identity.</p><p>Happy Learning!</p><p>Additional learning Different Terraform Versions</p><p><a href="https://spacelift.io/blog/terraform-version">How to Manage Different Terraform Versions</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3f1c6be0e8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Networking 101: Understanding AWS VPC, Subnets, IGW, NAT, and Route Tables]]></title>
            <link>https://medium.com/@alexiscloud/networking-101-understanding-aws-vpc-subnets-igw-nat-and-route-tables-f2ce916bef80?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2ce916bef80</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[cloud-infrastructure]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Mon, 18 Dec 2023 14:18:31 GMT</pubDate>
            <atom:updated>2023-12-18T14:18:31.479Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*WgoiEkBxIWMhgLQ26-41aQ.png" /></figure><p>In this blog post, we simplified complex networking concepts into easy-to-understand terms, making them accessible to non-IT readers. We likened VPC to a virtual neighborhood, subnets to blocks within the neighborhood, IGW to the main gate, NAT to a translator for private conversations, and route tables to traffic controllers.</p><p>By breaking down these concepts in a relatable way, we aimed to provide a solid foundation for readers to build and manage their own secure and efficient AWS networks.</p><p><strong>Task 1: Log into the AWS Console and create a VPC.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*FRQcB-_bX_0CcGmiBFIDSw.png" /></figure><p><strong>Step 1.1</strong></p><p>In the VPC console, click <strong>Create VPC</strong>:</p><p><strong>Step 1.2<br></strong>Give the VPC a name of <strong>akhlab-vpc </strong>and set the IPv4 CIDR block to use <strong>10.0.0.0/16</strong>. Leave all of the</p><p>other settings as default and select <strong>Create VPC </strong>at the bottom of the Create VPC screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*z1opOrOpLfQDgtTQfjrGeg.png" /></figure><p><strong>Task 2: Create public and private subnets in three different Availability Zones.</strong></p><p><strong>Step 2.1</strong></p><p>In the VPC console, select <strong><em>Subnets </em></strong>from the left navigation panel. Click <strong>Create Subnet</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*Cx7uZq3IMs7J25BmK2sLQQ.png" /></figure><p><strong>Step 2.2</strong></p><p>Select the VPC created in Step 1 from the dropdown list. Give the subnet the name <strong>private</strong>-subnet-1 and select us-east-1a from the dropdown list for the Availability Zone. Enter the IPv4 CIDR block of 10.0.0.0/24.</p><p><strong>Step 2.3</strong></p><p>Repeat the previous step to create the additional subnets required to build out the required infrastruc- ture, including 2 additional private subnets and the 3 public subnets. Use the following information to complete this step:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*tQnfPbL4n0oRnzedVtn1zg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*5wUODmnXKKjQA2REdXb19g.png" /></figure><p><strong>Task 3: Deploy an Internet Gateway and attach it to the VPC.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*gQ86FYirKUxy8zpfTGRCOg.png" /></figure><p><strong>Step 3.1</strong></p><p>In the VPC console, select Internet Gateways from the left navigation panel in the VPC console. Click the Create Gateway button in the top right of the AWS console.</p><p><strong>Step 3.2</strong></p><p>Give the new Internet Gateway a name of <strong><em>demo-igw </em></strong>and click the Create internet gateway button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*iMbQbTAgYE7az6YAOHSswA.png" /></figure><p><strong>Step 3.3</strong></p><p>In the Internet Gateway console, select the Actions menu and choose <strong><em>Attach to VPC </em></strong>from the dropdown list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*oLeEQLXHi86PZvpH7VQJEw.png" /></figure><p><strong>Task 4: Provision a NAT Gateway (a single instance will do) for outbound connectivity.</strong></p><p><strong>Step 4.1</strong></p><p>Back in the VPC Console, select <strong>NAT Gateways </strong>from the left navigation panel. Click the <strong><em>Create NAT Gateway </em></strong>button on the top right of the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*mOV_GpQgeIO2CmRaMHI-9A.png" /></figure><p><strong>Step 4.2</strong></p><p>Provide the name <strong><em>akhlab-nat-gateway </em></strong>for the NAT Gateway. Select a subnet by choosing <strong><em>public- subnet-2 </em></strong>from the dropdown list. Keep the Connectivity Type as <strong><em>Public</em></strong>. Click the <strong><em>Allocate Elastic IP </em></strong>button to automatically create and assign a new Elastic IP address for the NAT Gateway. Scroll down and click the <strong><em>Create NAT Gateway </em></strong>button to complete the task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*50wZCSVBwhURMsQ6SE9hQA.png" /></figure><p><strong>Task 5: Ensure that route tables are configured to properly route traffic based on the requirements.</strong></p><p><strong>Step 5.1<br></strong>In the VPC console, select <strong>Route Tables </strong>from the left navigation panel. Click the <strong><em>Create route table</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*odlWCD0jvcCh-qPM8R82Xg.png" /></figure><p>button on the top right of the AWS console.<br>Provide the name <strong>public</strong>-rtb for the route table and select the VPC created in Step 1. Click the</p><p><strong><em>Create route table </em></strong>button to create your first route table.</p><p>Repeat the above task to create a second route table. Name the second route table <strong>private</strong>-rtb. Select the same VPC created in Step 1. Click the <strong><em>Create route table </em></strong>button to create the second route table.</p><p><strong>Step 5.2</strong></p><p>From the Route Tables console, select the tick box next to the route table named <strong>public</strong>-rtb. In the bottom panel, select the <strong><em>Subnet Associations </em></strong>tab. Click the <strong><em>Edit subnet associations </em></strong>button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*0i9vrrLOiN1-2VQoinUIpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*wuCuLk7h1HCiK68nzQzpwg.png" /></figure><p><strong>Step 5.3</strong></p><p>Now that the subnets have been associated with the proper route table, we need to add the routes to ensure network traffic is routed correctly. From the Route Tables console, select the <strong>public</strong>-rtb again. In the bottom pane, select the <strong>Routes </strong>tab and click <strong><em>Edit Routes</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*gUeL5P53V7NRfv4yBdkIAw.png" /></figure><p>In the Edit Routes window, click the <strong><em>Add route </em></strong>button. Enter 0.0.0.0/0 in the <strong>Destination </strong>text box to define our new route destination. Click the text box for <strong>Target</strong>, select <strong><em>Internet Gateway</em></strong>, and select the Internet Gateway that was created in Step 3. It should be the only one listed. Click <strong><em>Save changes </em></strong>to save the new route configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*De_US47AY_IQqlSMHN7Zug.png" /></figure><p>Repeat this step to add a route to the <strong>private</strong>-rtb. The Destination should be 0.0.0.0/0. Click the text box for <strong>Target</strong>, select <strong><em>NAT Gateway</em></strong>, and choose the NAT Gateway that was created in Step 4. It should be the only one listed. Click <strong><em>Save changes </em></strong>to save the new route configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*6OQPeCGvY-5Hd--9SUsr2g.png" /></figure><p>Thanks for reading!</p><p>Questions? Leave a comment or reach out directly.</p><p>We appreciate your readership and hope you’ll follow our blog for more on AWS and cloud computing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2ce916bef80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passwords vs Keys]]></title>
            <link>https://medium.com/@alexiscloud/passwords-vs-keys-97f25cb92c38?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/97f25cb92c38</guid>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[keys]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Mon, 30 Oct 2023 05:08:23 GMT</pubDate>
            <atom:updated>2023-10-30T06:07:14.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wAypJc6Qg1k7E0Ys" /></figure><h3>🔒 Passwords: The Basics</h3><p>Passwords are the most common way to prove your identity online. However, they need to be strong to protect your accounts. Here’s what you need to know:</p><p><strong>Best Practices:</strong></p><ul><li>Use longer passwords (at least 8 characters).</li><li>Mix it up with numbers, upper and lower case letters, and symbols.</li><li>Avoid common words or simple substitutions.</li><li>Never reuse the same password for different accounts.</li></ul><p>Change your passwords regularly.</p><h3>🧐 Why Passwords Matter</h3><p>Using weak or easily guessable passwords can put your accounts at risk. Attackers have many tricks up their sleeves to crack them.</p><p>💡 <strong>Password Managers to the Rescue</strong></p><p>Password managers like KeePass, LastPass, and 1Password can make life easier:</p><p>🔑 <strong>KeePass</strong>: Keeps your passwords in a secure, encrypted database. Only remember one strong password.</p><p>👉 <strong>To Install</strong>: brew cask install keepassxc</p><p>🔑 <strong>LastPass</strong>: Manage passwords online, across devices. Also, offers convenient browser plugins and mobile apps.</p><p>🔑 <strong>1Password</strong>: A competitor to LastPass. Some prefer it due to its security features.</p><p>🔗 <a href="https://1password.com/">1Password</a></p><p>🔐 <strong>Public Key Authentication: The Advanced Way</strong></p><p>For a higher level of security, you can use public key authentication. Here’s how it works:</p><p>🔑 <strong>SSH (Secure Shell)</strong>: Uses public key authentication to allow passwordless access to remote hosts.</p><p>📜 <strong>Steps to Set Up SSH</strong>:</p><ol><li>Generate SSH keys with ssh-keygen -b 4096.</li><li>Copy your public key to the SSH server with scp.</li><li>Append the public key to authorized_keys.</li><li>Adjust file permissions with chmod.</li></ol><p><strong>Simple SSH key Generate</strong></p><pre># Generate SSH keys. Use the default file and empty passphrase for the keys.<br>ssh-keygen -b 4096<br><br># Copy public key to SSH server<br>scp ~/.ssh/id_rsa.pub &lt;HOST_NAME&gt;:<br><br># SSH to host<br>ssh &lt;HOST_NAME&gt;<br><br># Append public key to authorized_keys<br>mkdir ~/.ssh<br>cat id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys<br>rm id_rsa.pub</pre><p>⚠️ <strong>Note</strong>: The private key should remain secret and have restricted file permissions.</p><p>🛡️ <strong>Advantages of Public Key Authentication</strong>:</p><ul><li>Enhanced security through cryptographic keys.</li><li>Passwordless and non-interactive access.</li><li>Avoids the risk of password cracking.</li></ul><p>🚫 <strong>Disadvantages of Public Key Authentication</strong>:</p><p>🚀 <strong>Tips and Tricks</strong></p><p>📄 <strong>Sample SSH Config File</strong>:</p><pre>Host my_host<br>    Hostname ec2-42-42-42-42.us-west-2.compute.amazonaws.com<br>    User ec2-user<br>    IdentityFile ~/.ssh/host_public_key.pub</pre><p>👉 Now, you can connect with ssh my_host effortlessly.</p><p>🔑 <strong>Deliverable</strong>: Create SSH keys, add the public key to an SSH server, and test logging in without a password.</p><p>So, choose your authentication method wisely-passwords for simplicity or public keys for enhanced security. Stay safe online! 🌐🔐</p><p><em>Originally published at </em><a href="https://aungkohtet.hashnode.dev/passwords-vs-keys"><em>https://aungkohtet.hashnode.dev</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=97f25cb92c38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launch an Amazon free-tier EC2 instance and install Docker]]></title>
            <link>https://medium.com/@alexiscloud/launch-an-amazon-free-tier-ec2-instance-and-install-docker-5024ddd40d09?source=rss-3853d59abca0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5024ddd40d09</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dockerhub]]></category>
            <category><![CDATA[ec2]]></category>
            <dc:creator><![CDATA[Aung Ko Htet]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 08:56:49 GMT</pubDate>
            <atom:updated>2023-10-26T09:05:08.536Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rMelBboYF8vZhaobY2UXXg.png" /></figure><p>### Launch an Amazon free-tier eligible EC2 instance and install Docker</p><ol><li>Create an EC2 instance</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uyJX0wFyuD0gLPg-J1ySug.jpeg" /></figure><p>2. Install docker</p><pre>sudo yum install docker -y </pre><p>3. Start the Docker service<br>`sudo service docker start`</p><p>Output:</p><pre><br>[ec2-user@ip-172–31–27–244 ~]$ sudo service docker start<br>Redirecting to /bin/systemctl start docker.service<br>[ec2-user@ip-172–31–27–244 ~]$ date<br>Fri Feb 24 18:13:02 UTC 2023<br></pre><p>4. Check the status of Docker service</p><p>Check status:</p><pre>systemctl status docker</pre><p>Output:</p><pre>[ec2-user@ip-172–31–27–244 ~]$ systemctl status docker<br>● docker.service - Docker Application Container Engine<br> Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)<br> Active: active (running) since Fri 2023–02–24 18:12:56 UTC; 18s ago<br> Docs: https://docs.docker.com<br> Process: 3541 ExecStartPre=/usr/libexec/docker/docker-setup-runtimes.sh (code=exited, status=0/SUCCESS)<br> Process: 3540 ExecStartPre=/bin/mkdir -p /run/docker (code=exited, status=0/SUCCESS)<br> Main PID: 3544 (dockerd)<br> Tasks: 7<br> Memory: 20.8M<br> CGroup: /system.slice/docker.service<br> └─3544 /usr/bin/dockerd -H fd:// - containerd=/run/containerd/containerd.sock - default-ulimit nofile=32768:65536<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.307285735Z&quot; level=info msg=&quot;ClientConn switching balancer to \&quot;pick_first…dule=grpc<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.345070523Z&quot; level=warning msg=&quot;Your kernel does not support cgroup blkio weight&quot;<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.345497426Z&quot; level=warning msg=&quot;Your kernel does not support cgroup blkio …t_device&quot;<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.345939221Z&quot; level=info msg=&quot;Loading containers: start.&quot;<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.528538493Z&quot; level=info msg=&quot;Default bridge (docker0) is assigned with an … address&quot;<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.575575709Z&quot; level=info msg=&quot;Loading containers: done.&quot;<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.597059083Z&quot; level=info msg=&quot;Docker daemon&quot; commit=a89b842 graphdriver(s)=…=20.10.17<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.597530250Z&quot; level=info msg=&quot;Daemon has completed initialization&quot;<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal systemd[1]: Started Docker Application Container Engine.<br>Feb 24 18:12:56 ip-172–31–27–244.eu-central-1.compute.internal dockerd[3544]: time=&quot;2023–02–24T18:12:56.623407852Z&quot; level=info msg=&quot;API listen on /run/docker.sock&quot;<br>Hint: Some lines were ellipsized, use -l to show in full.<br>[ec2-user@ip-172–31–27–244 ~]$</pre><p>6. Before proceeding further we have to check if we are able to execute Docker commands as non-root user. To verify this, let’s execute the docker info command as below:</p><pre>docker info</pre><p>Output:</p><pre>[ec2-user@ip-172–31–27–244 ~]$ docker info<br>Client:<br> Context: default<br> Debug Mode: false<br>Server:<br>ERROR: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get &quot;http://%2Fvar%2Frun%2Fdocker.sock/v1.24/info&quot;: dial unix /var/run/docker.sock: connect: permission denied<br>errors pretty printing info</pre><p>As expected, it did not work.</p><p>7. So, we now add our user _ec2_user_ to the _Docker_ group.</p><pre>sudo groupadd docker</pre><p>_Note:_ if the _Docker_ group does not exist, we can create it using the below command and then add the user to the group:</p><pre>sudo groupadd docker</pre><p>For this to take effect, we can either restart our EC2 instance or refresh the group list manually, using the below command:</p><pre>sudo usermod -aG docker ec2-user</pre><p>_Note:_ If all goes well, we don’t expect the command to give a terminal output.</p><p>8. Execute the `docker info ` command again.</p><pre>[ec2-user@ip-172–31–27–244 ~]$ docker info<br>Client:<br> Context: default<br> Debug Mode: false<br>Server:<br> Containers: 0<br> Running: 0<br> Paused: 0<br> Stopped: 0<br> Images: 0<br> Server Version: 20.10.17<br> Storage Driver: overlay2<br> Backing Filesystem: xfs<br> Supports d_type: true<br> Native Overlay Diff: true<br> userxattr: false<br> Logging Driver: json-file<br> Cgroup Driver: cgroupfs<br> Cgroup Version: 1<br> Plugins:<br> Volume: local<br> Network: bridge host ipvlan macvlan null overlay<br> Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog<br> Swarm: inactive<br> Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc<br> Default Runtime: runc<br> Init Binary: docker-init<br> containerd version: 9cd3357b7fd7218e4aec3eae239db1f68a5a6ec6<br> runc version: 5fd4c4d144137e991c4acebb2146ab1483a97925<br> init version: de40ad0<br> Security Options:<br> seccomp<br> Profile: default<br> Kernel Version: 5.10.165–143.735.amzn2.x86_64<br> Operating System: Amazon Linux 2<br> OSType: linux<br> Architecture: x86_64<br> CPUs: 1<br> Total Memory: 964.8MiB<br> Name: ip-172–31–27–244.eu-central-1.compute.internal<br> ID: VQRN:EH7L:TK32:FZHR:35WC:LTIA:VVZ4:MYZY:SQFZ:J4FI:OF6K:ADB2<br> Docker Root Dir: /var/lib/docker<br> Debug Mode: false<br> Registry: https://index.docker.io/v1/<br> Labels:<br> Experimental: false<br> Insecure Registries:<br> 127.0.0.0/8<br> Live Restore Enabled: false</pre><p>### Deploy a container image</p><p>1. Let’s create an _index.html_ that will be hosted on our Apache container</p><pre><br>&lt;html&gt;<br>&lt;head&gt;<br> &lt;title&gt;<br> Tanushree&#39;s Docker test<br> &lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br> &lt;b&gt;Hello World! This is my first Docker run!&lt;/b&gt;<br>&lt;body&gt;<br>&lt;/html&gt;</pre><p>2. Let’s create our first ever **Dockerfile**<br>This is a simple Dockerfile, that is pulling the httpd:2.4 image from Dockerhub, and copying _index.html_ from our EC2 file system to the apache docs hosting path.</p><pre>FROM httpd:2.4<br>COPY index.html /usr/local/apache2/htdocs/index.html</pre><p>3. Now we build our Docker image based on this _Dockerfile_</p><p>`docker build -t &lt;name-to-be-assigned-to-the-image&gt; &lt;path to Dockerfile&gt;`</p><p>-t : defines the &lt;name&gt;:&lt;tag&gt; for the docker image. (If no tag is defined, the default tag _latest_ gets assigned)<br>(.)period : the path where Dockerfile is present (period represents the current directory)</p><p>Example:</p><pre>[ec2-user@ip-172–31–27–244 ~]$ docker build -t apache-docker-example .<br>Sending build context to Docker daemon 13.31kB<br>Step 1/2 : FROM httpd:2.4<br>2.4: Pulling from library/httpd<br>bb263680fed1: Pull complete<br>9e8776e4b876: Pull complete<br>f506d7aab652: Pull complete<br>05289ee4f284: Pull complete<br>b7f64f2f8747: Pull complete<br>Digest: sha256:db2d897cae2ad67b33435c1a5b0d6b6465137661ea7c01a5e95155f0159e1bcf<br>Status: Downloaded newer image for httpd:2.4<br> - -&gt; 3a4ea134cf8e<br>Step 2/2 : COPY index.html /usr/local/apache2/htdocs/index.html<br> - -&gt; ff35af99cd38<br>Successfully built ff35af99cd38<br>Successfully tagged apache-docker-example:latest<br>[ec2-user@ip-172–31–27–244 ~]$</pre><p>4. Verify if the image got created</p><pre>docker images</pre><p>This command lists the details of all available Docker images in our local<br>Example:</p><pre>[ec2-user@ip-172–31–27–244 ~]$ docker images<br>REPOSITORY TAG IMAGE ID CREATED SIZE<br>apache-docker-example latest ff35af99cd38 29 seconds ago 145MB<br>httpd 2.4 3a4ea134cf8e 2 weeks ago 145MB<br>hello-world latest feb5d9fea6a5 17 months ago 13.3kB<br>centos latest 5d0da3dc9764 17 months ago 231MB<br>[ec2-user@ip-172–31–27–244 ~]$</pre><p>5. Run the docker container from the docker image created in step 3</p><pre>docker run -d - name &lt;assign-name-to-container&gt; -p &lt;local-port&gt;:&lt;remote-port&gt; &lt;image-name&gt;</pre><p>-d : to run as a daemon process<br> -p: for port mapping. mapping local port 80, to docker internal port 80</p><pre>[ec2-user@ip-172–31–27–244 ~]$ docker run -d - name helloworld -p 80:80 apache-docker-example<br>5c8e630daf7ad4843bccddf27eb44c7c4711ec02e9dfdc77de8bc25bbf75e0b4<br>[ec2-user@ip-172–31–27–244 ~]$</pre><p>6. Check running Docker processes</p><pre>docker ps</pre><p>Lists the running docker process and associated details.<br>Example:</p><pre>[ec2-user@ip-172–31–27–244 ~]$ docker ps<br>CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES<br>5c8e630daf7a apache-docker-example &quot;httpd-foreground&quot; 2 hours ago Up 2 hours 0.0.0.0:80-&gt;80/tcp, :::80-&gt;80/tcp helloworld<br>[ec2-user@ip-172–31–27–244 ~]$</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*doSZ2zcBAuKbEEQtPowbeA.png" /></figure><p>7. Launch the EC2 public I.P address on port 80 in a web browser to verify if apache was successfully installed and see if our index.html was hosted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*teVIndBie3eBwwpRDSvmYg.jpeg" /></figure><p>8. To stop a docker process</p><pre>docker stop &lt;docker-container-name&gt;</pre><p>Example: `docker stop alexis_docker`<br> <br>### Push container image to Docker Registry</p><p>i. Create a Dockerhub account on the Docker [website](<a href="https://hub.docker.com/">https://hub.docker.com/</a>)</p><p>ii. Login to dockerhub from your EC2 instance</p><pre>docker login</pre><p>Enter the Docker user name and password created in (i) when prompted. This will store your credentials in /home/ec2-user/.docker/config.json.<br> _Note:_ it is not a recommended practice to store credentials plainly, rather in a secrets store. (I still need to study up how to configure this with AWS Secrets Manager. )</p><p>iii. Tag the docker image we wish to push to Dockerhub against our account</p><pre>docker tag &lt;image-name&gt;:&lt;assigned-tag&gt; &lt;dockerhub-username&gt;/&lt;name-you-wish-to-assign&gt;:&lt;tag-you-wish-to-assign</pre><p>Example:</p><pre>docker tag apache-docker-example:latest akhlab/apache-docker-example:latest</pre><p>iv. Push the image to Dockerhub</p><pre>docker push &lt;dockerhub-username&gt;/&lt;name-you-assigned-in-step-iii&gt;:&lt;tag-you-assigned-in-step-iii&gt;</pre><p>Example:</p><pre>docker push akhlab/apache-docker-example:latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZMtTMUt-eAPim5JLTd0GWQ.jpeg" /></figure><p>v. Verify the image availability in your DockerHub account</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgHCYma-h3IYMqXdzHDLzw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5024ddd40d09" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>