<?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"><channel><title><![CDATA[kobebigs]]></title><description><![CDATA[I am a DevOps Engineer exploring tools and processes for designing and managing cloud workloads.]]></description><link>https://blog.kobebigs.com</link><generator>RSS for Node</generator><lastBuildDate>Thu, 15 Oct 2026 13:49:30 GMT</lastBuildDate><atom:link href="https://blog.kobebigs.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[aws-vault-switch: Easily Switch Between AWS Profiles]]></title><description><![CDATA[aws-vault-switch is a Go command-line interface (CLI) tool designed to enhance the functionality of AWS Vault, enabling seamless switching between AWS profiles without the need to exit the current shell session.
It simplifies the process of managing ...]]></description><link>https://blog.kobebigs.com/aws-vault-switch-easily-switch-between-aws-profiles</link><guid isPermaLink="true">https://blog.kobebigs.com/aws-vault-switch-easily-switch-between-aws-profiles</guid><category><![CDATA[aws-vault]]></category><category><![CDATA[aws-vault-swtch]]></category><category><![CDATA[aws cli]]></category><category><![CDATA[AWS]]></category><category><![CDATA[AWS IAM]]></category><category><![CDATA[Go Language]]></category><category><![CDATA[cli tool]]></category><category><![CDATA[kobebigs]]></category><dc:creator><![CDATA[Kobe Subramaniam]]></dc:creator><pubDate>Tue, 30 Jul 2024 13:57:28 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/ynfmVbvunQU/upload/1b6397af386f7341a532dbb7dbf1be23.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://github.com/kobeBigs/aws-vault-switch">aws-vault-switch</a> is a Go command-line interface (CLI) tool designed to enhance the functionality of <a target="_blank" href="https://github.com/99designs/aws-vault">AWS Vault</a>, enabling seamless switching between AWS profiles without the need to exit the current shell session.</p>
<p>It simplifies the process of managing multiple AWS accounts by listing all AWS profiles managed by AWS Vault and switching between them. It helps maintain the working context and improves efficiency.</p>
<h2 id="heading-installing">Installing</h2>
<p>You can install <code>aws-vault-switch</code> by downloading the <a target="_blank" href="https://github.com/kobeBigs/aws-vault-switch/releases/latest">latest release</a>;</p>
<ul>
<li><p>on macOS, download the package and move it to <code>/usr/local/bin</code>.</p>
<pre><code class="lang-bash">  $ wget https://github.com/kobeBigs/aws-vault-switch/releases/download/v0.1.0/aws-vault-switch-mac.tar.gz 
  $ tar -xzvf aws-vault-switch-mac.tar.gz 
  $ sudo mv aws-vault-switch-mac /usr/<span class="hljs-built_in">local</span>/bin/aws-vault-switch
</code></pre>
</li>
</ul>
<blockquote>
<p>if you are on macOS arm64 architecture you can download the <a target="_blank" href="https://github.com/kobeBigs/aws-vault-switch/releases/download/v0.1.0/aws-vault-switch-mac-arm.tar.gz">arm package</a> and use the instructions above</p>
</blockquote>
<ul>
<li>on linux, you can do same above using the <a target="_blank" href="https://github.com/kobeBigs/aws-vault-switch/releases/download/v0.1.0/aws-vault-switch-linux.tar.gz">linux package</a>.</li>
</ul>
<p>Also, you can clone and build from <a target="_blank" href="https://github.com/kobeBigs/aws-vault-switch">source</a>.</p>
<pre><code class="lang-bash">$ git <span class="hljs-built_in">clone</span> https://github.com/kobebigs/aws-vault-switch
$ <span class="hljs-built_in">cd</span> aws-vault-switch
$ go build -o aws-vault-switch
</code></pre>
<h2 id="heading-how-to-use-it">How to use it</h2>
<pre><code class="lang-bash"><span class="hljs-comment"># run aws-vault-switch and navigate and select using the arrow keys and enter key respectively</span>
$ aws-vault-switch
Use the arrow keys to navigate: ↓ ↑ → ←
? Select AWS Profile:
  ▸ default
    aws-account-dev
    aws-account-prod
    aws-account-marketing
