<?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 infradm on Medium]]></title>
        <description><![CDATA[Stories by infradm on Medium]]></description>
        <link>https://medium.com/@infradm?source=rss-d47dc963b4e6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q_bLNkUhTml5XMtc9cPVfA.png</url>
            <title>Stories by infradm on Medium</title>
            <link>https://medium.com/@infradm?source=rss-d47dc963b4e6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 09:06:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@infradm/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[AWS EC2 Deployment, Monitoring, and Troubleshooting]]></title>
            <link>https://aws.plainenglish.io/aws-ec2-deployment-monitoring-and-troubleshooting-cabf086e42fd?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cabf086e42fd</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[system-administration]]></category>
            <category><![CDATA[ec2]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 11:17:56 GMT</pubDate>
            <atom:updated>2026-11-21T14:00:27.661Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgKHppMuwQ94cmRF91jJcQ.png" /></figure><p>One of the principles of IT infrastructure is observability, which means system administrators should be able to see what is happening inside their systems. Minimizing blind spots is part of a system administrator’s responsibility, so they are prepared for threats that may appear. In addition, scalability must be considered. As an organization grows, its system must scale up to meet its needs. By implementing an easy-to-scale monitoring system, we can reduce the time spent reconfiguring it. Grafana and Prometheus are good examples of tools that provide this flexibility. Besides this, the stack offers another advantage: its core components are open source. Ease of operation and configuration is another reason why this stack has millions of users.</p><p>Another important consideration is understanding the common issues that frequently appear in infrastructure. Issues such as misconfiguration, full disks, spikes in memory usage, and high CPU usage must be anticipated. Not only is fixing issues important, but documenting the issues that arise in the system is also essential. Consequently, similar issues can be resolved quickly using a consistent procedure. Understanding recurring issues helps uncover their root causes so they can be fixed, making the system more sustainable and minimizing downtime.</p><p>In this article, we will explore EC2 (Amazon Elastic Compute Cloud), a popular cloud service provided by AWS. EC2 gives developers the flexibility to choose from various types of virtual machines with different specifications, and from a variety of operating system images, called Amazon Machine Images (AMIs), based on their needs. To simplify the deployment, we will use Pulumi, a multi-language Infrastructure as Code (IaC) tool. By implementing IaC, we make infrastructure more consistent and reduce human error during the deployment phase. After that, we will set up Grafana, Prometheus, and Alertmanager to monitor the instance and send alerts whenever critical issues arise. Once Alertmanager is ready, we will simulate alerts firing and troubleshoot each issue step by step.</p><h3>EC2 Deployment Using Pulumi</h3><h4>Get AWS Access Key</h4><ol><li>Go to the AWS dashboard &gt; IAM &gt; User and create new one.</li><li>Grant AdministratorAccess to the user &gt; click next &gt; click Create User.</li><li>After the user is created, go to AWS Dashboard &gt; IAM &gt; click the user. In Access Keys section click on Create Access Key.</li><li>in a Use Case section select Local Code, click next &gt; create Access Key.</li><li>secure the Access Key ID and secret Access Key.</li></ol><blockquote><strong>Note :</strong> We use AdministratorAccess here to keep it simple, but in production you should implement the principle of least privilege. The permissions needed for this project are listed in the section “Generate Policy Using CloudTrail” of <a href="https://infradm.medium.com/implementing-least-privilege-on-aws-70d3e72ec630?sharedUserId=infradm">Implementing Least Privilege on AWS</a>.</blockquote><h4>Create Pulumi Project</h4><p>1. For Linux install Pulumi by running this command :</p><pre>curl -fsSL https://get.pulumi.com | sh</pre><p>2. run this command to add pulumi binary to $PATH variable :</p><pre>echo &#39;export PATH=$HOME/.pulumi/bin:$PATH&#39; &gt;&gt; ~/.bashrc &amp;&amp; source ~/.bashrc</pre><p>3. Initialize the Pulumi project by executing this command :</p><pre>mkdir &lt;project name&gt; &amp;&amp; cd &lt;project name&gt; &amp;&amp; \<br>pulumi new aws-python --name &lt;project name&gt; --yes</pre><p>4. Pulumi will create venv and activate it, but if it is not active yet activate it first and then install few Python3 library :</p><pre>source venv/bin/activate &amp;&amp; \<br>pip3 install bcrypt PyYAML</pre><p>5. Write __main__.py write this code :</p><pre># __main__.py<br><br>import os<br>import yaml<br>import subprocess<br>import bcrypt<br>import pulumi_aws <br><br># Get local Variable<br>local_vars = os.environ<br><br># create node_exporter yaml<br>command_generate_crt = &#39;openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout /etc/node_exporter/server.key -out /etc/node_exporter/server.crt -subj &quot;/C=US/ST=Indonesia/L=Yogyakarta&quot;&#39;<br>node_exporter_config_dir = &quot;/etc/node_exporter/&quot;<br>node_exporter_cert_file = os.path.join(node_exporter_config_dir, &quot;server.crt&quot;)<br>node_exporter_key_file = os.path.join(node_exporter_config_dir, &quot;server.key&quot;)<br>node_exporter_web_config = &quot;node_exporter_conf/web-config.yml&quot; # this is a local path so it stored on node_exporter_conf<br><br>hashed_password = bcrypt.hashpw(local_vars[&quot;NODE_EXPORTER_PLAIN_PASSWORD&quot;].encode(&quot;utf-8&quot;), bcrypt.gensalt(rounds=12))<br><br>node_exporter_conf = {<br>    &quot;tls_server_config&quot; : {<br>        &quot;cert_file&quot; : node_exporter_cert_file,<br>        &quot;key_file&quot;  : node_exporter_key_file<br>    },<br>    &quot;basic_auth_users&quot; : {<br>        local_vars[&quot;NODE_EXPORTER_USER&quot;] : hashed_password.decode(&quot;ascii&quot;).replace(&quot;$&quot;, &quot;\\$&quot;)<br>    }<br>}<br><br>str_node_exporter_conf = yaml.dump(node_exporter_conf, default_flow_style=False, indent=4, width=80)<br><br># storing configuration to user_data<br>user_data = f&quot;&quot;&quot;#!/usr/bin/bash<br><br>version={local_vars[&#39;NODE_EXPORTER_VERSION&#39;]}<br><br># download copy configuration<br>sudo mkdir /etc/node_exporter/<br>sudo {command_generate_crt}<br><br># creates node_exporter configuration<br>cat &gt; /etc/node_exporter/web-config.yml &lt;&lt; EOF<br>{str_node_exporter_conf}<br>EOF<br><br># download and install from tarbal<br>tarbal=node_exporter-$version.linux-amd64.tar.gz<br>extracted_dir=node_exporter-$version.linux-amd64<br>url=https://github.com/prometheus/node_exporter/releases/download/v$version/$tarbal<br><br>wget $url<br><br>tar -xvf $tarbal <br>sudo mv $extracted_dir/node_exporter /usr/local/bin/<br><br># crating systemd to maintain node_exporter<br>cat &gt; /etc/systemd/system/node_exporter.service &lt;&lt;EOF<br>[Unit]<br>Description=Node Exporter<br><br>[Install]<br>WantedBy=multi-user.target<br><br>[Service]<br>Type=simple<br>ExecStart=/usr/local/bin/node_exporter --web.config.file=/etc/node_exporter/web-config.yml<br>Restart=always<br>EOF<br><br>sudo systemctl daemon-reload <br>sudo systemctl enable node_exporter --now<br>&quot;&quot;&quot;<br><br># Create key pair for SSH connection to the instance<br>imported_key_pair = pulumi_aws.ec2.KeyPair(<br>    &quot;importedKeyPair&quot;,<br>    key_name=&quot;local user public key&quot;,<br>    public_key=local_vars[&quot;PUBLIC_KEY&quot;]<br>)<br><br>#Security policy to allow port 22 (ssh) and 9100 (node_exporter)<br>security_group = pulumi_aws.ec2.SecurityGroup(&#39;security_group_ssh_node_exporter&#39;,<br>    description=&#39;Enable SSH access &amp; node_exporter port&#39;,<br>    ingress=[<br>        {&#39;protocol&#39;: &#39;tcp&#39;, &#39;from_port&#39;: 22, &#39;to_port&#39;: 22, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]},<br>        {&#39;protocol&#39;: &#39;tcp&#39;, &#39;from_port&#39;: 9100, &#39;to_port&#39;: 9100, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]}<br>    ],<br>    egress=[<br>            {&#39;protocol&#39;: -1, &#39;from_port&#39;: 0, &#39;to_port&#39;: 0, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]}<br>    ]<br>)<br><br># Create an EC2 instance. Replace ami with an AMI ID valid in your region.<br>ec2_instance = pulumi_aws.ec2.Instance(local_vars[&quot;AWS_EC2_INSTANCE_NAME&quot;],<br>    ami=local_vars[&quot;AWS_EC2_AMI&quot;],    <br>    instance_type=local_vars[&quot;AWS_EC2_INSTANCE_TYPE&quot;],<br>    security_groups=[security_group.name],<br>    key_name=imported_key_pair.id,<br>    user_data=user_data,<br>    tags={<br>        &quot;Name&quot;: &quot;Example of EC2 deployment with Pulumi&quot;<br>    }<br>)</pre><blockquote><strong>Note : </strong>You can change the certificate creation command by modifying command_generate_crt variable.</blockquote><p>6. create file environment.sh and grant execution permisions :</p><pre>touch environment.sh &amp;&amp; chmod 700 environment.sh</pre><p>7. Write toenvironment.sh change this example based on your need, and notice that I assume the public key is stored in ~/.sh/id_rsa.pub . You need to change this to the path of string value of your public key :</p><pre>#!/usr/bin/bash<br><br>export AWS_ACCESS_KEY_ID=&quot;&quot;<br>export AWS_SECRET_ACCESS_KEY=&quot;&quot;<br>export AWS_REGION=&quot;us-east-1&quot;<br>export AWS_EC2_AMI=&quot;ami-0b6d9d3d33ba97d99&quot; # jammy jellyfish<br>export AWS_EC2_INSTANCE_TYPE=&quot;t3.micro&quot;<br>export AWS_EC2_INSTANCE_NAME=&quot;example_server_1&quot;<br>export AWS_EC2_USER=&quot;ubuntu&quot;<br><br>export PUBLIC_KEY=$(cat ~/.ssh/id_rsa.pub)<br><br>export NODE_EXPORTER_VERSION=&quot;1.12.1&quot;<br>export NODE_EXPORTER_USER=&quot;admin&quot;<br>export NODE_EXPORTER_PLAIN_PASSWORD=&quot;AdminPassword123!&quot;</pre><p>8. Execute this command to apply the project :</p><pre>source environment.sh &amp;&amp; pulumi up</pre><h3>Setting up Monitoring Stack : Installing Grafana, Prometheus and Alertmanager</h3><p><strong>Project Structure :</strong></p><pre>./docker-compose.yml<br>./prometheus<br>./prometheus/prometheus.yml<br>./prometheus/rules<br>./prometheus/rules/node_alerts.yml<br>./alertmanager<br>./alertmanager/config.yml</pre><p><strong>Docker Configuration</strong></p><p>1 . Write docker-compose.yml</p><pre> # ./docker-compose.yml<br>services:<br>  alertmanager:<br>    image: prom/alertmanager:latest<br>    container_name: alertmanager<br>    volumes:<br>      - ./alertmanager:/etc/alertmanager<br>    ports:<br>      - &quot;9093:9093&quot;<br>    command:<br>      - &quot;--config.file=/etc/alertmanager/config.yml&quot;<br>      - &quot;--storage.path=/alertmanager&quot;<br>      - &quot;--cluster.listen-address=&quot;<br>    restart: unless-stopped<br>  prometheus:<br>    image: prom/prometheus:latest<br>    volumes:<br>      - ./prometheus:/etc/prometheus<br>    ports:<br>      - &quot;9090:9090&quot;<br>  grafana:<br>    image: grafana/grafana:latest<br>    environment:<br>      - GF_SECURITY_ADMIN_USER=admin<br>      - GF_SECURITY_ADMIN_PASSWORD=admin<br>    ports:<br>      - &quot;3000:3000&quot;<br>    volumes:<br>      - grafana-storage:/var/lib/grafana/<br><br>volumes:<br>  grafana-storage:</pre><blockquote><strong>Note :</strong> change GF_SECURITY_ADMIN_USER andGF_SECURITY_ADMIN_PASSWORDthese will be used to login to grafana dashboard</blockquote><p><strong>Alertmanagers Configuration</strong></p><ol><li>Write Alertmanagers configuration</li></ol><pre># ./alertmanager/config.yml<br><br>global:<br>  telegram_bot_token: &lt;TELEGRAM_BOT_TOKEN&gt;<br><br>route:<br>  # Default receiver<br>  receiver: &#39;telegram-bot&#39;<br><br>  # grouping<br>  group_wait: 3s<br>  group_interval: 20s<br>  repeat_interval: 20s<br>  group_by: [ alertname ]<br><br>receivers:<br>  - name: &quot;telegram-bot&quot;<br>    telegram_configs:<br>      - chat_id: -100&lt;CHAT ID OF THE GROUP&gt;<br>        bot_token: &lt;TELEGRAM_BOT_TOKEN&gt;</pre><p><strong>Prometheus Configuration</strong></p><ol><li>Write prometheus configuration</li></ol><pre># ./prometheus/prometheus.yml<br><br># Alertmanager configuration<br>alerting:<br>  alertmanagers:<br>    - scheme: http<br>      static_configs:<br>        - targets: [ &#39;alertmanager:9093&#39; ]<br><br># Load rules once and periodically evaluate them<br>rule_files:<br>  - &quot;rules/*.yml&quot;<br><br>scrape_configs:<br>  - job_name: &#39;prometheus&#39;<br>    static_configs:<br>      - targets: [&#39;prometheus:9090&#39;]<br><br>  - job_name: &#39;node_exporter&#39;<br>    static_configs:<br>      - targets: [&#39;&lt;EC2 Public IP or DNS&gt;:9100&#39;]<br>    scheme: &#39;https&#39;<br>    basic_auth:<br>      username: &#39;admin&#39;<br>      password: &#39;AdminPassword123!&#39;<br>    tls_config:<br>      insecure_skip_verify: true</pre><blockquote><strong>Note : </strong>change &lt;EC2 Public IP or DNS&gt; to your EC2 instance’s public IP address or DNS name.</blockquote><p>2. Write prometheus alert rule :</p><pre># ./prometheus/rules/node_alerts.yml<br><br>groups:<br>  - name: node_alerts<br>    rules:<br>      - alert: HighCPULoad<br>        expr: 100 - (avg by(instance) (irate(node_cpu_seconds_total{mode=&quot;idle&quot;}[5m])) * 100) &gt; 80<br>        for: 5m<br>        labels:<br>          severity: warning<br>        annotations:<br>          summary: &quot;High CPU load on instance : (instance {{ $labels.instance }})&quot;<br>          description: &quot;CPU load is &gt; 80%\n  VALUE = {{ $value }}%\n  LABELS: {{ $labels }}&quot;<br><br>      - alert: HighMemoryLoad<br>        expr: (node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes * 100 &gt; 80<br>        for: 5m<br>        labels:<br>          severity: warning<br>        annotations:<br>          summary: &quot;High memory load on instance : (instance {{ $labels.instance }})&quot;<br>          description: &quot;Memory load is &gt; 80%\n  VALUE = {{ $value }}%\n  LABELS: {{ $labels }}&quot;<br><br>      - alert: HighDiskUsage<br>        expr: (node_filesystem_size_bytes{fstype=~&quot;ext4|xfs&quot;} - node_filesystem_free_bytes{fstype=~&quot;ext4|xfs&quot;}) / node_filesystem_size_bytes{fstype=~&quot;ext4|xfs&quot;} * 100 &gt; 90<br>        for: 5m<br>        labels:<br>          severity: warning<br>        annotations:<br>          summary: &quot;High disk usage on instance : (instance {{ $labels.instance }})&quot;<br>          description: &quot;Disk usage is &gt; 90%\n  VALUE = {{ $value }}%\n  LABELS: {{ $labels }}&quot;</pre><p><strong>Start Monitoring stack</strong></p><p>1 . run docker compose</p><pre>docker compose up -d</pre><p>2. login to grafana dashboard <a href="http://localhost:3000/"><em>http://localhost:3000/</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4FjEGhzpXHIy8k5otnXkrA.png" /><figcaption>login to grafana dashboard</figcaption></figure><p>3. Import dashboard template for node exporter, in <em>Dashboard &gt; Import Dashboard</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VfbiIOAf4lnR4mRpHKuFJg.png" /><figcaption>Import Dashboard</figcaption></figure><p>4. This is the example of Grafana dashboard from our imported grafana template.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gak2zDoBBi3vT2ztqHYdBQ.png" /><figcaption>Node Exporter Dashboard</figcaption></figure><p>5. We can check the alert rule on prometheus web UI (<em>http://localhost:9090/alerts</em>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNW_avPolNHm3VX9OFDMCw.png" /><figcaption>Alert Rule</figcaption></figure><h3>Simulating Common Issue and Step-by-Step Troubleshooting</h3><h4><strong>High CPU Load</strong></h4><p><strong>Description : </strong>High CPU load, can affect service performance. For example, when executing certain features, a service may take a long time, or become unresponsive. In this chase, the alert fires and sent to Telegram group.</p><p><strong>Step to Reproduce :</strong></p><ol><li>install stress : sudo apt install stress</li><li>run stress to consume N number of cpu : stress --cpu &lt;N&gt;</li></ol><p><strong>Troubleshooting :</strong></p><ol><li>Check a real-time view of running processes using top or htop (you need to install htop first). Alternatively you can check the top 10 process consuming the most CPU by executing : ps aux --sort=-%cpu | head -11 ,-%cpu in --sort means sort by cpu in descending.</li><li>If you find the service that consume much of CPU, you can tune or reconfigure it to consume CPU efficiently. If the processes are unecessary, you can teriminate the service that inititating them. If there is no way to reducing CPU usage of the service, the only option is to upgrade the VM. In our case we can upgrade the instance type by refering <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html">this documentation</a>.</li></ol><h4><strong>High Memory Usage</strong></h4><p><strong>Description : </strong>Similar as high CPU symptom, high memory usage can be affecting service performancce causing response to become very slow or even unresponsive.</p><p><strong>Step to Reproduce :</strong></p><ol><li>install stress : sudo apt install stress</li><li>run stress to consume <em>N</em> number of cpu : stress --vm &lt;N worker&gt; --vm-bytes &lt;N memory allocation per worker&gt;M for example : stress --vm 4 --vm-bytes 1024M</li></ol><p><strong>Troubleshooting :</strong></p><ol><li>Check memory usage using the free -g command (which shows usage in gibibytes, or use -m for mebibytes or -k for kibibytes). Alternatively, you can check the top 10 memory-consuming processes by executing: ps aux --sort=-%mem | head -11.</li><li>If you find the service consuming excessive memory, you can tune or reconfigure it to use memory more efficiently. If there is no way to reduce its memory usage or terminate unused processes, the only option is to upgrade the VM. In our case, we can upgrade the EC2 instance type by referring <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html">this documentation</a>.</li></ol><h4><strong>Disk Full</strong></h4><p><strong>Description : </strong>If disk full issue can cause services freeze or errors to occur when writing a file.</p><p><strong>Step to Reproduce :</strong></p><p>Create a file with <em>N</em> mebibytes size with name filename : dd if=/dev/zero of=filename bs=&lt;N&gt;M count=1</p><p><strong>Troubleshooting :</strong></p><ol><li>Execute df -h to show disk usage in human-readable format. If the command shows available space but errors still occur, execute df -i to check inode usage. An inode (index node) serves as a unique identifier for a specific piece of metadata on a given filesystem. The df -i command provides IUse% and free inode columns to show inode utilization.</li><li>Find files larger than a specified mebibyte size by executing: find &lt;dir&gt; -size +&lt;X&gt;M. For example, to find files larger than 100 mebibytes in the home directory, execute: find ~ -size +100M.</li><li>Find the inode number of a file by executing: ls -il &lt;filename&gt;, or check inodes for all files in a directory using ls -il &lt;dir&gt;. Also, you can check total inode in a directory by executing : ls -idl .</li></ol><h4><strong>Service Inaccesible</strong></h4><p><strong>Description : </strong>There are a few thing that might cause this error : Service down, a misconfigured security group of the EC2, or the EC2 instance is down.</p><p><strong>Step to Reproduce : </strong>kill the service, Block incoming traffic in the EC2 security policy, or shut down the EC2 instance.</p><p><strong>Troubleshooting :</strong></p><ol><li>Identify the root cause, first access the EC2 instance by using SSH or the AWS dashboard to check either instance is running.</li><li>If there is no problem with the instance, check if the service is running. We can check it using : ps -ef | grep “&lt; exec start command&gt;” , or you can use a specific command that depends on your environment, for example for Docker : docker ps it will list all running container on the machine. Then check the service log to diagnose why the service stopped.</li><li>If the service is running but users still cannot access the service, you need to check the security group of the instance, is it allows external traffic to the port of the service.</li></ol><h3>Issue Collection</h3><h4>Cannot Connect to EC2 SSH or Reach the Node Exporter Endpoints.</h4><p><strong>Description : </strong>When making SSH connection to the instance takes very long time to connect.</p><p><strong>Step to Reproduce : </strong>Use the default security group for the EC2 instance.</p><p><strong>Troubleshooting :</strong></p><ol><li>Go to Aws EC2 dashboard &gt; EC2, then click the instance name.</li><li>Scroll down. You will find security group in the left side of the dashboard.</li><li>click the security group (Under Network &amp; Security section), then click the security group of your instance.</li><li>Go to inbound rules and add rules, in this imagebelow, there are 2 rules that we need for this setup.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w8tmqY7NEykPdIZxFnG1yw.png" /><figcaption>EC2 Inbound Rules</figcaption></figure><p>in this case we are using pulumi to create these ingress rule, we also add one egress so the EC2 instance can accessing public domain.</p><pre>security_group = pulumi_aws.ec2.SecurityGroup(&#39;security_group_ssh_node_exporter&#39;,<br>    description=&#39;Enable SSH access &amp; node_exporter port&#39;,<br>    ingress=[<br>        {&#39;protocol&#39;: &#39;tcp&#39;, &#39;from_port&#39;: 22, &#39;to_port&#39;: 22, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]},<br>        {&#39;protocol&#39;: &#39;tcp&#39;, &#39;from_port&#39;: 9100, &#39;to_port&#39;: 9100, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]}<br>    ],<br>    egress=[<br>            {&#39;protocol&#39;: -1, &#39;from_port&#39;: 0, &#39;to_port&#39;: 0, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]}<br>    ]<br>)</pre><h4>EC2 Cannot Access Public Domain</h4><p><strong>Description : </strong>The instance does not get a reply when pinging to github.com.</p><p><strong>Step to Reproduce : </strong>Use a misconfigured egress rule in pulumi code.</p><p><strong>Troubleshooting :</strong></p><ol><li>Go to the AWS EC2 dashboard &gt; EC2, then click the instance name.</li><li>Scroll down. You will find the security group on the left side of the dashboard.</li><li>Click the security group (under the Network &amp; Security section), then click the security group of your instance.</li><li>Go to Outbound rules and add the rule that we need for this setup, as shown in the image below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hbWzwn7w7TQl7Bu-NHn5hw.png" /><figcaption>EC2 Outbound rules</figcaption></figure><p>In this case, we are using Pulumi to create this egress rule:</p><pre>security_group = pulumi_aws.ec2.SecurityGroup(&#39;security_group_ssh_node_exporter&#39;,<br>    description=&#39;Enable SSH access &amp; node_exporter port&#39;,<br>    ingress=[<br>        {&#39;protocol&#39;: &#39;tcp&#39;, &#39;from_port&#39;: 22, &#39;to_port&#39;: 22, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]},<br>        {&#39;protocol&#39;: &#39;tcp&#39;, &#39;from_port&#39;: 9100, &#39;to_port&#39;: 9100, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]}<br>    ],<br>    egress=[<br>            {&#39;protocol&#39;: -1, &#39;from_port&#39;: 0, &#39;to_port&#39;: 0, &#39;cidr_blocks&#39;: [&#39;0.0.0.0/0&#39;]}<br>    ]<br>)</pre><h4>Malformed bcrypt Password Hash in node_exporter</h4><p><strong>Description :</strong> The hashed password string in web-config.yml and generated password from __main__.py are different.</p><p><strong>Step to Reproduce : </strong>in __main__.py change hashed_password.decode(“ascii”).replace(“$”, “\\$”) to hashed_password.decode(“ascii”)</p><p><strong>Troubleshooting :</strong></p><p>The password goes trough this chain : the plain password in environment.sh &gt; encrypted using bcrypt in __main__.py &gt; written into user_data which is executed when EC2 instance is deployed &gt; the user_data script, will write node_exporter web-config.yml . The problem is that user_data script write hashed password to the web-config.yml because user_data are executed as bash script : $ character in the hashed password are interpreted as bash variable. To prevent this in the __main__.py we need to replace $ with \$ :</p><pre>hashed_password.decode(&quot;ascii&quot;).replace(&quot;$&quot;, &quot;\\$&quot;)</pre><h3>Conclusion</h3><p>IaC (Infrastructure as Code) is used for infrastructure deployment, and it promises consistency and reduces the chance of human error. We use Pulumi to deploy an EC2 instance and install node_exporter on it. We configure node_exporter to use TLS for connections and protect it with a password. Grafana, Prometheus, and Alertmanager are installed in our local environment.</p><p>In the environment we built, we set up alert rules for several cases. Prometheus evaluates these rules continuously, and Alertmanager notifies us 24/7, so problems are less likely to go unnoticed.</p><p>The last section covers a few common problems and the steps to solve them. It also describes a few errors we encountered while building this project, which we hope will enrich our knowledge and serve as a clear guide whenever those issues arise.</p><p>Thanks for reading my article, if you’re interested in collaboration please contact me by email in my bio.</p><p>Support me by buying me a coffee !</p><figure><a href="https://buymeacoffee.com/infradm"><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EndYHes_Cgr_dApP.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cabf086e42fd" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/aws-ec2-deployment-monitoring-and-troubleshooting-cabf086e42fd">AWS EC2 Deployment, Monitoring, and Troubleshooting</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[Implementing Least Privilege On AWS]]></title>
            <link>https://aws.plainenglish.io/implementing-least-privilege-on-aws-70d3e72ec630?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/70d3e72ec630</guid>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[system-administration]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Thu, 15 Oct 2026 11:13:05 GMT</pubDate>
            <atom:updated>2026-10-15T11:18:42.405Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgKHppMuwQ94cmRF91jJcQ.png" /></figure><p>If IT infrastructure is like a mansion, system administrators are its gatekeepers. They are responsible for securing the gate and for letting in only the guests who are invited. Even then, each guest should be allowed into only the rooms they need. Limiting each guest’s access prevents intruders from reaching important resources through a guest’s credentials, and it keeps users who have no need for those resources from accidentally breaking the infrastructure.</p><p>This is the principle of least privilege. It asserts that users and applications should be granted access only to the data and operations they need to do their jobs. In AWS, this principle can be implemented by creating a custom IAM policy that allows only the necessary actions and attaching it to a user or role. Here is an example of a custom policy that allows access to EC2 resources only.</p><h3>Create s Custom Role That Has Access Only to EC2</h3><ol><li>Got to the AWS dasboard &gt; IAM &gt; Roles, then click <em>Create role</em>.</li></ol><p>2. In the <em>select trusted entity </em>tab, choose <em>custom trust entity</em>, then paste this policy to the JSON field. Then click <em>Next</em>.</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;Statement&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: {<br>                &quot;AWS&quot;: &quot;arn:aws:iam::&lt;acccount-id&gt;:user/&lt;account-name&gt;&quot;<br>            },<br>            &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>        }<br>    ]<br>}</pre><p>3. In the <em>Add permission</em> tab give full permissions to EC2 with this policy.</p><pre>{<br> &quot;Version&quot;: &quot;2012-10-17&quot;,<br> &quot;Statement&quot;: [<br>  {<br>   &quot;Sid&quot;: &quot;Statement1&quot;,<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Resource&quot;: &quot;*&quot;,<br>   &quot;Action&quot;: &quot;ec2:*&quot;<br>  }<br> ]<br>}</pre><blockquote><strong>Note :</strong> If the role needs to cover more specific use case, such as launching instance, replace ec2:* to specific action.</blockquote><p>4. Enter the name of the role. in this case we named the role EC2Administrator.</p><p>5. Simulate the role by trying to create s3 bucket and launch EC2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wNlyXkRCTqR9Z5MLWdjFxg.png" /></figure><h3>Generate Policy Using CloudTrail</h3><p>A practical way to find all the permissions needed to run a procedure is to run it with full privileges and then generate a policy from the CloudTrail events.</p><p>1 . Create a CloudTrail trail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vg4aDLmyUdswQyvke4ATIA.png" /></figure><p>2. Run the procedure you want to get the permission for.</p><p>3. Go back to AWS dasboard &gt; IAM &gt; Users, then click on user that you used.</p><p>4. Click <em>Generate policy</em> under <em>Generate policy based on CloudTrail events</em>. Fill in the fields according to your environment. And don’t forget to limit the number of days based on your need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q7AHQ6YLHu6GF0yXRGDqdA.png" /></figure><p>5. In <em>Customize permissions</em> you can find all permission that were used</p><p>Here is an example of the policy needed to run project <a href="https://infradm.medium.com/aws-ec2-deployment-monitoring-and-troubleshooting-cabf086e42fd?sharedUserId=infradm">AWS EC2 Deployment, Monitoring, and Troubleshooting</a></p><pre>{<br> &quot;Version&quot;: &quot;2012-10-17&quot;,<br> &quot;Statement&quot;: [<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: [<br>    &quot;ec2:CreateTags&quot;,<br>    &quot;ec2:DescribeInstanceCreditSpecifications&quot;,<br>    &quot;ec2:DescribeInstanceTypes&quot;,<br>    &quot;ec2:DescribeInstances&quot;,<br>    &quot;ec2:DescribeTags&quot;,<br>    &quot;ec2:DescribeVolumes&quot;,<br>    &quot;ec2:DescribeVpcs&quot;,<br>    &quot;sts:GetCallerIdentity&quot;<br>   ],<br>   &quot;Resource&quot;: &quot;*&quot;<br>  },<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: [<br>    &quot;ec2:DescribeInstanceAttribute&quot;,<br>    &quot;ec2:RunInstances&quot;,<br>    &quot;ec2:TerminateInstances&quot;<br>   ],<br>   &quot;Resource&quot;: &quot;arn:aws:ec2:${Region}:${Account}:instance/${InstanceId}&quot;<br>  },<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: &quot;ec2:RunInstances&quot;,<br>   &quot;Resource&quot;: &quot;arn:aws:ec2:${Region}:${Account}:network-interface/${NetworkInterfaceId}&quot;<br>  },<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: &quot;ec2:RunInstances&quot;,<br>   &quot;Resource&quot;: &quot;arn:aws:ec2:${Region}:${Account}:security-group/${SecurityGroupId}&quot;<br>  },<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: &quot;ec2:RunInstances&quot;,<br>   &quot;Resource&quot;: &quot;arn:aws:ec2:${Region}:${Account}:subnet/${SubnetId}&quot;<br>  },<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: &quot;ec2:RunInstances&quot;,<br>   &quot;Resource&quot;: &quot;arn:aws:ec2:${Region}::image/${ImageId}&quot;<br>  },<br>  {<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: &quot;ssm:GetParameters&quot;,<br>   &quot;Resource&quot;: &quot;arn:aws:ssm:${Region}:${Account}:parameter/${ParameterNameWithoutLeadingSlash}&quot;<br>  }<br> ]<br>}</pre><h3>Conclusion</h3><p>Implementing least privilege reduces the risk to the system. By giving users only the permissions they need, we reduce the chance of accidents caused by human error. By using CloudTrail, we can easily find the permissions that a project needs.</p><p>Thanks for reading my article, if you’re interested in collaboration please contact me by email in my bio.</p><p>Support me by buying me a coffee !</p><figure><a href="https://buymeacoffee.com/infradm"><img alt="" src="https://cdn-images-1.medium.com/max/700/0*EndYHes_Cgr_dApP.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70d3e72ec630" width="1" height="1" alt=""><hr><p><a href="https://aws.plainenglish.io/implementing-least-privilege-on-aws-70d3e72ec630">Implementing Least Privilege On AWS</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[Installing a Private  GitLab Server on KVM With Terraform]]></title>
            <link>https://blog.stackademic.com/installing-a-private-gitlab-server-on-kvm-with-terraform-f85872935a41?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/f85872935a41</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[iac]]></category>
            <category><![CDATA[kvm]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 06:24:09 GMT</pubDate>
            <atom:updated>2026-10-09T09:29:05.407Z</atom:updated>
            <content:encoded><![CDATA[<h3>Installing a Private GitLab Server on KVM With Terraform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l0REyfk4bY1J3bYVQYRObg.png" /></figure><p>GitLab is one of the most popular version control platforms, used by millions of developers, it varies from solo developers for their personal projects and big companies. This popularity comes down to the features GitLab provides. These include:</p><ul><li>Being open source, GitLab-CE gives flexibility to run it privately, giving users full control over their environment.</li><li>Integrated CI/CD pipeline with a user-friendly configuration.</li><li>GitLab Runner to run CI/CD on a dedicated server separately.</li></ul><p>In this article we will integrate Terraform, an IaC tool that lets us set up infrastructure easily. Specifically we will use libvirt to create a VM in which we will install GitLab-CE.</p><h3>Stacks</h3><ul><li>KVM (virt-manager libvirt)</li><li>Ubuntu image (it is preferable to download it first, therefore we can reuse it)</li><li>Terraform / OpenTofu</li><li>cloud-init script (it will be used to configure the network, user, file creation, and script execution)</li></ul><p><strong>Note : </strong>You might wonder why Ansible isn’t part of this stack. Ansible is a powerful configuration management tool. But in this project we will only install one VM for a GitLab-CE server, so using Ansible seems overkill.</p><h3>How It Works</h3><p>Here is the workflow of this project:</p><ol><li>Initialize the Terraform project by executing terraform init.</li><li>After running terraform apply, the first thing that happens is checking required_provider.</li><li>Terraform will create a few volumes in .qcow2 format and one commoninit.iso disk. this is where the cloud-init configuration is stored.</li><li>The next step is libvirt domain creation. In this step the VM is created and once the domain created, the cloud-init configuration is injected.</li></ol><p>There are a few steps that are implemented through cloud-init:</p><ol><li>Network configuration which includes the IP, hostname, and gateway.</li></ol><p>2. User configuration: public SSH key of host user will be injected into the VM’s user account so the host user can make passwordless SSH connection.</p><p>3. Write automation scripts:</p><ul><li>install-docker.sh to add the keyring and repository, then install Docker.</li><li>install-docker-gitlab.sh to write Docker Compose file, configuration, and execute docker compose up.</li></ul><p>4. Executing automation script, and then file /opt/gitlab_install_finish is created to signal to Terraform that the cloud-init configuration is complete.</p><p>5. Terraform accesses the VM using the remote-exec provisioner, which runs a loop to check whether the file /opt/gitlab_install_finish exists.</p><h3>Jump into the project</h3><h4>Project Structure</h4><pre>./main.tf<br>./config<br>./config/cloud_init.cfg<br>./config/network_config.cfg</pre><h4>The code</h4><ol><li>main.tf</li></ol><pre>terraform {<br>  required_providers {<br>    # this is the provider that we will use to connect to libvirt<br>    libvirt = {<br>      source = &quot;dmacvicar/libvirt&quot;<br>      version = &quot;&lt;=0.8.3&quot;<br>    }<br>  }<br>}<br><br># libvirt provider configuration<br>provider &quot;libvirt&quot; {<br><br>  # libvirt uri<br>  uri = &quot;qemu:///system&quot;<br><br>}<br><br># local variable that we will use to configure<br>locals {<br>  vm_name = &lt;vm-name&gt; <br>  ip_addr = &lt;ip-address&gt;<br>}<br><br># qcow2 volume from ubuntuimage<br>resource &quot;libvirt_volume&quot; &quot;ubuntu_base&quot; {<br><br>  # name of the volume<br>  name   = &quot;gitlab_ubuntu.qcow2&quot;<br><br>  # this is path of ubuntu image that stored on local, <br>  # but you can change it to download link instead.<br>  source = &quot;../jammy-server-cloudimg-amd64.img&quot;<br>  <br>  format = &quot;qcow2&quot;<br>}<br><br># qcow2 volume that will be used as VM storage<br>resource &quot;libvirt_volume&quot; &quot;server_disk&quot; {<br><br>  # name of the volume<br>  name           = &quot;ubuntu-gitlab-disk.qcow2&quot;<br>  <br>  # size of the VM disk<br>  size           = 15740000000<br>  <br>  # id of the volume of the ubuntu (volume that created on previous block)<br>  base_volume_id = libvirt_volume.ubuntu_base.id<br>}<br><br># qcow2 volume from configuration file<br>resource &quot;libvirt_cloudinit_disk&quot; &quot;commoninit&quot; {<br>  name           = &quot;commoninit.iso&quot;<br><br>  # adding user_data configuration ftom config/cloud_init.cfg template<br>  # and fill hostname with local.vm_name<br>  user_data      = templatefile(&quot;config/cloud_init.cfg&quot;, { hostname = local.vm_name })<br>  <br>  # adding user_data configuration ftom config/network_config.cfg template<br>  # and fill ip_addr with local.ip_addr<br>  network_config = templatefile(&quot;config/network_config.cfg&quot;, { ip_addr = local.ip_addr })<br>}<br><br># VM instance creation<br>resource &quot;libvirt_domain&quot; &quot;vm&quot; {<br><br>  # VM name<br>  name      = local.vm_name<br>  <br>  # memory of the VM<br>  memory    = &quot;4096&quot;<br><br>  # VCPU of the VM<br>  vcpu      = 4<br><br>  # cloud init disk<br>  cloudinit = libvirt_cloudinit_disk.commoninit.id<br><br>  cpu {<br><br>    # host-passtrough allows the CPU visible to the guest virtual machine <br>    # exactly the same as the host physical machine CPU<br>    mode = &quot;host-passthrough&quot;<br>  }<br><br>  disk {<br>    # id of the server_disk / volume that we create as the VM storage<br>    volume_id = libvirt_volume.server_disk.id<br>    <br>    # SCSI (Small Computer System Interface) <br>    # used to connect and communicate <br>    # between computers and peripheral devices<br>    scsi      = &quot;true&quot;<br>  }<br><br>  network_interface {<br>    <br>    # bridge connection that will be used.<br>    bridge = &quot;virbr0&quot;<br>  }<br><br>  # Executing bash command remotely<br>  provisioner &quot;remote-exec&quot; {<br>    # command : checking until /opt/gitlab_install_finish<br>    #           is created. and stop when it already exist.<br>    inline = [<br>      &quot;while [ ! -f /opt/gitlab_install_finish ]; do sleep 2; done&quot;<br>    ]<br><br>    # connection configuration<br>    connection {<br><br>      # use SSH connection<br>      type        = &quot;ssh&quot;<br><br>      # username of VM <br>      user        = &lt;vm-user&gt;<br>      <br>      # this is private_key, the paired with public_key that we include through<br>      # cloudinit configuration       <br>      private_key = file(&quot;~/.ssh/id_rsa&quot;)<br><br>      # IP of the VM<br>      host        = local.ip_addr<br>    }<br>  }<br>}</pre><blockquote><strong>Note :</strong></blockquote><blockquote>&lt;vm-name&gt; : change with your VM name</blockquote><blockquote>&lt;ip-address&gt; : change with dedicated IP for the VM</blockquote><blockquote>&lt;vm-user&gt; : the user in the VM</blockquote><p>2. config/cloud_init.cfg</p><pre>#cloud-config<br><br># setup hostname, injected from main.tf<br>hostname: ${hostname}<br><br># ssh password authentication<br>ssh_pwauth: True<br><br># root config, take out this config to disable root<br>disable_root: false<br><br># Users config <br>users:<br>  - name: &lt;vm-user&gt;<br>    gecos: vm User<br>    groups: sudo, docker<br>    shell: /bin/bash<br>    sudo: [&#39;ALL=(ALL) NOPASSWD:ALL&#39;]<br>    ssh_authorized_keys:<br>      - &lt;public-key of your user&gt;<br><br># change the root password, <br># you can take out this part to not set up a root password<br>chpasswd:<br>  list: |<br>    root:root<br>  expire: false<br><br>write_files:<br><br>  # create the docker installation file<br>  - path: /opt/install-docker.sh<br><br>    # configure permissions to make it executable<br>    permissions: &#39;0755&#39;<br><br>    content: |<br>      #!/usr/bin/bash<br>      # shebang to execute the whole script:<br>      #     /opt/install-docker.sh = /usr/bin/bash /opt/install-docker.sh<br><br>      # install the requirement<br>      apt install ca-certificates curl gnupg<br><br>      # create a directory for the keyring and configure permission<br>      install -m 0755 -d /etc/apt/keyrings<br><br>      # curls the keyring and puts it in /etc/apt/keyrings/docker.gpg<br>      curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc<br>      chmod a+r /etc/apt/keyrings/docker.asc<br>      <br>      # add repository<br>      tee /etc/apt/sources.list.d/docker.sources &gt; /dev/null &lt;&lt;EOF<br>      Types: deb<br>      URIs: https://download.docker.com/linux/ubuntu<br>      Suites: $(. /etc/os-release &amp;&amp; echo &quot;$${UBUNTU_CODENAME:-$VERSION_CODENAME}&quot;)<br>      Components: stable<br>      Architectures: $(dpkg --print-architecture)<br>      Signed-By: /etc/apt/keyrings/docker.asc<br>      EOF<br><br>      # update to load repository<br>      apt update<br>      <br>      # install docker<br>      apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin<br>      docker-compose-plugin<br><br>  # create gitlab-ce installation file<br>  - path: /opt/install-docker-gitlab.sh<br><br>    # set permission to executable<br>    permissions: &#39;0755&#39;<br><br>    content: |<br>      #!/usr/bin/bash<br><br>      # installs gitlab<br>      docker pull gitlab/gitlab-ce:latest<br><br>      # create the docker project directory<br>      mkdir -p /opt/gitlab<br><br>      # write the file /opt/gitlab/docker-compose.yml<br>      cat &lt;&lt;EOF &gt; /opt/gitlab/docker-compose.yml<br><br>      # content of the file<br>      services:<br>          # gitlab server service<br>          gitlab:<br><br>              # gitlab-ce image<br>              image: &#39;gitlab/gitlab-ce:latest&#39;<br><br>              # container name<br>              container_name: gitlab<br><br>              # restart policy always, so docker will restart the container<br>              # no matter why the container stopped<br>              restart: always<br>              <br>              # hostname of the container<br>              hostname: &lt;hostname&gt;<br><br>              # environment variable<br>              environment:<br>                  # Gitlab config<br>                  GITLAB_OMNIBUS_CONFIG: |<br><br>                    # url that will be used by the user to accessing gitlab <br>                    # web ui<br>                    external_url &#39;https://&lt;hostname&gt;&#39;<br>                    <br>                    # enables letsencrypt to create  certificate<br>                    letsencrypt[&#39;enable&#39;] = true<br><br>                    # letsencrypt adminitration email<br>                    letsencrypt[&#39;contact_emails&#39;] = [&#39;&lt;admin-email@example.com&gt;&#39;]<br>                    <br>                    # auto renew policy<br>                    letsencrypt[&#39;auto_renew&#39;] = true<br><br>                    # Renew every 7th day of the month at 3 AM<br>                    letsencrypt[&#39;auto_renew_hour&#39;] = 3<br>                    letsencrypt[&#39;auto_renew_day_of_month&#39;] = &quot;*/7&quot;<br><br>                    # Configure SSH port<br>                    gitlab_rails[&#39;gitlab_shell_ssh_port&#39;] = 2222<br><br>                    # Disable Prometheus monitoring<br>                    prometheus_monitoring[&#39;enable&#39;] = false<br><br>                    # Disable the Container Registry if you do not need it<br>                    registry[&#39;enable&#39;] = false<br><br>                    # Reduce Puma workers (minimum 2)<br>                    puma[&#39;worker_processes&#39;] = 2<br><br>                    # Minimum threads for the puma<br>                    puma[&#39;min_threads&#39;] = 1<br><br>                    # maximum threads for the puma<br>                    puma[&#39;max_threads&#39;] = 4<br>              <br>              ports:<br>                # Gitlab port<br>                - &#39;8088:8088&#39;<br><br>                # forwarding HTTP port<br>                - &#39;80:80&#39;<br><br>                # forwarding HTTPS port<br>                - &#39;443:443&#39;<br><br>                # fowarding SSH port<br>                - &#39;2222:22&#39;<br><br>              volumes:<br>                # configuration volume <br>                - ./config:/etc/gitlab<br>  <br>                # log volume<br>                - ./logs:/var/log/gitlab<br><br>                # Gitlab data volume<br>                - ./data:/var/opt/gitlab<br><br>      EOF<br><br>      # run docker compose<br>      docker compose -f /opt/gitlab/docker-compose.yml up -d<br><br>      # create a file as a signal that process finished<br>      touch /opt/gitlab_install_finish<br>      <br># run command<br>runcmd:<br><br># execute docker installation script<br>- /opt/install-docker.sh<br><br># execute gitlab instalaltion<br>- /opt/install-docker-gitlab.sh</pre><blockquote><strong>Note :</strong></blockquote><blockquote>&lt;hostname&gt; : hostname of the container</blockquote><blockquote>&lt;admin-email@example.com&gt; : admin email address</blockquote><blockquote>&lt;vm-user&gt; : user in the VM</blockquote><p>3. config/network_config.cfg</p><pre>version: 2<br><br># VM ethernet configuration<br>ethernets:<br>  eth:<br>    # name of the network interface that starts with en<br>    match:<br>      name: en*<br><br>    # disable dhcp for IPv4<br>    dhcp4: no<br><br>    # use optional configuration<br>    optional: true<br><br>    # address that injected from main.tf<br>    addresses: [${ip_addr}/24]<br><br>    gateway4: &lt;gateway&gt;<br>    nameservers: <br>      addresses: [&lt;gateway&gt;]</pre><blockquote><strong>Note :</strong></blockquote><blockquote>&lt;gateway&gt; : change with the gateway</blockquote><h3>Result</h3><p>Access the gitlab by url in docker-compose.yml configuration https://&lt;hostname&gt; :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1A6lPS4kNqkZ5EEqmUzfA.png" /><figcaption>GitLab Login Page</figcaption></figure><p>For first time login, Gitlab create one time password login that put in initial_root_password in /opt/gitlab/data/initial_root_password :</p><pre>ssh &lt;vm-user&gt;@&lt;vm-ip&gt; cat /opt/gitlab/data/initial_root_password</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m2FxQIwlpv7LB2BX6YkIbA.png" /><figcaption>GitLab Dashboard</figcaption></figure><p>Now you can log in and start using your own GitLab server.</p><h3>Conclusion</h3><p>By using a self-maintained GitLab server we gain full control over our infrastructure, which improves reliability. By using Terraform we can easily make a duplicate of the GitLab server with consistent configuration and server specifications.</p><p>Thanks for reading my article ! if you’re interested in collaboration please contact me by email in my bio.</p><p>Support me by buying me a coffee !</p><figure><a href="http://buymeacoffee.com/infradm"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCQqlZr6doDP-cszzpaSpw.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f85872935a41" width="1" height="1" alt=""><hr><p><a href="https://blog.stackademic.com/installing-a-private-gitlab-server-on-kvm-with-terraform-f85872935a41">Installing a Private  GitLab Server on KVM With Terraform</a> was originally published in <a href="https://blog.stackademic.com/">Stackademic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Leetcode : 74. Search a 2D Matrix]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/leetcode-74-search-a-2d-matrix-a29bb3124948?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/2000/1*Ulv1al9oosPvjgAmjClOqQ.png" width="2000"></a></p><p class="medium-feed-snippet">Understanding data structure and algorithm using leetcode</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/leetcode-74-search-a-2d-matrix-a29bb3124948?source=rss-d47dc963b4e6------2">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/leetcode-74-search-a-2d-matrix-a29bb3124948?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a29bb3124948</guid>
            <category><![CDATA[sorting-algorithms]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[leetcode]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 05:05:11 GMT</pubDate>
            <atom:updated>2025-02-10T05:05:11.303Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Demistifying the Technology Behind JavaScript (ECMAScript and Babel Transpiler)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://javascript.plainenglish.io/demistifying-the-technology-behind-javascript-ecmascript-and-babel-transpiler-5a4cd7d6df14?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/2000/1*VahA8dOmW_P8jtj0yMgnOQ.png" width="2000"></a></p><p class="medium-feed-snippet">We will deepdive into javascript to understand how it work behind our screen</p><p class="medium-feed-link"><a href="https://javascript.plainenglish.io/demistifying-the-technology-behind-javascript-ecmascript-and-babel-transpiler-5a4cd7d6df14?source=rss-d47dc963b4e6------2">Continue reading on JavaScript in Plain English »</a></p></div>]]></description>
            <link>https://javascript.plainenglish.io/demistifying-the-technology-behind-javascript-ecmascript-and-babel-transpiler-5a4cd7d6df14?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a4cd7d6df14</guid>
            <category><![CDATA[web]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 02:32:24 GMT</pubDate>
            <atom:updated>2025-02-10T02:32:24.071Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What is React Component and Props ?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://javascript.plainenglish.io/what-is-react-component-and-props-c81cd50fa829?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/2000/1*Jk9OHHQI1VE4s7ps_yCX7g.png" width="2000"></a></p><p class="medium-feed-snippet">In this story we will learn about react component and props.</p><p class="medium-feed-link"><a href="https://javascript.plainenglish.io/what-is-react-component-and-props-c81cd50fa829?source=rss-d47dc963b4e6------2">Continue reading on JavaScript in Plain English »</a></p></div>]]></description>
            <link>https://javascript.plainenglish.io/what-is-react-component-and-props-c81cd50fa829?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/c81cd50fa829</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 08:01:53 GMT</pubDate>
            <atom:updated>2024-11-18T08:01:53.751Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[What is JSX and VirtualDOM?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://javascript.plainenglish.io/what-is-jsx-and-virtualdom-def4e84057b8?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/2000/1*c-Wb4iftsS7PCYbaoCwZBw.png" width="2000"></a></p><p class="medium-feed-snippet">Lets learn about fundamental feature of ReactJS: JSX and VirtualDOM&#xA0;.</p><p class="medium-feed-link"><a href="https://javascript.plainenglish.io/what-is-jsx-and-virtualdom-def4e84057b8?source=rss-d47dc963b4e6------2">Continue reading on JavaScript in Plain English »</a></p></div>]]></description>
            <link>https://javascript.plainenglish.io/what-is-jsx-and-virtualdom-def4e84057b8?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/def4e84057b8</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[reactjs]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Thu, 31 Oct 2024 20:05:46 GMT</pubDate>
            <atom:updated>2024-11-01T16:17:35.590Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Understanding JOINs in MySQL & Use Case Examples]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.stackademic.com/understanding-joins-in-mysql-use-case-examples-e33ee077231c?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/1000/1*hljbm4TBwtYgY8zjgsjrrA.png" width="1000"></a></p><p class="medium-feed-snippet">The JOIN is one of the fundamental MySQL query that we need to understand, and we will discuss about it.</p><p class="medium-feed-link"><a href="https://blog.stackademic.com/understanding-joins-in-mysql-use-case-examples-e33ee077231c?source=rss-d47dc963b4e6------2">Continue reading on Stackademic »</a></p></div>]]></description>
            <link>https://blog.stackademic.com/understanding-joins-in-mysql-use-case-examples-e33ee077231c?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e33ee077231c</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[query]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Tue, 29 Oct 2024 02:38:09 GMT</pubDate>
            <atom:updated>2024-10-29T02:38:09.012Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Handle Your MySQL Server Administration with Ease]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://blog.stackademic.com/handle-your-mysql-server-administration-with-ease-aa9fdc31d7dc?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/1000/1*hljbm4TBwtYgY8zjgsjrrA.png" width="1000"></a></p><p class="medium-feed-snippet">This is a tool that makes MySQL database administration easier.</p><p class="medium-feed-link"><a href="https://blog.stackademic.com/handle-your-mysql-server-administration-with-ease-aa9fdc31d7dc?source=rss-d47dc963b4e6------2">Continue reading on Stackademic »</a></p></div>]]></description>
            <link>https://blog.stackademic.com/handle-your-mysql-server-administration-with-ease-aa9fdc31d7dc?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa9fdc31d7dc</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Mon, 28 Oct 2024 02:39:15 GMT</pubDate>
            <atom:updated>2024-10-28T02:39:15.786Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Polymer JS : Frontend Framework Developed by Google]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://javascript.plainenglish.io/polymer-js-frontend-framework-developed-by-google-03508ac7e2f2?source=rss-d47dc963b4e6------2"><img src="https://cdn-images-1.medium.com/max/924/1*bOZ_x3KEz3F67Zmma1jD-w.png" width="924"></a></p><p class="medium-feed-snippet">Polymer is a framework developed by Google that have been used in most of Google products like Youtube, Google Maps, etc.</p><p class="medium-feed-link"><a href="https://javascript.plainenglish.io/polymer-js-frontend-framework-developed-by-google-03508ac7e2f2?source=rss-d47dc963b4e6------2">Continue reading on JavaScript in Plain English »</a></p></div>]]></description>
            <link>https://javascript.plainenglish.io/polymer-js-frontend-framework-developed-by-google-03508ac7e2f2?source=rss-d47dc963b4e6------2</link>
            <guid isPermaLink="false">https://medium.com/p/03508ac7e2f2</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[frontend]]></category>
            <dc:creator><![CDATA[infradm]]></dc:creator>
            <pubDate>Thu, 24 Oct 2024 02:40:30 GMT</pubDate>
            <atom:updated>2024-10-31T13:46:20.096Z</atom:updated>
        </item>
    </channel>
</rss>