↓   aws-account-sales
</code></pre>
<p>Note: make sure you have AWS Vault installed and setup before using aws-vault-switch.  </p>
<p>Contributions: issues, forks, and pull requests are welcome!</p>
]]></content:encoded></item><item><title><![CDATA[Maintaining Docker-based Redash]]></title><description><![CDATA[For over a year now, I have provisioned and been maintaining three (3) docker-based Redash instances for different purposes at work. Redash has become a convenient tool for us to manage user access to databases and monitor certain operations.
Here ar...]]></description><link>https://blog.kobebigs.com/maintaining-docker-based-redash</link><guid isPermaLink="true">https://blog.kobebigs.com/maintaining-docker-based-redash</guid><category><![CDATA[Docker]]></category><category><![CDATA[Docker compose]]></category><category><![CDATA[Let's Encrypt]]></category><category><![CDATA[nginx]]></category><category><![CDATA[redash]]></category><dc:creator><![CDATA[Kobe Subramaniam]]></dc:creator><pubDate>Thu, 16 Feb 2023 10:30:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1679132494365/0cd075be-19a2-49a5-afb6-30b71a91d572.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>For over a year now, I have provisioned and been maintaining three (3) docker-based <a target="_blank" href="https://redash.io/">Redash</a> instances for different purposes at <a target="_blank" href="https://www.bboxx.com/">work</a>. Redash has become a convenient tool for us to manage user access to databases and monitor certain operations.</p>
<p>Here are some of my learnings in keeping Redash alive and optimised on AWS EC2.</p>
<h2 id="heading-configuration-and-logs">Configuration and Logs</h2>
<p>To check running docker processes, ssh into the server and run <code>docker ps</code>. This lists all running Redash docker containers. <code>docker logs -f</code> also provides logs on the container you pass to it ie. <code>docker logs -f &lt;container id&gt;</code>.</p>
<h2 id="heading-restart">Restart</h2>
<p>Navigate to <code>/opt/redash</code> on the server and run <code>docker-compose restart</code> to restart all containers.</p>
<p>You can also restart single processes using the container id or name. For instance, <code>docker restart redash_server_1</code> will restart the Redash server.</p>
<h3 id="heading-restarting-celery-workers-andamp-the-queries-queue">Restarting Celery Workers &amp; the Queries Queue</h3>
<p>In case you are handling a problem, and you need to stop the currently running queries and reset the queue, follow the steps below;</p>
<ol>
<li><p>you can flush redis by running <code>docker exec -it redash_redis_1 redis-cli flushall</code>. Restart container with <code>docker restart redash_redis_1</code>.</p>
</li>
<li><p>check redis dump size: <code>docker exec -it redash_redis_1 ls -la</code>.</p>
</li>
</ol>
<h2 id="heading-changing-the-number-of-workers">Changing the Number of Workers</h2>
<p>By default, Celery will start a worker per CPU core. Because most of Redash’s tasks are IO bound, the real limit for the number of workers you can use depends on the amount of memory your machine has. It’s recommended to increase the number of workers, to support more concurrent queries.</p>
<p>You can change the number of workers by changing WORKERS_COUNT for the scheduler service in <code>docker-compose.yml</code> located at <code>/opt/redash/</code>. Restart the services after, using <code>docker-compose restart</code> or <code>docker-compose up -d</code>.</p>
<h2 id="heading-db">DB</h2>
<h3 id="heading-accessing-redashs-db">Accessing Redash’s DB:</h3>
<p>Access Redash DB (Postgres) in docker using: <code>docker exec -it redash_postgres_1 psql -U postgres</code>. You can then perform any activity via the Postgres prompt.</p>
<h2 id="heading-ssl-renewal-certbot">SSL Renewal (Certbot)</h2>
<p>I use <a target="_blank" href="https://letsencrypt.org/">Let's Encrypt</a> and I renew the certificate using the command below.</p>
<pre><code class="lang-plaintext">sudo docker run -t --rm -v /opt/redash/nginx/certs:/etc/letsencrypt -v /opt/redash/nginx/certs-data:/data/letsencrypt deliverous/certbot renew --webroot --webroot-path=/data/letsencrypt
</code></pre>
<p>list certificates to check the renewal has taken effect and see the new expiry date;</p>
<pre><code class="lang-plaintext">sudo docker run -t --rm -v /opt/redash/nginx/certs:/etc/letsencrypt -v /opt/redash/nginx/certs-data:/data/letsencrypt deliverous/certbot certificates
</code></pre>
<p>Restart nginx after; go to <code>/opt/redash</code> and <code>sudo docker-compose kill -s HUP nginx</code>.</p>
<h2 id="heading-redash-nginx-error">Redash NGINX Error</h2>
<blockquote>
<p>ERROR: for nginx Cannot start service nginx: b'driver failed programming external connectivity on endpoint redash_nginx_1 (e8c2089c3a09d7728fc79fb8eb7dde390ee9687d11a51d924d7224a28824ed52): Error starting userland proxy: listen tcp4 0.0.0.0:80: bind: address already in use'</p>
</blockquote>
<p>When you encounter the above error, try the below commands to resolve it.</p>
<pre><code class="lang-bash">
docker stop $(docker ps -a -q); docker rm $(docker ps -a -q); docker volume rm $(docker volume ls -qf dangling=<span class="hljs-literal">true</span>)

docker network rm $(docker network ls -q)

sudo lsof -nP | grep LISTEN

sudo <span class="hljs-built_in">kill</span> -9 &lt;&gt;
</code></pre>
<p>If the above doesn't work, check the nginx service(docker container), stop it and restart with <code>docker-compose up</code> to restart all services/containers.</p>
<pre><code class="lang-plaintext">sudo service nginx status
sudo service nginx stop
sudo docker-compose restart
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Setting up RabbitMQ on Amazon EC2]]></title><description><![CDATA[RabbitMQ is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP) and Streaming Text Oriented Messaging Protocol, Message Queuing Telemetry Transport, and other protocols via a Plugins.
To get started, pr...]]></description><link>https://blog.kobebigs.com/setting-up-rabbitmq-on-amazon-ec2</link><guid isPermaLink="true">https://blog.kobebigs.com/setting-up-rabbitmq-on-amazon-ec2</guid><category><![CDATA[rabbitmq]]></category><category><![CDATA[Amazon EC2]]></category><category><![CDATA[Ubuntu]]></category><category><![CDATA[rabbitmqctl]]></category><category><![CDATA[kobebigs]]></category><dc:creator><![CDATA[Kobe Subramaniam]]></dc:creator><pubDate>Thu, 30 Jun 2022 16:34:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1656606435275/hfPlZhkZT.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://www.rabbitmq.com/">RabbitMQ</a> is an open source message broker software that implements the Advanced Message Queuing Protocol (AMQP) and Streaming Text Oriented Messaging Protocol, Message Queuing Telemetry Transport, and other protocols via a Plugins.</p>
<p>To get started, provision an Ubuntu 20.04 EC2 instance and connect to it via SSH.</p>
<p><strong>Step 1:</strong> Install Erlang</p>
<pre><code>sudo apt <span class="hljs-keyword">update</span>
sudo apt <span class="hljs-keyword">install</span> erlang
</code></pre><p><strong>Step 2:</strong> Add RabbitMQ to Ubuntu</p>
<p>Enable apt HTTPS transport</p>
<pre><code>sudo apt install apt<span class="hljs-operator">-</span>transport<span class="hljs-operator">-</span>https
</code></pre><p>Get RabbitMQ keys</p>
<pre><code>wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-<span class="hljs-keyword">release</span>-signing-key.<span class="hljs-keyword">asc</span> | sudo apt-key <span class="hljs-keyword">add</span> -
wget -O- https://www.rabbitmq.com/rabbitmq-<span class="hljs-keyword">release</span>-signing-key.<span class="hljs-keyword">asc</span> | sudo apt-key <span class="hljs-keyword">add</span> -
</code></pre><p>Add RabbitMQ Repository (this assumes you’re on focal - Ubuntu 20.04)</p>
<pre><code>echo <span class="hljs-string">"deb https://dl.bintray.com/rabbitmq-erlang/debian focal erlang-22.x"</span> <span class="hljs-operator">|</span> sudo tee <span class="hljs-operator">/</span>etc<span class="hljs-operator">/</span>apt<span class="hljs-operator">/</span>sources.list.d/rabbitmq.list
</code></pre><p><strong>Step 3:</strong> Install RabbitMQ</p>
<pre><code>sudo apt <span class="hljs-keyword">update</span>
sudo apt <span class="hljs-keyword">install</span> rabbitmq-<span class="hljs-keyword">server</span>
</code></pre><p>Check status. RabbitMQ service is started and enabled after installation.</p>
<pre><code>sudo systemctl status  rabbitmq-<span class="hljs-keyword">server</span>.service
</code></pre><p>Check if RabbitMQ service is configured to start on boot.</p>
<pre><code>sudo service rabbitmq-<span class="hljs-keyword">server</span> <span class="hljs-keyword">start</span>
</code></pre><p>If disabled, enable it with </p>
<pre><code>sudo systemctl <span class="hljs-keyword">enable</span> rabbitmq-<span class="hljs-keyword">server</span>
</code></pre><h2 id="heading-enable-rabbitmq-management-web-dashboard">Enable RabbitMQ Management Web Dashboard</h2>
<pre><code>sudo rabbitmq-plugins <span class="hljs-keyword">enable</span> rabbitmq_management
</code></pre><p>This web service listens on TCP Port <strong>15672</strong>. Open <code>http://server ip/hostname:15672</code> in your browser to access the dashboard.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1656605817221/HKrkv57K4.png" alt="image.png" /></p>
<p>By default, the service creates a user 'guest' account with password ‘guest’. This can only be used when accessing on a localhost.</p>
<p>To login on a network, create an admin user account. See below.</p>
<h3 id="heading-creating-users">Creating Users</h3>
<p>Create user or admin user using the command below</p>
<pre><code>sudo rabbitmqctl add_user <span class="hljs-operator">&lt;</span>username<span class="hljs-operator">&gt;</span> <span class="hljs-operator">&lt;</span>password<span class="hljs-operator">&gt;</span>
</code></pre><p>example: <code>sudo rabbitmqctl add_user admin adminpassword</code></p>
<p>Add tags: administrator, management, monitoring, policymaker</p>
<pre><code>sudo rabbitmqctl set_user_tags <span class="hljs-operator">&lt;</span>username<span class="hljs-operator">&gt;</span> administrator
</code></pre><p>In the above command, the tag ‘administrator’ gives user full management UI and HTTP API access. Non administrator users should not be assigned a tag. </p>
<p>Now, set/grant permissions to the user. This grants the user access to all virtual hosts(vhosts).</p>
<pre><code>sudo rabbitmqctl set_permissions <span class="hljs-operator">&lt;</span>username<span class="hljs-operator">&gt;</span> <span class="hljs-string">".*"</span> <span class="hljs-string">".*"</span> <span class="hljs-string">".*"</span>
</code></pre><p>Login to management dashboard <code>http://server ip/hostname:15672</code> as admin.</p>
<h3 id="heading-port-access">Port Access</h3>
<p>To connect to rabbitmq using AMQP 0-9-1 and 1.0 clients with and without TLS, use port <strong>5672</strong> or <strong>5671</strong>.</p>
<pre><code>amqp://username:<span class="hljs-keyword">password</span>.&lt;<span class="hljs-keyword">server</span> ip/hostname&gt;:<span class="hljs-number">5672</span>//
</code></pre><p>For management UI, HTTP API access, use port <strong>15672</strong>  in your browser <code>http://server ip/hostname:15672</code>.</p>
<h3 id="heading-references">References</h3>
<ul>
<li><p>https://www.rabbitmq.com/ec2.html</p>
</li>
<li><p>https://www.rabbitmq.com/install-debian.html</p>
</li>
<li><p>https://computingforgeeks.com/how-to-install-latest-rabbitmq-server-on-ubuntu-linux/</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Running pgweb on Amazon EC2]]></title><description><![CDATA[Pgweb is a simple lightweight web-based client for PostgreSQL.
This is a guide on installing and setting up pgweb on Amazon EC2 (Ubuntu 20.04.4 LTS machine).
Requirement:

An Amazon EC2 instance

Installation
SSH into your instance and update your sy...]]></description><link>https://blog.kobebigs.com/running-pgweb-on-amazon-ec2</link><guid isPermaLink="true">https://blog.kobebigs.com/running-pgweb-on-amazon-ec2</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[pgweb]]></category><category><![CDATA[service file]]></category><category><![CDATA[Amazon EC2]]></category><category><![CDATA[Databases]]></category><dc:creator><![CDATA[Kobe Subramaniam]]></dc:creator><pubDate>Wed, 08 Jun 2022 00:34:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1679136523718/67af69f1-7bd9-4239-9663-ef26c937e435.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a target="_blank" href="https://github.com/sosedoff/pgweb">Pgweb</a> is a simple lightweight web-based client for PostgreSQL.</p>
<p>This is a guide on installing and setting up pgweb on Amazon EC2 (Ubuntu 20.04.4 LTS machine).</p>
<p>Requirement:</p>
<ol>
<li>An Amazon EC2 instance</li>
</ol>
<h2 id="heading-installation">Installation</h2>
<p>SSH into your instance and update your system packages. <code>sudo apt update &amp;&amp; sudo apt upgrade -y</code></p>
<p>Download and install <code>pgweb</code>.</p>
<pre><code class="lang-bash">curl -s https://api.github.com/repos/sosedoff/pgweb/releases/latest \
  | grep linux_amd64.zip \
  | grep download \
  | cut -d <span class="hljs-string">'"'</span> -f 4 \
  | wget -qi - \
  &amp;&amp; unzip pgweb_linux_amd64.zip \
  &amp;&amp; rm pgweb_linux_amd64.zip \
  &amp;&amp; mv pgweb_linux_amd64 /usr/<span class="hljs-built_in">local</span>/bin/pgweb
</code></pre>
<p>Check installation by running;</p>
<pre><code class="lang-bash">pgweb -v

  Output
  Pgweb v0.11.11 (git: db2a7a8aa5bc449e4efa78cada9c76c3fe33bc39) (go: go1.17.6) (build time: 2022-03-30T04:36:12Z)
</code></pre>
<h2 id="heading-usage">Usage</h2>
<p>Start server with <code>pgweb</code>.</p>
<p>By default pgweb runs on 127.0.0.1, localhost on port 8081. For Amazon EC2, bind pgweb to <code>0.0.0.0</code> to be able to access pgweb via the instance's public IP/DNS.</p>
<pre><code class="lang-bash">pgweb --<span class="hljs-built_in">bind</span> 0.0.0.0
</code></pre>
<p>Open <strong>your-instance-public-ip:8081</strong> in your browser to access pgweb.</p>
<p>To connect to a database at start of pgweb you can add the connection flags;</p>
<pre><code class="lang-bash">pgweb --<span class="hljs-built_in">bind</span> 0.0.0.0 --host db-host-endpoint --user dbuser --db dbname
</code></pre>
<p>pgweb also supports url scheme connection;</p>
<pre><code class="lang-bash">pgweb --<span class="hljs-built_in">bind</span> 0.0.0.0 --url postgres://dbuser:password@host:port/database
</code></pre>
<p>See more <a target="_blank" href="https://github.com/sosedoff/pgweb/wiki/Usage#cli-options">CLI options/flags</a>.</p>
<h2 id="heading-extend-into-a-servicedaemon">Extend into a service(daemon)</h2>
<p>This lets systemd manage pgweb and can be monitored via <code>systemctl</code>.</p>
<p>Create a file <code>pgweb.service</code> in <code>/etc/systemd/system</code> folder.</p>
<pre><code class="lang-bash">sudo vi /etc/systemd/system/pgweb.service
</code></pre>
<p>Copy and paste the code below;</p>
<pre><code class="lang-bash">[Unit]
Description=pgweb
Wants=
After=network.target

[Service]
User=ubuntu
Type=simple
ExecStart=/usr/<span class="hljs-built_in">local</span>/bin/pgweb --<span class="hljs-built_in">bind</span> 0.0.0.0 --sessions
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
</code></pre>
<p>Note the <code>--sessions</code> flag on <code>ExecStart=/usr/local/bin/pgweb --bind 0.0.0.0 --sessions</code> is to enable multiple database sessions.</p>
<p>You can also get/clone <a target="_blank" href="https://github.com/kobeBigs/pgweb-on-ec2">this repo</a> and move <code>pgweb.service</code> file to <code>/etc/systemd/system</code> folder.</p>
<pre><code class="lang-bash">sudo mv pgweb.service /etc/systemd/system
</code></pre>
<p>Reload services to include the new service.</p>
<pre><code class="lang-bash">sudo systemctl daemon-reload
</code></pre>
<p>Start the service and check the status.</p>
<pre><code class="lang-bash">sudo systemctl start pgweb.service
sudo systemctl status pgweb.service
</code></pre>
<p>If all goes through, enable the service to start at boot;</p>
<pre><code class="lang-bash">sudo systemctl <span class="hljs-built_in">enable</span> pgweb.service
</code></pre>
]]></content:encoded></item></channel></rss>