<?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 Nasir Noor on Medium]]></title>
        <description><![CDATA[Stories by Nasir Noor on Medium]]></description>
        <link>https://medium.com/@nasir19noor?source=rss-841d64bda35b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UfP08BvD0wGsru-tNUJVfA.png</url>
            <title>Stories by Nasir Noor on Medium</title>
            <link>https://medium.com/@nasir19noor?source=rss-841d64bda35b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 06:13:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nasir19noor/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[Building a Serverless URL Shortener on AWS with Terraform]]></title>
            <link>https://nasir19noor.medium.com/building-a-serverless-url-shortener-on-aws-with-terraform-32253616f9a5?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/32253616f9a5</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[dynamodb]]></category>
            <category><![CDATA[amazon-api-gateway]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Sun, 21 Jun 2026 15:07:13 GMT</pubDate>
            <atom:updated>2026-06-21T15:07:13.780Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3lqU0NLEIF7E2HJCf8KCpg.jpeg" /></figure><p>Most weekends I end up tinkering with something. This one turned into a small but complete project: a URL shortener running entirely on serverless AWS, with every piece of infrastructure defined as code and deployed through a pipeline. It is live at <a href="https://s.nasir.id/">https://s.nasir.id</a>.</p><p>A URL shortener is an unglamorous idea — the world does not need another one. But that is exactly why it makes a good teacher. The feature set is small enough to finish in a weekend, and every design decision inside it generalizes to bigger systems. The honest way to understand serverless is to build something with it, end to end, and watch where the friction actually shows up.</p><p>I started by brainstorming the shape of it with Claude, settled on three core services, and worked outward from there.</p><h3>The architecture at a glance</h3><p>There are two halves to the picture. The top half is the request path that serves users. The bottom half is how the whole thing gets provisioned. Keeping those two concerns separate in your head — runtime versus provisioning — is the first thing that makes serverless infrastructure feel manageable.</p><p>Three AWS services carry the runtime:</p><ul><li><strong>API Gateway</strong> is the front door. It receives every HTTP request and routes it by method and path.</li><li><strong>Lambda</strong> holds the logic. One small Python function handles creating links, redirecting them, and serving the homepage.</li><li><strong>DynamoDB</strong> is the store. A single table maps each short code to its original URL.</li></ul><p>That is the entire backend. No servers to patch, no load balancer to size, nothing running when no one is using it.</p><h3>How a request flows</h3><p>The function answers three routes, and it decides what to do by looking at the HTTP method and whether a path parameter is present.</p><p>A GET / returns the homepage — a small HTML form for pasting a URL. A POST / is the create operation: it reads the URL from the request body, generates a short code, writes the pair to DynamoDB, and returns the new link. A GET /{code} is the redirect: it looks the code up in DynamoDB and responds with a 301 to the original URL.</p><p>The data model is deliberately boring. The DynamoDB table uses the short code as its partition key and stores the long URL alongside it. No sort key, no secondary indexes. Short codes are high-cardinality and evenly distributed by nature, so reads and writes spread cleanly across partitions without any tuning.</p><p>Generating the code is the one spot that needs a little care. Rather than an incrementing counter — which creates a hot partition and lets anyone guess the next link — the function generates a random base62 string and writes it with a condition that the code does not already exist. On the rare collision it simply retries. With a seven-character code that is billions of combinations, so collisions are vanishingly unlikely until the table holds an enormous number of links.</p><pre>def lambda_handler(event, context):<br>    method = event.get(&quot;httpMethod&quot;, &quot;&quot;)<br><br>    if method == &quot;POST&quot;:<br>        return create_short_url(https://medium.com/event)<br><br>    if method == &quot;GET&quot;:<br>        code = (event.get(&quot;pathParameters&quot;) or {}).get(&quot;code&quot;)<br>        if code:<br>            return redirect(code)<br>        return _html(200, HTML_PAGE)  # GET / -&gt; the form<br><br>    return _json(405, {&quot;error&quot;: &quot;Method not allowed&quot;})</pre><p>Serving the homepage from the same function is what lets the entire product — form and redirects — live on one domain. It also removes the need for CORS entirely: because the page is served from the same origin it calls, the browser treats the request as same-origin and never sends a preflight.</p><h3>Everything as code</h3><p>I did not click any of this together in the AWS console. The whole system is defined in Terraform, organized as small reusable modules — one for the API Gateway, one for the Lambda, one for the DynamoDB table — that I call from thin root configurations. The modules live in a Git repository and are versioned, so a change to a module is a commit, not a surprise.</p><p>Each component keeps its own state file. The API Gateway, the Lambda, and the table are provisioned independently, which keeps blast radius small and lets each piece evolve on its own. The trade-off is that they have to share information across state boundaries. Terraform handles this with a remote-state data source: the Lambda configuration reads the table’s ARN from the DynamoDB state, and the API Gateway configuration reads the Lambda’s invoke ARN from the Lambda state. Nothing is hardcoded; each value has a single source of truth.</p><p>That split also imposes an apply order. State boundaries break Terraform’s dependency graph, so it cannot automatically know that the table must exist before the Lambda’s IAM policy can reference it. The ordering — table and API first, then the function — becomes something the pipeline enforces rather than something Terraform infers.</p><p>Permissions follow the same discipline. The Lambda’s role grants exactly three DynamoDB actions — get, put, and update — scoped to the one table, and nothing more. Least privilege is easy to get right when the policy is written next to the code that needs it.</p><h3>Deploying through GitHub Actions</h3><p>Defining infrastructure as code is only half the value; the other half is applying it the same way every time. GitHub Actions runs the Terraform plan and apply, so a push becomes a deployment. There is no laptop in the loop, no “works on my machine” drift between what is in the repository and what is running. The state lives in S3, shared and locked, so the pipeline and I are always looking at the same picture of reality.</p><h3>One domain, your own</h3><p>By default an API Gateway endpoint is a long, anonymous hostname with a stage segment in the path. The links it produces are neither memorable nor yours. Putting a custom domain in front fixes both.</p><p>The domain nasir.id is managed in Cloudflare, so the setup is an ACM certificate validated through a Cloudflare DNS record, an API Gateway custom domain, a base-path mapping, and a CNAME. The base-path mapping is the quiet hero here: by mapping the custom domain to the stage at the root path, it drops the stage segment from the URL entirely. The result is that every link is simply <a href="https://s.nasir.id/">s.nasir.id</a> short, branded, and indistinguishable from a link any commercial shortener would hand you.</p><h3>What it costs</h3><p>This is the part that still feels slightly unreal. All three services bill per use and scale to zero, so an idle shortener costs essentially nothing. Under load it scales itself; there is no capacity to provision in advance.</p><p>Run the numbers and the surprise is which service dominates. DynamoDB is almost a rounding error, because reads are cheap and the stored items are tiny. Lambda stays near-free at modest volume thanks to its perpetual free allowance. The largest line item is actually API Gateway — and even then, you are well into millions of requests a month before the bill reaches the price of a sandwich. The architecture barely costs anything until it is genuinely popular, which is the whole appeal of building this way.</p><h3>What the project actually taught</h3><p>The lessons that stuck were not about any single service. They were about the seams between them.</p><p>A bare API Gateway does nothing until you add routes, an integration, and a deployed stage; the REST API resource on its own is just a shell. Splitting Terraform state per component is clean but shifts the burden of ordering and cross-references onto you. A remote Git module only updates when you re-initialize, so a change that “should” be live often is not until you tell Terraform to refresh it. And a generated IAM policy document grants nothing on its own — it has to be attached to a role by an actual resource, a subtlety that produced a genuinely puzzling access-denied error until I traced it.</p><p>None of these are exotic. They are the ordinary texture of wiring real systems together, and they are precisely what a tutorial smooths over and a weekend project does not.</p><h3>Try it</h3><p>The shortener is running at <a href="https://s.nasir.id/">s.nasir.id</a> — paste a URL and you will get a short one back. It is a small thing, but it is whole: a frontend to create links, a custom domain on the output, and a serverless backend that costs almost nothing to keep alive.</p><p>If you have been meaning to get a feel for serverless, pick something equally unglamorous and build it the whole way through. The understanding is in the wiring.</p><p>Also available in my blog <a href="https://nasir.id/building-a-serverless-url-shortener-on-aws-with-terraform">https://nasir.id/building-a-serverless-url-shortener-on-aws-with-terraform</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32253616f9a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Secure File Uploader with Django, S3, and Vault]]></title>
            <link>https://nasir19noor.medium.com/building-a-secure-file-uploader-with-django-s3-and-vault-acdc52025b9e?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/acdc52025b9e</guid>
            <category><![CDATA[hashicorp-vault]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[s3]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 04:51:30 GMT</pubDate>
            <atom:updated>2025-06-21T04:51:30.605Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*b6homJdanN20AXh9hvXyjQ.png" /></figure><p>As an engineer, I often need to upload files — videos, audio, images, documents — and then embed or share them with anyone. Using AWS S3 as storage is powerful and cost-efficient, but logging into the AWS console every time I need to upload a file to a bucket is a hassle. That’s why I created this simple, secure web application to streamline the process.</p><p>This journey wasn’t just about uploading a file; it was about building a tool the <em>right way</em>. We’ll go beyond a basic script and build a production-ready application that handles security, large files, and a robust database backend.</p><p>Let’s walk through how we built it, step by step.</p><h4>The Goal: A Secure, Web-Based S3 Uploader</h4><p>Our goal is simple: create a web page where an authenticated user can select a file, upload it directly to an S3 bucket, and immediately get a public URL for sharing.</p><p>To achieve this, we’ll use a powerful and reliable tech stack:</p><ul><li><strong>Backend:</strong> Django</li><li><strong>File Storage:</strong> AWS S3</li><li><strong>Database:</strong> PostgreSQL</li><li><strong>Secrets Management:</strong> HashiCorp Vault</li><li><strong>Reverse Proxy:</strong> Nginx</li></ul><h4><strong>Part 1: The Basic Django App and S3 Connection</strong></h4><p>First, we started with a standard Django project. The core of connecting Django to S3 lies in two packages: boto3 (the AWS SDK for Python) and django-storages.</p><pre>pip install django boto3 django-storages</pre><p>The initial step was to configure settings.py to use S3 as the default location for media files.</p><pre># s3project/settings.py<br><br># This tells Django where to store uploaded files<br>DEFAULT_FILE_STORAGE = &#39;storages.backends.s3boto3.S3Boto3Storage&#39;<br><br># These are the credentials and bucket details<br>AWS_ACCESS_KEY_ID = &#39;YOUR_AWS_ACCESS_KEY_ID&#39;<br>AWS_SECRET_ACCESS_KEY = &#39;YOUR_AWS_SECRET_ACCESS_KEY&#39;<br>AWS_STORAGE_BUCKET_NAME = &#39;your-bucket-name&#39;<br>AWS_S3_REGION_NAME = &#39;your-region&#39;<br><br># Make uploaded files public by default<br>AWS_DEFAULT_ACL = &#39;public-read&#39; <br>AWS_QUERYSTRING_AUTH = False # Remove query params from the URL<br><br>MEDIA_URL = f&#39;https://{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com/&#39;<br>MEDIA_ROOT = &#39;&#39; # We&#39;ll upload to the root of the bucket</pre><p>Of course, hardcoding secrets like this is a terrible practice. That brings us to the most important part of our setup: security.</p><h4><strong>Part 2: Securing Credentials with HashiCorp Vault</strong></h4><p>Instead of leaving our AWS keys in settings.py, we leveraged HashiCorp Vault, a tool built specifically for managing secrets.</p><p>First, we stored our AWS keys and, later, our database credentials in Vault using its command-line interface.</p><pre># Store AWS secrets<br>vault kv put secret/aws/nasir \<br>    AWS_ACCESS_KEY_ID=&quot;...&quot; \<br>    AWS_SECRET_ACCESS_KEY=&quot;...&quot;<br><br># Store Database secrets<br>vault kv put secret/django/postgres \<br>    DB_NAME=&quot;...&quot; \<br>    DB_USER=&quot;...&quot; \<br>    DB_PASSWORD=&quot;...&quot;</pre><p>Next, we updated settings.py to fetch these secrets at runtime using the hvac library. This ensures our sensitive credentials never touch the codebase.</p><pre># s3project/settings.py<br>import hvac<br>import os<br><br>VAULT_ADDR = os.environ.get(&#39;VAULT_ADDR&#39;)<br>VAULT_TOKEN = os.environ.get(&#39;VAULT_TOKEN&#39;)<br><br>aws_secrets = {}<br>db_secrets = {}<br><br>if VAULT_TOKEN:<br>    client = hvac.Client(url=VAULT_ADDR, token=VAULT_TOKEN)<br>    if client.is_authenticated():<br>        # Fetch AWS secrets<br>        aws_response = client.secrets.kv.v2.read_secret_version(...)<br>        aws_secrets = aws_response[&#39;data&#39;][&#39;data&#39;]<br>        <br>        # Fetch Database secrets<br>        db_response = client.secrets.kv.v2.read_secret_version(...)<br>        db_secrets = db_response[&#39;data&#39;][&#39;data&#39;]<br><br># Now, use the fetched secrets<br>AWS_ACCESS_KEY_ID = aws_secrets.get(&#39;AWS_ACCESS_KEY_ID&#39;)<br>DATABASE_NAME = db_secrets.get(&#39;DB_NAME&#39;)<br># ...and so on</pre><pre>Part 3: The Uploader App and Authentication</pre><p>With our settings secured, we built a simple Django app named uploader.</p><ul><li><strong>models.py</strong>: We created an UploadedFile model with a FileField. We set upload_to=&#39;&#39; to ensure files go to the root of our bucket.</li><li><strong>forms.py</strong>: A standard ModelForm for our UploadedFile model.</li><li><strong>views.py</strong>: The core view logic. We used the @login_required decorator to protect the view, ensuring only logged-in users could access the uploader.</li></ul><pre># uploader/views.py<br>from django.contrib.auth.decorators import login_required<br><br>@login_required<br>def upload_file_view(request):<br>    if request.method == &#39;POST&#39;:<br>        form = FileUploadForm(request.POST, request.FILES)<br>        if form.is_valid():<br>            uploaded_file_instance = form.save()<br>            # ... render success page<br>    # ...</pre><p>To support the login system, we added Django’s built-in LoginView and LogoutView to our main urls.py and configured the redirect settings in settings.py.</p><h4><strong>Part 4: Switching to a Production Database</strong></h4><p>The default SQLite database is great for development, but for a real application, we need something more robust. We switched to PostgreSQL.</p><p>This involved:</p><ol><li>Installing the database driver: pip install psycopg2-binary.</li><li>Creating a new database and user in PostgreSQL.</li><li>Granting the correct permissions to our new user so it could create tables. This was a crucial step that often trips people up.</li><li>Updating the DATABASES dictionary in settings.py to use the credentials fetched from Vault.</li><li>Running python manage.py migrate to build the schema in our new PostgreSQL database.</li><li>Running python manage.py createsuperuser to create an admin account for the new database.</li></ol><h4><strong>Part 5: Going Live with Nginx</strong></h4><p>When deploying the app to a live server at <a href="http://upload.nasir.id/">upload.nasir.id</a>, we hit the final set of classic production hurdles.</p><p><strong>CSRF “Origin Checking Failed”</strong></p><p>Django’s CSRF protection rightly blocked POST requests from our new domain. The fix was to explicitly tell Django which domains to trust.</p><pre># settings.py<br>ALLOWED_HOSTS = [&#39;upload.nasir.id&#39;]<br>CSRF_TRUSTED_ORIGINS = [&#39;https://upload.nasir.id&#39;]</pre><p><strong>Handling Large Files</strong></p><p>By default, both Django and Nginx have small limits on file upload sizes. We increased these to handle files up to 100 MB.</p><pre># settings.py<br>DATA_UPLOAD_MAX_MEMORY_SIZE = 104857600 # 100 MB<br>```nginx<br># /etc/nginx/sites-available/your-site<br>server {<br>    # ...<br>    client_max_body_size 100M; # This is crucial<br>    # ...<br>}</pre><h3><strong>Conclusion</strong></h3><p>This project evolved from a simple idea into a robust, secure, and production-ready application. We didn’t just upload a file; we learned how to manage secrets professionally with Vault, configure a production-grade database, and correctly deploy a Django app behind a reverse proxy.</p><p>By solving problems step-by-step — from permissions errors to CSRF failures — we built a tool that is genuinely useful and follows best practices. The full code is available for reference on GitHub <a href="https://github.com/nasir19noor/nasir.id/tree/main/apps/upload-nasir-id">https://github.com/nasir19noor/nasir.id/tree/main/apps/upload-nasir-id</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acdc52025b9e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Paper to Practice: My Real-World HashiCorp Vault Learning Journey]]></title>
            <link>https://nasir19noor.medium.com/from-paper-to-practice-my-real-world-hashicorp-vault-learning-journey-2b1d35be7dc5?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b1d35be7dc5</guid>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Sat, 14 Jun 2025 14:23:26 GMT</pubDate>
            <atom:updated>2025-07-07T09:21:31.324Z</atom:updated>
            <content:encoded><![CDATA[<p>Like many engineers, I earned my HashiCorp Vault certification and proudly displayed it on LinkedIn. But let’s be honest — passing an exam and wielding Vault in production are two entirely different beasts.</p><p>Determined to bridge the gap between my theoretical knowledge and practical expertise, I decided to roll up my sleeves and build my own Vault environment. I spun up an Ubuntu 24.04 VPS and began experimenting with real-world scenarios that mirror what I encounter in production.</p><p>What followed was an eye-opening journey that transformed my understanding of secrets management, security policies, and infrastructure automation. In this comprehensive guide, I’ll walk you through my hands-on approach to mastering Vault — from installation on Ubuntu 24.04 to practical examples you can implement in your projects.</p><p>Whether you’re a fellow certificate holder looking to gain real experience or a developer curious about modern secrets management, this article will give you the practical foundation you need to work with HashiCorp Vault in production environments confidently.</p><h4>Setting up HashiCorp Vault on Ubuntu 24.04</h4><p>My journey began with setting up a production-ready Vault instance on my VPS. Rather than taking shortcuts with Docker or development mode, I wanted to understand the full deployment process — complete with SSL termination, proper systemd integration, and security hardening.</p><p><strong>Prerequisites and System Preparation</strong></p><p>First, I ensured my Ubuntu 24.04 system was up to date and installed the necessary dependencies:</p><pre>sudo apt update &amp;&amp; sudo apt upgrade -y<br>sudo apt install curl wget gnupg lsb-release nginx certbot python3-certbot-nginx -y</pre><p>The choice of Nginx here is strategic — while Vault has a built-in web UI, placing it behind a reverse proxy provides SSL termination, load balancing capabilities, and an additional security layer.</p><p><strong>Installing Hashicorp Vault</strong></p><p>HashiCorp provides an official APT repository, which I prefer over manual binary downloads for easier updates and package management:</p><pre>curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -<br>sudo apt-add-repository &quot;deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot;<br>sudo apt update<br>sudo apt install vault -y<br>vault version</pre><p><strong>Creating the Vault User and Directory Structure</strong></p><p>Security best practices dictate that Vault should run under its own dedicated user account, not root. I created a system user and established the proper directory structure:</p><pre>sudo useradd --system --home /etc/vault.d --shell /bin/false vault<br>sudo mkdir -p /opt/vault/data<br>sudo mkdir -p /etc/vault.d<br>sudo mkdir -p /var/log/vault<br>sudo chown -R vault:vault /opt/vault<br>sudo chown -R vault:vault /etc/vault.d<br>sudo chown -R vault:vault /var/log/vault</pre><p>This setup follows Unix principles: a dedicated system user with no shell access, separate directories for data, configuration, and logs, with appropriate ownership permissions.</p><p><strong>Configuring Vault</strong></p><p>The configuration file is where Vault’s behavior is defined located in /etc/vault.d/vault.hcl. Here’s the configuration I used for my setup:</p><pre>ui = true<br>disable_mlock = true<br><br>storage &quot;file&quot; {<br>  path = &quot;/opt/vault/data&quot;<br>}<br><br>listener &quot;tcp&quot; {<br>  address     = &quot;127.0.0.1:8200&quot;<br>  tls_disable = 1<br>}<br><br>api_addr = &quot;https://vault.nasir.id&quot;<br>cluster_addr = &quot;https://vault.nasir.id:8201&quot;<br><br>log_level = &quot;INFO&quot;<br>log_file = &quot;/var/log/vault/vault.log&quot;</pre><p>Key configuration decisions explained:</p><ul><li><strong>UI enabled</strong>: Essential for learning and debugging</li><li><strong>File storage</strong>: Simple for single-node setups, though Consul or cloud storage would be preferred for production clusters</li><li><strong>TLS disabled on listener</strong>: Since Nginx handles SSL termination</li><li><strong>Memory lock disabled</strong>: Prevents Vault from locking memory pages (acceptable for development environments)</li></ul><p>I saved this configuration and set appropriate permissions:</p><pre>sudo chown vault:vault /etc/vault.d/vault.hcl<br>sudo chmod 640 /etc/vault.d/vault.hcl</pre><p><strong>Creating the Systemd Service</strong></p><p>To ensure Vault starts automatically and runs reliably, I created a comprehensive systemd service file /etc/systemd/system/vault.service :</p><pre>[Unit]<br>Description=HashiCorp Vault<br>Documentation=https://www.vaultproject.io/docs/<br>Requires=network-online.target<br>After=network-online.target<br>ConditionFileNotEmpty=/etc/vault.d/vault.hcl<br>StartLimitIntervalSec=60<br>StartLimitBurst=3<br><br>[Service]<br>Type=notify<br>User=vault<br>Group=vault<br>ProtectSystem=full<br>ProtectHome=read-only<br>PrivateTmp=yes<br>PrivateDevices=yes<br>SecureBits=keep-caps<br>AmbientCapabilities=CAP_IPC_LOCK<br>CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK<br>NoNewPrivileges=yes<br>ExecStart=/usr/bin/vault server -config=/etc/vault.d/vault.hcl<br>ExecReload=/bin/kill -HUP $MAINPID<br>KillMode=process<br>Restart=on-failure<br>RestartSec=5<br>TimeoutStopSec=30<br>StartLimitInterval=60<br>StartLimitBurst=3<br>LimitNOFILE=65536<br>LimitMEMLOCK=infinity<br><br>[Install]<br>WantedBy=multi-user.target</pre><p>This service configuration includes security hardening measures like filesystem isolation, capability restrictions, and automatic restart policies. After creating the service:</p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable vault<br>sudo systemctl start vault<br>sudo systemctl status vault</pre><p><strong>SSL Configuration with Let’s Encrypt</strong></p><p>Security is paramount with Vault, so I configured SSL using Let’s Encrypt certificates:</p><pre>service nginx stop<br>sudo certbot certonly --standalone -d vault.nasir.id <br>sudo systemctl start nginx</pre><p>The Nginx configuration provides SSL termination and proxies requests to Vault /etc/nginx/sites-available/vault.nasir.id :</p><pre>server {<br>    listen 80;<br>    server_name vault.nasir.id;<br>    return 301 https://$server_name$request_uri;<br>}<br><br>server {<br>    listen 443 ssl http2;<br>    server_name vault.nasir.id;<br><br>    ssl_certificate /etc/letsencrypt/live/vault.nasir.id/fullchain.pem;<br>    ssl_certificate_key /etc/letsencrypt/live/vault.nasir.id/privkey.pem;<br>    <br>    # SSL Configuration<br>    ssl_protocols TLSv1.2 TLSv1.3;<br>    ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384;<br>    ssl_prefer_server_ciphers off;<br>    ssl_session_cache shared:SSL:10m;<br>    ssl_session_timeout 10m;<br>    <br>    # Security headers<br>    add_header Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; always;<br>    add_header X-Frame-Options DENY;<br>    add_header X-Content-Type-Options nosniff;<br>    add_header X-XSS-Protection &quot;1; mode=block&quot;;<br><br>    location / {<br>        proxy_pass http://127.0.0.1:8200;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>        proxy_set_header X-Forwarded-Port $server_port;<br>        <br>        # WebSocket support for UI<br>        proxy_http_version 1.1;<br>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &quot;upgrade&quot;;<br>        <br>        # Timeouts<br>        proxy_connect_timeout 60s;<br>        proxy_send_timeout 60s;<br>        proxy_read_timeout 60s;<br>    }<br>}</pre><p>After configuring Nginx:</p><pre>sudo ln -s /etc/nginx/sites-available/vault.nasir.id /etc/nginx/sites-enabled/<br>sudo nginx -t<br>sudo systemctl reload nginx</pre><p><strong>Initializing and Unsealing Vault</strong></p><p>With Vault running and accessible via HTTPS, the final step was initialization:</p><pre>export VAULT_ADDR=&quot;https://vault.nasir.id&quot;<br>vault operator init</pre><p>This command generates the master keys and root token. Please keep this information in safe place. In a real production environment, you’d use auto-unsealing with cloud KMS, but for learning purposes, manual unsealing works perfectly:</p><pre>vault operator unseal &lt;key1&gt;<br>vault operator unseal &lt;key2&gt;<br>vault operator unseal &lt;key3&gt;</pre><p>Finally, authenticate with the root token:</p><pre>vault auth &lt;root_token&gt;</pre><p>At this point, I had a fully functional, SSL-secured Vault instance ready for experimentation and real-world testing.</p><h4>Practical Example: Securing MySQL Database Credentials</h4><p>Now comes the exciting part — putting Vault to work in a real scenario. One of the most common use cases I encountered during the migration project was securely managing database credentials. Let me walk you through a practical example of storing MySQL connection details in Vault and retrieving them for seamless database access.</p><p><strong>Storing MySQL Credentials in Vault</strong></p><p>First, I enabled the Key-Value secrets engine (if not already enabled) and stored our MySQL database credentials:</p><pre># Enable KV secrets engine at path &#39;secret&#39; (usually enabled by default)<br>vault secrets enable -path=kv kv-v2<br><br># Store MySQL credentials as key-value pairs<br>vault kv put kv/mysql/wp \<br>    username=&quot;&lt;your_username&gt;&quot; \<br>    password=&quot;&lt;your_password&quot; \<br>    host=&quot;&lt;your_db_hostname&quot; \<br>    database=&quot;&lt;your_db_name&quot; \<br>    port=&quot;&lt;your_db_port&quot;</pre><p>Once you succeed, you will see this message</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*z1YYHoRu1tjcNzhY-nqFHA.png" /></figure><p>You also can do this via UI. Enable new engine, choose KV and Create secret.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsMrPDApefFW0h9QMtZkKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iJJwQ45bSj1ZmgeLIGRYqQ.png" /></figure><p>You see that complete API path would be v1/kv/data/mysql/wp. But actually you need to call kv/mysql/wp</p><p><strong>Retrieving Credentials for Database Connection</strong></p><p>Now, here’s where Vault truly shines in automation scenarios. Instead of hardcoding credentials or storing them in environment files, I can retrieve them dynamically:</p><pre># Set Vault address and authenticate (if not already done)<br>export VAULT_ADDR=&quot;https://vault.nasir.id&quot;<br>export VAULT_TOKEN=&quot;your-vault-token&quot;<br><br># Retrieve individual values<br>MYSQL_HOST=$(vault kv get -field=host kv/mysql/wp)<br>MYSQL_USER=$(vault kv get -field=username kv/mysql/wp)<br>MYSQL_PASS=$(vault kv get -field=password kv/mysql/wp)<br>MYSQL_DB=$(vault kv get -field=database kv/mysql/wp)<br>MYSQL_PORT=$(vault kv get -field=port kv/mysql/wp)<br><br># Connect to MySQL using retrieved credentials<br>mysql -h ${MYSQL_HOST} -P ${MYSQL_PORT} -u ${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB}</pre><p>If you configure it properly you can login to MySQL</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SGOihuCAUxRDdL2AM0Ajcw.png" /></figure><p><strong>Creating a Reusable Script</strong></p><p>To make this more practical for daily use, I created a simple bash script that handles the credential retrieval and connection:</p><pre>#!/bin/bash<br># mysql-connect.sh - Connect to MySQL using Vault credentials<br><br># Check if Vault is accessible<br>if ! vault status &amp;&gt; /dev/null; then<br>    echo &quot;Error: Cannot connect to Vault. Please check your VAULT_ADDR and authentication.&quot;<br>    exit 1<br>fi<br><br># Retrieve credentials from Vault<br>echo &quot;Retrieving MySQL credentials from Vault...&quot;<br>MYSQL_CREDS=$(vault kv get -format=json kv/mysql/wp)<br><br>if [ $? -ne 0 ]; then<br>    echo &quot;Error: Failed to retrieve credentials from Vault&quot;<br>    exit 1<br>fi<br><br># Parse JSON response to extract individual fields<br>MYSQL_HOST=$(echo $MYSQL_CREDS | jq -r &#39;.data.data.host&#39;)<br>MYSQL_USER=$(echo $MYSQL_CREDS | jq -r &#39;.data.data.username&#39;)<br>MYSQL_PASS=$(echo $MYSQL_CREDS | jq -r &#39;.data.data.password&#39;)<br>MYSQL_DB=$(echo $MYSQL_CREDS | jq -r &#39;.data.data.database&#39;)<br>MYSQL_PORT=$(echo $MYSQL_CREDS | jq -r &#39;.data.data.port&#39;)<br><br># Validate that we got all required fields<br>if [[ &quot;$MYSQL_HOST&quot; == &quot;null&quot; || &quot;$MYSQL_USER&quot; == &quot;null&quot; || &quot;$MYSQL_PASS&quot; == &quot;null&quot; ]]; then<br>    echo &quot;Error: Missing required credentials in Vault&quot;<br>    exit 1<br>fi<br><br>echo &quot;Connecting to MySQL database: $MYSQL_DB on $MYSQL_HOST:$MYSQL_PORT&quot;<br>echo &quot;User: $MYSQL_USER&quot;<br>echo &quot;&quot;<br><br># Connect to MySQL<br>mysql -h ${MYSQL_HOST} -P ${MYSQL_PORT} -u ${MYSQL_USER} -p${MYSQL_PASS} ${MYSQL_DB}</pre><p><strong>Advanced: One-liner for Quick Connections</strong></p><p>For quick access, you can create a one-liner that retrieves credentials and connects in a single command:</p><pre># One-liner to connect to MySQL via Vault<br>mysql $(vault kv get -format=json secret/database/mysql | jq -r &#39;&quot;--host=&quot; + .data.data.host + &quot; --port=&quot; + .data.data.port + &quot; --user=&quot; + .data.data.username + &quot; --password=&quot; + .data.data.password + &quot; &quot; + .data.data.database&#39;)</pre><p>This example show how to handle database access. Instead of developers having hardcoded credentials in their scripts or .env files scattered across different environments, everything was centralized in Vault. The benefits became immediately apparent:</p><ul><li><strong>Credential Rotation</strong>: When we needed to rotate the MySQL password, we updated it once in Vault, and all applications automatically used the new credentials</li><li><strong>Audit Trail</strong>: Every credential access was logged, giving us visibility into who accessed what and when</li><li><strong>Environment Consistency</strong>: The same script worked across development, staging, and production environments, with different Vault paths for each environment’s credentials</li><li><strong>Security</strong>: No more credentials in version control or configuration files</li></ul><h4><strong>Conclusion</strong></h4><p>My journey from HashiCorp Vault certification to hands-on implementation during the startup migration project has been eye-opening. Setting up Vault on Ubuntu 24.04 with proper SSL configuration and implementing real-world scenarios like MySQL credential management transformed my theoretical knowledge into practical expertise. The difference between passing an exam and actually deploying, configuring, and troubleshooting Vault in production is substantial — but bridging that gap through hands-on experience has made me significantly more confident and capable when working with secrets management infrastructure. For anyone holding a Vault certification but lacking practical experience, I highly recommend setting up your own instance and experimenting with real use cases; the investment in hands-on learning will pay dividends in your professional development.</p><p>You can see installation script : <a href="https://github.com/nasir19noor/nasir.id/blob/main/packages/vault.sh">https://github.com/nasir19noor/nasir.id/blob/main/packages/vault.sh</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b1d35be7dc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering AWS EKS Access Entries: A Complete Guide to Secure Cluster Authentication with Terraform]]></title>
            <link>https://nasir19noor.medium.com/mastering-aws-eks-access-entries-a-complete-guide-to-secure-cluster-authentication-with-terraform-d79c86305ab8?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d79c86305ab8</guid>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Fri, 06 Jun 2025 08:35:34 GMT</pubDate>
            <atom:updated>2025-06-06T08:35:34.919Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*hCCsYV65zdONw1UZVal8Kw.png" /></figure><p>Amazon Elastic Kubernetes Service (EKS) has revolutionized how we manage Kubernetes clusters in the cloud. One of the most critical aspects of EKS management is controlling who can access your cluster and what they can do once they’re in. This is where <strong>EKS Access Entries</strong> come into play — a powerful feature that provides fine-grained access control to your Kubernetes cluster.</p><p>In this comprehensive guide, we’ll dive deep into EKS Access Entries, explore their benefits over traditional authentication methods, and walk through a complete implementation using Terraform.</p><h3>What Are EKS Access Entries?</h3><p>EKS Access Entries represent a modern approach to managing authentication and authorization for your EKS cluster. Introduced as part of AWS’s efforts to simplify cluster access management, Access Entries allow you to directly map AWS IAM principals (users, roles, or groups) to Kubernetes permissions without the complexity of managing ConfigMaps or RBAC configurations manually.</p><h4>Traditional vs. Modern Authentication</h4><p><strong>Traditional Method (aws-auth ConfigMap):</strong></p><ul><li>Required manual editing of the aws-auth ConfigMap</li><li>Error-prone YAML manipulation</li><li>Difficult to audit and manage at scale</li><li>Risk of accidentally breaking cluster access</li></ul><p><strong>Modern Method (Access Entries):</strong></p><ul><li>Declarative configuration through APIs</li><li>Built-in validation and error handling</li><li>Better integration with AWS IAM</li><li>Easier to manage through Infrastructure as Code</li></ul><h4><strong>Key Components of Access Entries</strong></h4><p><strong>1.Principal ARN</strong></p><p>The AWS IAM principal (user, role, or group) that will be granted access to the cluster. This is the “who” in your access control equation.</p><p><strong>2. Policy Association</strong></p><p>AWS-managed policies that define what actions the principal can perform. These replace the need for manual RBAC configuration.</p><p><strong>3. Access Scope</strong></p><h4><strong>Deep Dive: Understanding the Terraform Configuration</strong></h4><p>Let’s examine the Access Entries configuration via Terraform code:</p><pre>access_entries = {<br>  nasir = {<br>    principal_arn     = &quot;arn:aws:iam::593793047751:user/nasir&quot;<br>    policy_associations = {<br>      admin = {<br>        policy_arn = &quot;arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy&quot;<br>        access_scope = {<br>          type = &quot;cluster&quot;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p><strong>Breaking Down the Configuration</strong></p><p><strong>Entry Name (</strong><strong>nasir):</strong> This is a logical identifier for the access entry. Choose descriptive names that reflect the user or role&#39;s purpose.</p><p><strong>Principal ARN:</strong> Points to the IAM user nasir in account 593793047751. This user will be granted the specified permissions.</p><p><strong>Policy Association:</strong> Uses the AWS-managed AmazonEKSClusterAdminPolicy, which provides full administrative access to the cluster.</p><p><strong>Access Scope:</strong> Set to cluster type, meaning the permissions apply to the entire cluster rather than specific namespaces.</p><h4><strong>AWS-Managed EKS Access Policies</strong></h4><p><strong>Administrative Policies</strong></p><ul><li><strong>AmazonEKSClusterAdminPolicy</strong>: Full cluster administration rights</li><li><strong>AmazonEKSAdminPolicy</strong>: Administrative access with some restrictions</li></ul><p><strong>Administrative Policies</strong></p><ul><li><strong>AmazonEKSEditPolicy</strong>: Read/write access to most Kubernetes resources</li><li><strong>AmazonEKSViewPolicy</strong>: Read-only access to cluster resources</li></ul><p><strong>Specialized Policies</strong></p><ul><li><strong>AmazonEKSClusterAdminViewPolicy</strong>: Admin-level read access without write permissions</li></ul><h4><strong>Complete EKS Setup with Access Entries</strong></h4><p>Here’s a complete Terraform configuration with additional context:</p><pre>module &quot;eks&quot; {<br>  source  = &quot;../modules/eks&quot;<br>  <br>  cluster_name    = local.name<br>  cluster_version = &quot;1.32&quot;<br>  cluster_endpoint_public_access = true<br>  <br>  # EKS Addons - Essential cluster components<br>  cluster_addons = {<br>    coredns                = {}<br>    eks-pod-identity-agent = {}<br>    kube-proxy             = {}<br>    vpc-cni                = {}<br>  }<br>  <br>  # Network Configuration<br>  vpc_id     = local.vpc_id<br>  subnet_ids = [local.subnet-1_id, local.subnet-2_id]<br>  <br>  # Node Groups Configuration<br>  eks_managed_node_groups = {<br>    nasir = {<br>      ami_type       = &quot;AL2_x86_64&quot;<br>      instance_types = [&quot;t3.small&quot;]<br>      <br>      min_size = 1<br>      max_size = 2<br>      desired_size = 1<br>    }<br>  }<br>  <br>  # Access Entries - The star of the show<br>  access_entries = {<br>    nasir = {<br>      principal_arn     = &quot;arn:aws:iam::593793047751:user/nasir&quot;<br>      policy_associations = {<br>        admin = {<br>          policy_arn = &quot;arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy&quot;<br>          access_scope = {<br>            type = &quot;cluster&quot;<br>          }<br>        }<br>      }<br>    }<br>  }<br>}</pre><h4><strong>Advanced Access Entry Patterns</strong></h4><p><strong>Multiple Users with Different Permissions</strong></p><pre>access_entries = {<br>  # Cluster Administrator<br>  cluster_admin = {<br>    principal_arn = &quot;arn:aws:iam::593793047751:user/admin&quot;<br>    policy_associations = {<br>      admin = {<br>        policy_arn = &quot;arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy&quot;<br>        access_scope = {<br>          type = &quot;cluster&quot;<br>        }<br>      }<br>    }<br>  }<br>  <br>  # Developer with Edit Access<br>  developer = {<br>    principal_arn = &quot;arn:aws:iam::593793047751:user/developer&quot;<br>    policy_associations = {<br>      edit = {<br>        policy_arn = &quot;arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy&quot;<br>        access_scope = {<br>          type = &quot;namespace&quot;<br>          namespaces = [&quot;development&quot;, &quot;staging&quot;]<br>        }<br>      }<br>    }<br>  }<br>  <br>  # Read-only User<br>  auditor = {<br>    principal_arn = &quot;arn:aws:iam::593793047751:user/auditor&quot;<br>    policy_associations = {<br>      view = {<br>        policy_arn = &quot;arn:aws:eks::aws:cluster-access-policy/AmazonEKSViewPolicy&quot;<br>        access_scope = {<br>          type = &quot;cluster&quot;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p><strong>Role-Based Access for Service Accounts</strong></p><pre>access_entries = {<br>  ci_cd_role = {<br>    principal_arn = &quot;arn:aws:iam::593793047751:role/EKS-CICD-Role&quot;<br>    policy_associations = {<br>      deployment = {<br>        policy_arn = &quot;arn:aws:eks::aws:cluster-access-policy/AmazonEKSEditPolicy&quot;<br>        access_scope = {<br>          type = &quot;namespace&quot;<br>          namespaces = [&quot;production&quot;]<br>        }<br>      }<br>    }<br>  }<br>}</pre><h4>Conclusion</h4><p>EKS Access Entries represent a significant improvement in managing Kubernetes cluster access. By leveraging AWS-managed policies and native IAM integration, they provide a more secure, scalable, and maintainable approach to cluster authentication.</p><p>The Terraform configuration we’ve explored demonstrates how to implement Access Entries effectively, providing a foundation for secure, well-managed EKS clusters. As you scale your Kubernetes operations, Access Entries will prove invaluable in maintaining security while enabling team productivity.</p><p>Remember to regularly review and audit your access configurations, follow the principle of least privilege, and leverage the comprehensive monitoring capabilities that AWS provides. With these practices in place, you’ll have a robust, secure foundation for your EKS operations.</p><p>You can see sample terraform here : <a href="https://github.com/nasir19noor/devops-aws-eks-terraform-actions/blob/main/terraform/services/eks/main.tf">https://github.com/nasir19noor/devops-aws-eks-terraform-actions/blob/main/terraform/services/eks/main.tf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d79c86305ab8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrating DNS Management to Cloudflare: A Complete Infrastructure-as-Code Approach with Terraform…]]></title>
            <link>https://nasir19noor.medium.com/migrating-dns-management-to-cloudflare-a-complete-infrastructure-as-code-approach-with-terraform-10ed03c2455d?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/10ed03c2455d</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Sat, 31 May 2025 11:24:44 GMT</pubDate>
            <atom:updated>2025-05-31T11:24:44.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>Migrating DNS Management to Cloudflare: A Complete Infrastructure-as-Code Approach with Terraform and GitHub Actions</h3><p>I have experience managing several domains for both personal and professional purposes. Initially, I handled most domains through their provider’s default DNS management system. For instance, when purchasing domains from <a href="https://www.godaddy.com/">GoDaddy</a>, I utilized their included DNS management service. While their DNS manager is reliable, it has limitations in terms of advanced functionality. Cloud platforms such as AWS and GCP offer more sophisticated DNS services like Route 53 and Cloud DNS, respectively. These services provide significantly enhanced features compared to traditional DNS managers, particularly when integrating with other services within their respective cloud ecosystems.</p><p>I currently manage multiple domains with infrastructure distributed across various locations. For example, my personal domain <a href="https://nasir.id/">nasir.id</a> has infrastructure components hosted on AWS, GCP, and VPS providers. To better manage this distributed setup, I transitioned from conventional DNS management to Cloudflare. Additionally, I implemented Infrastructure as Code (IaC) using Terraform and established automated workflows through GitHub Actions.</p><p>In the following section, I will outline the process of migrating DNS management for <a href="https://nasir.id/">nasir.id</a> to Cloudflare and implementing a comprehensive DevOps strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*KzL4sAG_TbC9H-B7VOiw6g.png" /><figcaption>nasir.id infarstructure</figcaption></figure><h3><strong>Why Cloudflare for DNS?</strong></h3><p>Before diving into the technical implementation, let me explain why I chose Cloudflare:</p><ul><li><strong>Performance and Reliability</strong>: Cloudflare operates one of the world’s largest DNS networks with 200+ data centers globally, providing sub-10ms response times worldwide.</li><li><strong>Security Features</strong>: Built-in DDoS protection, DNSSEC support, and advanced security features that come free with their DNS service.</li><li><strong>Cost-Effective</strong>: Cloudflare’s DNS service is free for basic usage, with enterprise features available at competitive prices.</li><li><strong>Developer-Friendly</strong>: Excellent API documentation, Terraform provider support, and comprehensive tooling for automation.</li><li><strong>Additional Services</strong>: Easy integration with CDN, SSL certificates, and other Cloudflare services if needed later.</li></ul><h3><strong>Cloudflare Setup</strong></h3><h4><strong>1. Assessment and Planning</strong></h4><p>First, I audited my existing DNS records across multiple providers. I created a spreadsheet documenting:</p><ul><li>All domains and subdomains</li><li>Record types (A, CNAME, MX, TXT, etc.)</li><li>Current TTL values</li><li>Dependencies and critical services</li></ul><h4><strong>2. Cloudflare Setup</strong></h4><p>I created a Cloudflare account and added my domains. Cloudflare automatically scanned and imported existing DNS records, which saved significant time during the migration. But I removed all records since I want to manage all records via Terraform only.</p><h4><strong>3. Generating API Token</strong></h4><p>Before implementing the Terraform configuration, you’ll need to generate a Cloudflare API token with appropriate permissions. Here’s the complete step-by-step process:</p><ul><li>From the Cloudflare dashboard, go to My Profile &gt; API Tokens and select Create Token.</li><li>For DNS management, I recommend using the <strong>“Edit zone DNS”</strong> template as it provides the exact permissions needed for Terraform DNS operations. Select a template from the available API token templates or create a custom token.</li><li>Modify the token’s permissions. After selecting a permissions group (Account, User, or Zone), choose what level of access to grant the token.</li><li>Copy the secret to a secure place. The token is only displayed once and cannot be retrieved later.</li><li>For the GitHub Actions workflow, add your token as a repository secret.<br>- Go to your repository → Settings → Secrets and variables → Actions<br>- Click “New repository secret” Name: CLOUDFLARE_API_TOKEN <br>- Value: Your generated API token<br>- Click “Add secret”</li><li>Cloudflare provides a verification endpoint to test your token:</li></ul><pre>curl &quot;https://api.cloudflare.com/client/v4/user/tokens/verify&quot; \ --header &quot;Authorization: Bearer YOUR_API_TOKEN_HERE&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*RkuAsOUnH6BwUcS9vzz2fQ.png" /></figure><h4><strong>Setting Up Infrastructure as Code with Terraform</strong></h4><p><strong>Project Structure</strong></p><p>I organized my Terraform configuration with a clean, flat structure that keeps everything simple and maintainable:</p><p>├── cloudflare/<br>│ ├── backend.tf<br>│ ├── data.tf<br>│ ├── dns.tf<br>│ ├── locals.tf<br>│ ├── main.tf<br>│ ├── outputs.tf<br>│ ├── provider.tf<br>│ └── variables.tf<br>├── .github/<br>│ └── workflows/<br>│ ├── cloudflare-plan.yml<br>│ └── cloudflare-apply.yml<br>└── README.md</p><p>This structure separates concerns clearly:</p><ul><li><strong>backend.tf</strong>: Terraform state configuration</li><li><strong>data.tf</strong>: Data sources (zone lookups, etc.)</li><li><strong>dns.tf</strong>: All DNS record configurations</li><li><strong>locals.tf</strong>: Local values and computed variables</li><li><strong>main.tf</strong>: Main configuration and resource calls</li><li><strong>outputs.tf</strong>: Output values</li><li><strong>provider.tf</strong>: Cloudflare provider configuration</li><li><strong>variables.tf</strong>: Input variable definitions</li></ul><p><strong>Terraform Configuration Files</strong></p><p>Here’s the actual Terraform configuration I use for managing nasir.id:</p><p><strong>provider.tf</strong></p><pre>terraform {<br>  required_version = &quot;&gt;= 1.0&quot;  <br>    required_providers {<br>      cloudflare = {<br>        source  = &quot;cloudflare/cloudflare&quot;<br>        version = &quot;~&gt; 4.46.0&quot;<br>      }<br>    }<br>}<br><br>provider &quot;cloudflare&quot; {<br>}</pre><p><strong>backend.tf</strong></p><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket = &quot;terraform.nasir.id&quot;<br>    region = &quot;ap-southeast-1&quot;<br>    key = &quot;cloudflare/terraform.tfstate&quot;<br>  }<br>}</pre><p><strong>data.tf</strong></p><pre>data &quot;cloudflare_zones&quot; &quot;nasir_id&quot; {<br>  filter {<br>    name = &quot;nasir.id&quot;<br>  }<br>}</pre><p><strong>locals.tf</strong></p><pre>locals {<br>  config                  = yamldecode(file(&quot;../config.yaml&quot;))<br>  region                  = local.config.aws.global.region<br>  bucket                  = local.config.aws.global.state_bucket<br>  zone_id                 = local.config.cloudflare.zone_id<br>  root                    = local.config.cloudflare.root<br>  contabo_ip              = local.config.contabo.ip<br>}</pre><p><strong>variables.tf</strong></p><pre>variable &quot;cloudflare_zone_id&quot; {<br>  description = &quot;zone id&quot;<br>  type    = string<br>  default = &quot;nasir.id&quot;<br>}</pre><p><strong>dns.tf</strong></p><pre># MX Record for Google Workspace<br>resource &quot;cloudflare_record&quot; &quot;mx-1&quot; {<br>  zone_id = data.cloudflare_zones.nasir_id.zones[0].id<br>  name    = local.root<br>  content = &quot;ASPMX.L.GOOGLE.COM.&quot;<br>  type    = &quot;MX&quot;<br>  priority = 1<br>  ttl     = 3600<br>}<br><br>resource &quot;cloudflare_record&quot; &quot;mx-2&quot; {<br>  zone_id = data.cloudflare_zones.nasir_id.zones[0].id<br>  name    = local.root<br>  content = &quot;ALT1.ASPMX.L.GOOGLE.COM.&quot;<br>  type    = &quot;MX&quot;<br>  priority = 5<br>  ttl     = 3600<br>}<br><br>resource &quot;cloudflare_record&quot; &quot;mx-3&quot; {<br>  zone_id = data.cloudflare_zones.nasir_id.zones[0].id<br>  name    = local.root<br>  content = &quot;ALT2.ASPMX.L.GOOGLE.COM.&quot;<br>  type    = &quot;MX&quot;<br>  priority = 5<br>  ttl     = 3600<br>}<br><br>resource &quot;cloudflare_record&quot; &quot;mx-4&quot; {<br>  zone_id = data.cloudflare_zones.nasir_id.zones[0].id<br>  name    = local.root<br>  content = &quot;ALT3.ASPMX.L.GOOGLE.COM.&quot;<br>  type    = &quot;MX&quot;<br>  priority = 10<br>  ttl     = 3600<br>}<br><br>resource &quot;cloudflare_record&quot; &quot;mx-5&quot; {<br>  zone_id = data.cloudflare_zones.nasir_id.zones[0].id<br>  name    = local.root<br>  content = &quot;ALT4.ASPMX.L.GOOGLE.COM.&quot;<br>  type    = &quot;MX&quot;<br>  priority = 10<br>  ttl     = 3600<br>}<br><br># A record nasir.id<br>resource &quot;cloudflare_record&quot; &quot;nasir-id&quot; {<br>  zone_id = data.cloudflare_zones.nasir_id.zones[0].id<br>  name    = local.root<br>  content = local.contabo_ip<br>  type    = &quot;A&quot;<br>  ttl     = 1<br>  proxied = true<br>}</pre><p><strong>outputs.tf</strong></p><pre>output &quot;zone_id&quot; {<br>  value = data.cloudflare_zones.nasir_id.zones[0].id<br>}</pre><h4><strong>Github Actions Integration</strong></h4><p><strong>Terraform Plan Workflow</strong></p><pre>name: &#39;Cloudflare Plan&#39;<br><br>on:<br>  push:<br>    branches: [ &#39;**&#39; ] <br>    paths:<br>      - &#39;cloudflare/**.tf&#39;  <br>      - &#39;cloudflare/**.tfvars&#39;  <br>      - &#39;.github/workflows/cloudflare-plan.yml&#39;<br><br>env:<br>  TF_VERSION: &#39;1.11.4&#39;   <br>  AWS_REGION: &#39;ap-southeast-1&#39;<br>  CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}<br><br>jobs:<br>  terraform-plan:<br>    name: Cloudflare Plan<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout Repository<br>        uses: actions/checkout@v3<br><br>      - name: Configure AWS CLI<br>        run: |<br>          # Install AWS CLI if not already available<br>          curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \<br>          &amp;&amp; unzip awscliv2.zip \<br>          &amp;&amp; ./aws/install \<br>          &amp;&amp; rm -rf aws awscliv2.zip<br>    <br>          # Configure AWS credentials<br>          mkdir -p ~/.aws<br>    <br>          # Create credentials file<br>          cat &gt; ~/.aws/credentials &lt;&lt; EOF<br>          [default]<br>          aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}<br>          aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          EOF<br>    <br>          # Create config file with region<br>          cat &gt; ~/.aws/config &lt;&lt; EOF<br>          [default]<br>          region=${{ env.AWS_REGION }}<br>          output=json<br>          EOF<br>    <br>          # Verify credentials are working (optional)<br>          aws sts get-caller-identity<br>      - name: Setup Terraform<br>        <br>        run: |<br>          # Install Terraform if not already available<br>          wget -O- https://apt.releases.hashicorp.com/gpg | \<br>          gpg --dearmor | \<br>          sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg<br>          echo &quot;deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \<br>          https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot; | \<br>          sudo tee /etc/apt/sources.list.d/hashicorp.list<br>          sudo apt update<br>          sudo apt-get install terraform<br>    <br>          # Verify Terraform installation<br>          terraform version<br><br>      - name: Terraform Init<br>        run: |<br>          cd cloudflare<br>          terraform init<br><br>      - name: Terraform Validate<br>        run: |<br>          cd cloudflare<br>          terraform validate<br><br>      - name: Terraform Plan<br>        id: plan<br>        run: |<br>          cd cloudflare<br>          terraform plan -no-color<br>        continue-on-error: true</pre><p><strong>Terraform Apply Workflow</strong></p><pre>name: &#39;Cloudflare Apply&#39;<br><br>on:<br>  push:<br>    branches:<br>      - main <br>    paths:<br>      - &#39;cloudflare/**.tfvars&#39;  <br>      - &#39;cloudflare/**.tf&#39;<br>      - &#39;.github/workflows/cloudflare-apply.yml&#39;<br>      <br>env:<br>  TF_VERSION: &#39;1.11.4&#39;   <br>  AWS_REGION: &#39;ap-southeast-1&#39;<br>  CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}<br><br>jobs:<br>  terraform-apply:<br>    name: Cloudflare Apply<br>    runs-on: ubuntu-latest<br>    steps:<br>      - name: Checkout Repository<br>        uses: actions/checkout@v3<br><br>      - name: Configure AWS CLI<br>        run: |<br>          # Install AWS CLI if not already available<br>          curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \<br>          &amp;&amp; unzip awscliv2.zip \<br>          &amp;&amp; ./aws/install \<br>          &amp;&amp; rm -rf aws awscliv2.zip<br>    <br>          # Configure AWS credentials<br>          mkdir -p ~/.aws<br>    <br>          # Create credentials file<br>          cat &gt; ~/.aws/credentials &lt;&lt; EOF<br>          [default]<br>          aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}<br>          aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}<br>          EOF<br>    <br>          # Create config file with region<br>          cat &gt; ~/.aws/config &lt;&lt; EOF<br>          [default]<br>          region=${{ env.AWS_REGION }}<br>          output=json<br>          EOF<br>    <br>          # Verify credentials are working (optional)<br>          aws sts get-caller-identity<br>      - name: Setup Terraform<br>        <br>        run: |<br>          # Install Terraform if not already available<br>          wget -O- https://apt.releases.hashicorp.com/gpg | \<br>          gpg --dearmor | \<br>          sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg<br>          echo &quot;deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \<br>          https://apt.releases.hashicorp.com $(lsb_release -cs) main&quot; | \<br>          sudo tee /etc/apt/sources.list.d/hashicorp.list<br>          sudo apt update<br>          sudo apt-get install terraform<br>    <br>          # Verify Terraform installation<br>          terraform version<br><br>      - name: Terraform Init<br>        run: |<br>          cd cloudflare<br>          terraform init<br><br>      - name: Terraform Validate<br>        run: |<br>          cd cloudflare<br>          terraform validate<br><br>      - name: Terraform Plan<br>        id: plan<br>        run: |<br>          cd cloudflare<br>          terraform plan -no-color<br>        continue-on-error: true<br>        <br>      - name: Terraform Apply<br>        id: apply<br>        run: |<br>          cd cloudflare<br>          terraform apply -auto-approve<br>        continue-on-error: false</pre><p>Upon updating DNS records and pushing changes to the repository, GitHub Actions will automatically trigger and apply the corresponding updates to the Cloudflare DNS records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*szrgk0eIvH7QAkjtU2c-eA.png" /></figure><h4>Conclusion</h4><p>Migrating DNS management to Cloudflare and implementing Infrastructure as Code practices transformed how I manage DNS infrastructure. The combination of Cloudflare’s robust DNS platform, Terraform’s declarative configuration management, and GitHub Actions’ automation capabilities created a reliable, auditable, and scalable DNS management system.</p><p>The initial investment in setup time pays dividends through reduced operational overhead, improved reliability, and enhanced security posture. If you’re managing DNS manually or across multiple providers, I highly recommend considering a similar approach.</p><p>The key to success is starting with a clear migration plan, implementing proper testing procedures, and gradually expanding automation capabilities as your confidence in the system grows.</p><p>You can see all scripts here <a href="https://github.com/nasir19noor/nasir.id">https://github.com/nasir19noor/nasir.id</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10ed03c2455d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform’s Hidden Gems: Powerful Features That Revolutionize Infrastructure Management]]></title>
            <link>https://nasir19noor.medium.com/terraforms-hidden-gems-powerful-features-that-revolutionize-infrastructure-management-2e8f30797970?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e8f30797970</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[terraform-modules]]></category>
            <category><![CDATA[terraform-provider]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Sat, 24 May 2025 08:08:19 GMT</pubDate>
            <atom:updated>2025-05-24T08:08:19.779Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*n0AnAf8D1yO7OVT2Aqc-1w.png" /></figure><p>When I started working with Terraform, I thought it was just another simple infrastructure provisioning platform. It turns out that Terraform is actually a really powerful platform for managing infrastructure—that’s why it’s become the most popular IaC tool today.</p><p>What initially seemed like basic resource creation and management was a sophisticated ecosystem with unique features that revolutionized how we approach infrastructure. Let’s explore some of these capabilities that you might not be fully leveraging yet.</p><h4><strong>1. State Management: The Foundation of Terraform’s Magic</strong></h4><p>Terraform’s state-based approach provides a crucial differentiator that makes it particularly powerful for infrastructure management.</p><p><strong>Remote State Storage</strong></p><p>Terraform maintains a state file that tracks all resources it manages. When stored remotely (in S3, Azure Blob Storage, HashiCorp Consul, etc.), this enables:</p><ul><li><strong>Team collaboration</strong>: Multiple engineers can work on the same infrastructure</li><li><strong>State locking</strong>: Prevents concurrent modifications that could corrupt your infrastructure</li><li><strong>Versioning</strong>: Track changes over time and roll back when needed</li></ul><pre>terraform {<br>  backend &quot;s3&quot; {<br>    bucket = &quot;nasir-terraform-states&quot;<br>    key    = &quot;vpc/terraform.tfstate&quot;<br>    region = &quot;ap-southeast-1&quot;<br>    dynamodb_table = &quot;terraform-locks&quot;<br>  }<br>}</pre><p><strong>State Data Source</strong></p><p>One of Terraform’s most underutilized features is its ability to import state from one configuration into another using the terraform_remote_state data source:</p><pre>data &quot;terraform_remote_state&quot; &quot;subnet&quot; {<br>  backend = &quot;s3&quot;<br>  config = {<br>    bucket = &quot;nasir-terraform-states&quot;<br>    key    = &quot;subnets/terraform.tfstate&quot;<br>    region = &quot;ap-southeast-1&quot;<br>  }<br>}<br><br>resource &quot;aws_instance&quot; &quot;webserver&quot; {<br>  # Reference outputs from the network state<br>  subnet_id = data.terraform_remote_state.subnet.outputs.subnet_id<br>}</pre><h4><strong>2. Module System: True Infrastructure Componentization</strong></h4><p>Terraform’s module system enables reusability and composability at an enterprise scale.</p><p><strong>Module Registry Integration</strong></p><p>The Terraform Registry provides a central repository for publicly available modules:</p><pre>module &quot;vpc&quot; {<br>  source  = &quot;terraform-aws-modules/vpc/aws&quot;<br>  version = &quot;3.14.0&quot;<br>  <br>  name = &quot;my-vpc&quot;<br>  cidr = &quot;10.0.0.0/16&quot;<br>  # Additional configuration...<br>}</pre><p>But beyond the public registry, Terraform supports private module registries that enable organizations to create their own internal catalogs of approved infrastructure components.</p><p><strong>For-Each and Count for Module Instantiation</strong></p><p>Terraform can dynamically create multiple instances of a module based on variables:</p><pre>module &quot;microservice&quot; {<br>  for_each = toset([&quot;auth&quot;, &quot;payments&quot;, &quot;inventory&quot;, &quot;shipping&quot;])<br>  <br>  source = &quot;./modules/microservice&quot;<br>  name   = each.key<br>  environment = var.environment<br>  region      = var.region<br>  # Additional configuration...<br>}</pre><h4><strong>3. Meta-Arguments: Declarative Logic Without Imperative Code</strong></h4><p>Terraform’s meta-arguments provide declarative ways to handle complex infrastructure patterns.</p><p><strong>Depends_on: Explicit Resource Ordering</strong></p><p>When implicit dependencies aren’t enough, depends_on ensures proper resource creation order:</p><pre>resource &quot;aws_instance&quot; &quot;web&quot; {<br>  # configuration...<br>  <br>  depends_on = [<br>    aws_iam_role_policy.example,<br>    aws_route_table_association.public<br>  ]<br>}</pre><p><strong>Lifecycle Rules: Fine-grained Resource Behavior Control</strong></p><p>The lifecycle block allows for sophisticated control over how Terraform manages resources:</p><p>hcl</p><pre>resource &quot;aws_instance&quot; &quot;web&quot; {<br>  # configuration...<br>  <br>  lifecycle {<br>    create_before_destroy = true<br>    prevent_destroy = true<br>    ignore_changes = [tags]<br>  }<br>}</pre><p>These settings allow for zero-downtime deployments, protection against accidental deletions, and control over what changes Terraform can make.</p><h4><strong>4. Data-Driven Infrastructure with Dynamic Blocks</strong></h4><p>Dynamic blocks allow for generating nested configuration blocks based on complex data structures:</p><pre>locals {<br>  ingress_rules = [<br>    {<br>      port        = 443<br>      protocol    = &quot;tcp&quot;<br>      cidr_blocks = [&quot;0.0.0.0/0&quot;]<br>      description = &quot;HTTPS&quot;<br>    },<br>    {<br>      port        = 80<br>      protocol    = &quot;tcp&quot;<br>      cidr_blocks = [&quot;10.0.0.0/8&quot;]<br>      description = &quot;HTTP internal&quot;<br>    }<br>  ]<br>}<br><br>resource &quot;aws_security_group&quot; &quot;web&quot; {<br>  name = &quot;web-server&quot;<br>  <br>  dynamic &quot;ingress&quot; {<br>    for_each = local.ingress_rules<br>    content {<br>      from_port   = ingress.value.port<br>      to_port     = ingress.value.port<br>      protocol    = ingress.value.protocol<br>      cidr_blocks = ingress.value.cidr_blocks<br>      description = ingress.value.description<br>    }<br>  }<br>}</pre><p>This approach enables infrastructure-as-data, where configuration is generated from structured data rather than hardcoded.</p><h4><strong>5. Built-in Functions: Powerful Computation Without External Tools</strong></h4><p>Terraform includes a rich set of built-in functions for data manipulation:</p><pre>locals {<br>  # Transform a list of CIDR blocks to slice off the subnet mask<br>  ip_addresses = [for cidr in var.cidr_blocks : split(&quot;/&quot;, cidr)[0]]<br>  <br>  # Flatten complex nested structures<br>  all_tags = merge(<br>    var.common_tags,<br>    var.environment_tags[var.environment],<br>    {<br>      &quot;Name&quot; = &quot;${var.project}-${var.environment}&quot;<br>      &quot;LastModified&quot; = formatdate(&quot;YYYY-MM-DD&quot;, timestamp())<br>    }<br>  )<br>}</pre><p>These functions allow for complex transformations without requiring external scripts or tools.</p><h4><strong>6. Import and Resource Discovery</strong></h4><p>Terraform can bring existing infrastructure under management:</p><pre>terraform import aws_instance.web i-1234567890abcdef0</pre><p>With the newer terraform plan -generate-config-out=generated.tf feature, Terraform can even generate configuration for resources it discovers in your cloud accounts—making it easier to adopt Terraform for existing environments.</p><h4><strong>7. Provider System: True Multi-Cloud Orchestration</strong></h4><p>Terraform’s provider system is what enables its celebrated cloud-agnostic approach.</p><p><strong>Multi-Provider Configurations</strong></p><p>Unlike platform-specific tools, Terraform can provision and manage resources across multiple providers simultaneously in a single configuration:</p><pre>provider &quot;aws&quot; {<br>  region = &quot;us-west-2&quot;<br>  alias  = &quot;west&quot;<br>}<br><br>provider &quot;aws&quot; {<br>  region = &quot;us-east-1&quot; <br>  alias  = &quot;east&quot;<br>}<br><br>provider &quot;google&quot; {<br>  project = &quot;my-gcp-project&quot;<br>  region  = &quot;us-central1&quot;<br>}<br><br># Create resources in both AWS regions and GCP in one apply<br>resource &quot;aws_instance&quot; &quot;west_server&quot; {<br>  provider = aws.west<br>  # configuration...<br>}<br><br>resource &quot;aws_instance&quot; &quot;east_server&quot; {<br>  provider = aws.east<br>  # configuration...<br>}<br><br>resource &quot;google_compute_instance&quot; &quot;gcp_server&quot; {<br>  # configuration...<br>}</pre><p>This enables sophisticated multi-cloud strategies and disaster recovery setups that would be extremely difficult to implement with platform-specific tools.</p><p><strong>Custom Providers</strong></p><p>The ability to create custom providers allows Terraform to manage virtually any API-accessible service:</p><pre>provider &quot;custom&quot; {<br>  api_endpoint = &quot;https://api.custom-service.com/v1&quot;<br>  auth_token   = var.token<br>}</pre><p>Organizations can extend Terraform to manage internal systems, legacy infrastructure, and specialized services — bringing them all into the same workflow.</p><h3>Conclusion</h3><p>While many tools can provision cloud resources, Terraform’s unique capabilities around state management, provider ecosystem, modularity, meta-arguments, and data manipulation set it apart as a comprehensive solution for infrastructure management.</p><p>As infrastructure complexity continues to grow, leveraging these advanced features becomes not just beneficial but essential for maintaining control, security, and agility in your cloud environments.</p><p>By mastering these unique Terraform features, infrastructure teams can build more resilient, maintainable, and scalable systems while reducing operational overhead and risk.</p><p>Ready to put Terraform into practice? Check out my hands-on project repository on GitHub <a href="https://github.com/nasir19noor/terraform">https://github.com/nasir19noor/terraform</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e8f30797970" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Terraform YAML Centralized Configuration Will Supercharge Infrastructure Automation]]></title>
            <link>https://nasir19noor.medium.com/how-terraform-yaml-centralized-configuration-will-supercharge-infrastructure-automation-a8e6b70d2170?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8e6b70d2170</guid>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Sat, 17 May 2025 05:26:27 GMT</pubDate>
            <atom:updated>2025-05-17T05:43:08.175Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*af0DhIrsPiDMnQR--IkBUg.png" /></figure><p>Last year, a consulting company approached us with a challenge. They wanted to migrate their traditional AWS infrastructure to AWS Landing Zone and needed to automate their infrastructure provisioning and management with Terraform and CI/CD pipelines. What made their request particularly interesting was their desire to centralize all Terraform configuration in a single placeholder.</p><p>We usually use traditional .tfvars files, but realized this approach wouldn&#39;t accommodate their requirements. After exploring alternatives, we discovered that YAML files could perfectly fulfill this need, providing both the centralization and flexibility they were looking for.</p><p>This experience isn’t unique. As organizations scale their infrastructure, Terraform configurations grow exponentially more complex, leading to code duplication and maintenance headaches. YAML centralized configuration offers a simpler, more maintainable approach to Terraform automation.</p><h3><strong>A Simple Real-World Example</strong></h3><p>Let’s look at a straightforward example of how YAML centralized configuration works in practice. Here’s a sample basic setup we for VPC creation</p><ol><li><strong>The YAML Configuration File (config.yaml)</strong></li></ol><pre>network:<br>  vpc_name: &quot;main-vpc&quot;<br>  description: &quot;main-vpc&quot;<br>  cidr_block: &quot;10.0.0.0/16&quot;<br>  instance_tenancy: &quot;default&quot;<br>  enable_dns_support: true<br>  enable_dns_hostnames: true<br>  subnet_count: 2<br>  subnet_mask: &quot;24&quot;</pre><p><strong>2. The Locals File (locals.tf)</strong></p><pre>locals {<br>  config                  = yamldecode(file(&quot;/../config.yaml&quot;))<br>  cidr_block              = local.config.network.cidr_block<br>  region                  = local.config.global.region<br>  name                    = local.config.network.vpc_name<br>  description             = local.config.network.description<br>  instance_tenancy        = local.config.network.instance_tenancy<br>  enable_dns_hostnames    = local.config.network.enable_dns_hostnames<br>  enable_dns_support      = local.config.network.enable_dns_support<br>}</pre><p><strong>3. The Main Terraform File (main.tf)</strong></p><pre>module &quot;vpc&quot; {<br>  source = &quot;git::https://github.com/nasir19noor/terraform.git//aws/modules/vpc&quot; <br><br>  cidr                 = local.cidr_block<br>  instance_tenancy     = local.instance_tenancy<br>  enable_dns_hostnames = local.enable_dns_hostnames <br>  enable_dns_support   = local.enable_dns_support <br>  name                 = local.name<br>}</pre><p>This simple example demonstrates how YAML can serve as a centralized configuration source for Terraform. The YAML file contains all the configuration parameters, which are then imported into Terraform using the built-in yamldecode function and accessed via locals.</p><p>The beauty of this approach is apparent even in this basic scenario — your infrastructure parameters are clearly defined in a simple, human-readable format, separate from the Terraform code that implements them. This separation makes both the configuration and implementation easier to understand and maintain.</p><h3><strong>YAML Centralized Configuration vs. Traditional .tfvars</strong></h3><p>Terraform already offers variable files (.tfvars) for parameterization. Let’s compare this with YAML centralized configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/336b4ab4337e0bbc76834e357dc54ced/href">https://medium.com/media/336b4ab4337e0bbc76834e357dc54ced/href</a></iframe><h3><strong>Why YAML for Centralized Configuration?</strong></h3><p>YAML has several advantages that make it ideal for Terraform configuration:</p><ol><li><strong>Human-Readable</strong>: YAML’s clean syntax is approachable for both technical and non-technical team members.</li><li><strong>Hierarchical Structure</strong>: YAML naturally represents nested data structures, perfect for complex infrastructure.</li><li><strong>Native Terraform Support</strong>: Terraform’s built-in yamldecode function makes integration straightforward.</li><li><strong>Wide Adoption</strong>: YAML is already used in Kubernetes, GitHub Actions, and Ansible, making it familiar for many teams.</li><li><strong>Schema Validation</strong>: Tools like yamllint can validate YAML files before processing.</li></ol><h3><strong>Benefits of YAML Centralized Configuration</strong></h3><p>Our client experienced several immediate benefits after implementing YAML centralized configuration:</p><h4>1. Simplified Onboarding</h4><p>New team members could understand the infrastructure by reading simple YAML files rather than complex HCL code. The learning curve dropped dramatically, with engineers becoming productive in days instead of weeks.</p><h4>2. Reduced Configuration Errors</h4><p>By centralizing configuration parameters in YAML, they eliminated inconsistencies that previously occurred when values were duplicated across multiple files. This reduced deployment failures by over 40%.</p><h4>3. Faster Environment Deployment</h4><p>Creating a new environment became as simple as copying a YAML file and modifying a few values. What previously took days now took hours.</p><h4>4. Improved Cross-Team Collaboration</h4><p>Product managers and developers could now review and suggest infrastructure changes by looking at simple YAML files, rather than trying to decipher Terraform code.</p><h4>5. Version-Controlled Infrastructure</h4><p>All infrastructure changes were clearly visible in version control as simple YAML changes, making it easy to audit and review infrastructure evolution over time.</p><p>After implementing the YAML centralized configuration approach, our Singapore client saw dramatic improvements in their AWS infrastructure management:</p><ul><li><strong>Reduce Deployment Time</strong></li><li><strong>Decrease Configuration Errors</strong></li><li><strong>Cut Developer Onboarding</strong></li><li><strong>Simplify Audit Compliance</strong></li></ul><p>YAML centralized configuration represents a simple yet powerful approach to supercharging your Terraform automation. By separating configuration from implementation, you create a more maintainable, flexible, and user-friendly infrastructure management system.</p><p>The real-world examples shown in this article demonstrate that you don’t need complex tools or frameworks to get started — Terraform’s built-in YAML support is often sufficient for initial implementation. As your infrastructure grows, you can expand your approach with more sophisticated patterns.</p><p>Whether you’re managing a handful of resources or a complex multi-cloud environment, YAML centralized configuration offers a practical path to more maintainable, accessible, and consistent infrastructure deployment. The investment in setting up this approach pays dividends in reduced complexity, fewer errors, and increased collaboration across your organization.</p><p>You can find one example of how I manage Terraform using YAML in my repo <br><a href="https://github.com/nasir19noor/terraform/tree/main/aws/projects/stock-market-real-time-analysis-kafka">https://github.com/nasir19noor/terraform/tree/main/aws/projects/stock-market-real-time-analysis-kafka</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8e6b70d2170" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps Project : AWS Infrastructure and Application Automation with Terraform and Github Actions]]></title>
            <link>https://nasir19noor.medium.com/devops-project-aws-infrastructure-and-application-automation-with-terraform-and-github-actions-89f10f06cdbe?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/89f10f06cdbe</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ec2]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Mon, 12 May 2025 14:48:43 GMT</pubDate>
            <atom:updated>2025-05-12T14:48:43.838Z</atom:updated>
            <content:encoded><![CDATA[<h3>DevOps Project : AWS Infrastructure and Application Automation with Terraform and Github Actions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V6FqXYN0Sd0bIGriYmJovg.png" /></figure><p>Note : you can find all scripts for this project here : <a href="https://github.com/nasir19noor/devops-aws-terraform-docker-actions">https://github.com/nasir19noor/devops-aws-terraform-docker-actions</a></p><p>I first started working with AWS in 2019, doing everything manually through the console. In 2022, I discovered infrastructure automation with Terraform and GitHub Actions, and it completely transformed how I work. I created this sample project to share what I’ve learned along the way.</p><p>This project demonstrates how to automate AWS infrastructure and application deployments using Terraform and GitHub Actions. It’s designed as a learning resource to help others experience the same “aha” moment I had when I realized how powerful these tools can be when used together.</p><p>Before you start this project you need to create : AWS Account, Docker Hub Account and Github Account</p><p><strong>AWS Account</strong></p><p>AWS provides a 1-year free tier for new accounts, which we’ll leverage for this project. Start by creating a new AWS account to access these free services. Once your account is set up, create an IAM user and generate an Access Key to enable programmatic access to AWS resources.</p><p><strong>Docker Hub</strong></p><p>If you don’t have a Docker Hub account, start by visiting <a href="https://hub.docker.com/">Docker Hub</a> and clicking “Sign Up”. Create a free account using your email address. Once registered and logged in, go to your account settings. Navigate to the “Security” or “Access Tokens” section, then click “Create Access Token”. Choose the appropriate permissions for your token (read/write), generate it, and immediately copy the token. Store this token securely, as it will only be displayed once.</p><p><strong>SSH Key Pair</strong></p><p>For creating an SSH key pair, you have two primary methods: using PuTTYgen (for Windows) or ssh-keygen (for Linux/macOS). On Linux or macOS, open a terminal and run ssh-keygen -t rsa -b 4096. This command generates a public and private key pair. When prompted, you can enter a passphrase for additional security or press Enter to skip. The keys will be saved in the default location (~/.ssh/id_rsa for private key and ~/.ssh/id_rsa.pub for public key). For Windows users, download PuTTYgen, click &quot;Generate&quot;, and move your mouse randomly to generate randomness. Save both the private and public keys, ensuring you keep the private key confidential.</p><p><strong>Github</strong></p><p>To create a GitHub account, visit <a href="https://github.com/">github.com</a> and click “Sign up”. Enter your email address, choose a unique username, and create a strong password. Select the appropriate account type (typically Free for personal use) and complete the signup process. Once registered, verify your email address. For enhanced security, enable Two-Factor Authentication (2FA) in your account settings under “Password and authentication”.</p><p>To set up secrets for GitHub Actions, navigate to your repository on GitHub, go to “Settings” &gt; “Secrets and variables” &gt; “Actions”, then click “New repository secret”. Create the following secrets:</p><ul><li>AWS_ACCESS_KEY_ID: Your AWS IAM user access key</li><li>AWS_SECRET_ACCESS_KEY: The corresponding AWS secret access key</li><li>DOCKERHUB_USERNAME: Your Docker Hub username</li><li>DOCKERHUB_TOKEN: The access token generated from Docker Hub</li><li>SSH_PRIVATE_KEY: The contents of your private SSH key (copied from ~/.ssh/id_rsa or the private key file generated with PuTTYgen)</li></ul><p>Ensure you paste the exact values carefully, without any extra spaces or line breaks. These secrets will be encrypted and can be used in your GitHub Actions workflows to authenticate and perform actions securely without exposing sensitive credentials in your code.</p><h3><strong>Infrastruture Setup</strong></h3><p><strong>Initial Setup : Terraform State Bucket</strong></p><ul><li>Navigate to the Terraform bootstrap directory <a href="https://github.com/nasir19noor/devops-aws-terraform-docker-actions/tree/main/terraform/bootstrap/terraform-state">/terraform/bootstrap/terraform-state</a></li><li>Modify the bucket name to match your project’s naming convention in main.yml</li><li>Run the below commands from your local machine</li></ul><pre>terraform init<br>terraform apply</pre><ul><li>This creates the remote state bucket for storing Terraform state files</li></ul><p><strong>Infrastructure Deployment</strong></p><ul><li>All AWS infrastructure configurations are located in <a href="https://github.com/nasir19noor/devops-aws-terraform-docker-actions/tree/main/terraform/services">/terraform/services/</a>.</li><li>Variables can be updated in the terraform.tfvars file</li><li>Modify this file to adjust infrastructure parameters and resource configurations</li></ul><p><strong>Github workflows for Terraform</strong></p><p>We separated 2 yaml file for terraform plan and terraform apply</p><ul><li>The tf-plan.yml workflow is automatically triggered when code is pushed to any branch in the repository</li><li>Any modifications made within the terraform/services/ directory will initiate both the tf-plan and tf-apply workflows depend on the branch.</li><li>When a pull request is merged or code is pushed directly to the main branch, the tf-apply workflow will be executed</li></ul><p>Due to the interdependent nature of infrastructure components, please deploy resources in the following sequence: VPC, subnet, and EC2 instance. Pushing changes to the specific directory will trigger an automatic deployment through GitHub Actions.</p><p><strong>EC2 Access</strong></p><p>After provisioning the EC2 instance, you may access the server securely through AWS Systems Manager (SSM) and proceed with the following tasks:</p><ul><li>Add user</li><li>Grant username with root access</li><li>Modify /etc/ssh/sshd_config</li><li>Add Public key to Authorized Key</li></ul><p>You can see the detail steps here : <a href="https://github.com/nasir19noor/devops-aws-terraform-docker-actions/tree/main/terraform/services/ec2">https://github.com/nasir19noor/devops-aws-terraform-docker-actions/tree/main/terraform/services/ec2</a></p><p>Once done you need to add 2 more secrets for GitHub Actions:</p><ul><li>USER: Your Linux username</li><li>INSTANCE_IP: IP Address of EC2 instance</li></ul><p><strong>Github workflows for Application Deployment</strong></p><p>The workflow <a href="https://github.com/nasir19noor/devops-aws-terraform-docker-actions/blob/main/.github/workflows/app-build-deploy.yml">app-build-deploy.yml</a> is configured to activate under three specific scenarios:</p><ol><li><strong>Push Events</strong>: Triggered when code is pushed to any branch, specifically monitoring changes within the ‘app/’ directory.</li><li><strong>Pull Request Events</strong>: Activated when a pull request is made to the main branch, again focusing on modifications in the ‘app/’ directory.</li><li><strong>Manual Dispatch</strong>: Allows manual triggering of the workflow directly from the GitHub Actions interface, providing flexibility for on-demand builds and deployments.</li></ol><p>The workflow executes a series of sophisticated steps to build, containerize, and deploy the application:</p><ul><li><strong>Repository Checkout</strong>: Retrieves the latest source code using GitHub’s checkout action.</li><li><strong>Docker Buildx Setup</strong>: Configures an advanced Docker build environment, enabling multi-architecture builds and enhanced build capabilities.</li><li><strong>Docker Hub Authentication</strong>: Securely logs into Docker Hub using encrypted credentials stored as GitHub Secrets.</li><li><strong>Image Metadata Preparation</strong>: Dynamically generates Docker image tags, including a ‘latest’ tag and a short Git commit SHA tag for precise version tracking.</li><li><strong>Docker Image Build and Push</strong>: Constructs the Docker image using the application’s Dockerfile and pushes the tagged images to Docker Hub.</li><li><strong>SSH Deployment Configuration</strong>: Sets up SSH credentials for secure remote deployment.</li><li><strong>Remote Deployment</strong>: Connects to the target server, pulls the latest Docker image, stops any running containers, and launches the new application container.</li></ul><p>My journey from manually managing AWS resources to embracing infrastructure automation has been nothing short of revolutionary. This project is more than just a technical walkthrough — it’s a testament to how the right tools can transform your workflow, making complex deployments feel like magic. If you’re a developer or DevOps enthusiast feeling overwhelmed by manual infrastructure management, this is your invitation to break free. Fork the repository, experiment with the code, and experience firsthand how Terraform, GitHub Actions, and Docker can simplify your development process. Don’t just read about automation — start your own automation journey today and unlock a more efficient, stress-free way of building and deploying applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89f10f06cdbe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Kafka Project Series [Part 1 ] : How To Install Apache Kafka on Ubuntu 22.04]]></title>
            <link>https://nasir19noor.medium.com/apache-kafka-project-series-part-1-how-to-install-apache-kafka-on-ubuntu-22-04-13d85983a723?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/13d85983a723</guid>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Mon, 05 May 2025 07:36:54 GMT</pubDate>
            <atom:updated>2025-05-05T07:40:19.034Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache Kafka Project Series [Part 1] : How To Install Apache Kafka on Ubuntu 22.04</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/1*RfpvePOUW0HpVl4qn1KsKA.jpeg" /></figure><p>Last month, I found myself facing a common challenge in tech: needing to quickly learn a tool I barely knew.</p><p>My client decided to move their services from GCP to AWS, and many of these services used Kafka — something I only understood in theory. As part of the migration team, I needed to get up to speed quickly.</p><p>Despite being on the project for a while, I only recently started learning Kafka in depth. What followed was a bit overwhelming — I searched through tutorials, blog posts, and documentation, but couldn’t find that one clear resource that connected all the dots.</p><p>After combining information from different sources (including some helpful AI assistance), I finally set up my own Kafka server to practice with.</p><p>This guide is what I wish I’d found when starting out — a straightforward, tested walkthrough for anyone looking to understand Kafka.</p><p>Whether you’re under pressure to learn quickly or just curious about this technology, I’ve put together everything you need to set up a working Kafka environment, even if you’re completely new to it.</p><p><strong>Prerequisite</strong></p><ul><li>A VM with at least 2 vCPUs and 2 GB of Memory is required. For example, on AWS, a t3.small instance should be used, as smaller instances like t3.micro may lead to memory exhaustion issues</li><li>Ubuntu 22.04. Another version may need script modification</li></ul><h3>Install Java</h3><p>For latest kafka version it required newer Java version</p><pre>sudo apt-get update <br>sudo apt install openjdk-17-jdk -y<br>java -version</pre><h3>Install Kafka</h3><ol><li><strong>Download and extract kafka</strong></li></ol><pre>sudo wget https://dlcdn.apache.org/kafka/4.0.0/kafka_2.13-4.0.0.tgz<br>tar -xvf kafka_2.13-4.0.0.tgz<br>sudo mv kafka_2.13-4.0.0 /opt<br>sudo ln -s /opt/kafka_2.13-4.0.0 /opt/kafka</pre><p><strong>2. Set path for kafka</strong></p><ul><li>open .profile file. If you use root user the file located in /root/.profile</li></ul><pre>sudo nano .profile</pre><ul><li>Add following line in <em>.profile </em>and save</li></ul><pre>export PATH=/opt/kafka/bin:$PATH</pre><ul><li>Update the changes in <em>.profile</em></li></ul><pre>source .profile</pre><p><strong>3. Creating Log Directory</strong></p><ul><li>Create directory /var/log/kafka and assign it with proper permission</li></ul><pre>sudo mkdir -p /var/log/kafka <br>sudo chown -R root:root /var/log/kafka <br>sudo chmod 755 /var/log/kafka</pre><p><strong>4. Creating Kraft Server Properties</strong></p><ul><li>Create directory for Kraft configuration</li></ul><pre>sudo mkdir -p /opt/kafka/config/kraft</pre><ul><li>Copy existing configuration to kraft diretory</li></ul><pre>sudo cp /opt/kafka/config/server.properties /opt/kafka/config/kraft/server.properties</pre><ul><li>Update /opt/kafka/config/kraft/server.properties with following configuration</li></ul><pre># The role of this server. Setting this puts us in KRaft mode<br>process.roles=broker,controller<br># The node id associated with this instance<br>node.id=1<br># The connect string for the controller quorum<br>controller.quorum.voters=1@localhost:9093<br># Listeners<br>listeners=PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093<br>inter.broker.listener.name=PLAINTEXT<br>advertised.listeners=PLAINTEXT://localhost:9092<br>controller.listener.names=CONTROLLER<br>listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL<br># Logs configuration<br>log.dirs=/var/log/kafka<br>num.partitions=1<br>num.recovery.threads.per.data.dir=1<br>default.replication.factor=1<br>offsets.topic.replication.factor=1<br>transaction.state.log.replication.factor=1<br>transaction.state.log.min.isr=1<br># Log retention policies<br>log.retention.hours=168<br>log.segment.bytes=1073741824<br>log.retention.check.interval.ms=300000<br># Other configurations<br>group.initial.rebalance.delay.ms=0</pre><p><strong>5. Creating Systemd Unit Files</strong></p><p>You need to create systemd unit files for the Kafka services, which will help you start/stop the Kafka service easily</p><ul><li>open /etc/systemd/system/kafka.service file</li></ul><pre>sudo nano /etc/systemd/system/kafka.service</pre><ul><li>add following content and save</li></ul><pre>[Unit] <br>Description=Apache Kafka Server (KRaft mode)<br>Documentation=http://kafka.apache.org/documentation.html </pre><p><strong>6. Initialize Kafka’s Cluster Storage System</strong></p><p>Kafka 4.x by default using Kafka Raft (KRaft) mode which has replaced ZooKeeper. Following are command to initialize cluster storage system</p><ul><li>Generating a random 32-character cluster ID. It creates a unique identifier for your Kafka cluster</li></ul><pre>KAFKA_CLUSTER_ID=$(cat /dev/urandom | tr -dc &#39;a-zA-Z0-9&#39; | fold -w 32 | head -n 1)</pre><ul><li>Printing the generated ID</li></ul><pre>echo &quot;Using cluster ID: $KAFKA_CLUSTER_ID&quot;</pre><ul><li>Formatting the Kafka storage directories</li></ul><pre>sudo /opt/kafka/bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c /opt/kafka/config/kraft/server.properties</pre><p><strong>7. Starting Kafka</strong></p><pre>sudo systemctl daemon-reload<br>sudo systemctl enable kafka <br>sudo systemctl start kafka <br>sudo systemctl status kafka</pre><p>If you see below status, congrats. You completed install kafka on Ubuntu 22.04</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*cI3aNUc7_UIbsZsogn54Xg.png" /></figure><p>I created script to automatically install kafka on Ubuntu 22.04. You can see the script here : <a href="https://github.com/nasir19noor/tools/blob/main/kafka/ubuntu-22.04/kafka-kraft.sh">link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13d85983a723" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[5 Fakta tentang AWS yang Perlu Diketahui]]></title>
            <link>https://medium.com/dsf-developers/5-fakta-tentang-aws-yang-perlu-diketahui-8a3f6683cb5a?source=rss-841d64bda35b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a3f6683cb5a</guid>
            <category><![CDATA[amazon-web-services]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[cloud-providers]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Nasir Noor]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 06:01:11 GMT</pubDate>
            <atom:updated>2022-02-21T06:01:11.449Z</atom:updated>
            <content:encoded><![CDATA[<p>Pada Desember 2021, Amazon Web Services (AWS) mengumumkan secara resmi peluncuran layanan mereka di region Jakarta dengan kode ‘ap-souhteast-1’. Ini meramaikan persaingan pasar <em>cloud </em>di Indonesia setelah sebelumnya dua layanan <em>public cloud, </em>Alibaba dan Google Cloud Platform (GCP), sudah lebih dulu meluncur di region yang sama.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NJNjobLNqJuU6pyhJSoA4Q.jpeg" /><figcaption>Illustration by DSF Web Services &amp; Freepik</figcaption></figure><p>Dibandingkan dua pemain <em>cloud </em>besar tersebut, AWS terbilang lambat memasuki pasar Indonesia. Meskipun rencana peluncuran region Jakarta sudah lama diumumkan, AWS baru bisa merealisasikan akhir tahun lalu. Apa saja yang menarik tentang AWS? Berikut kami sajakan fakta-faktanya.</p><p><strong>1. Penyedia <em>Infrastructure as a Service</em> Pertama</strong></p><p>AWS meluncurkan layanan <em>cloud </em>mereka pada Agustus 2006 dengan memperkenalkan <em>Elastic Compute Cloud </em>(EC2) dan <em>Simple Storage Service </em>(S3). Pada awalnya, Amazon membangun platform infrastruktur internal mereka dan menyadari bahwa platform tersebut bisa dijual. Melihat antusiasme pengguna begitu luar biasa, pemain-pemain lain bermunculan, seperti Google pada 2008, Azure pada 2010, kemudian disusul pemain lainnya yang ikut mencicipi manisnya industri <em>cloud</em>.</p><p><strong>2. Market Share Terbesar</strong></p><p>Berdasarkan laporan Q1 2021, AWS memimpin pasar <em>cloud</em> dengan 32% market share, disusul Azure 20% dan GCP 9%. Dengan pencapaian ini, AWS secara praktis menguasai hampir sepertiga kue <em>cloud. </em>Tentu akan sangat sulit bagi platform lain untuk menyusul AWS. Selain memiliki keuntungan karena meluncurkan <em>cloud</em> IaaS pertama, AWS juga menawarkan layanan yang beragam dan fokus pada pelanggan mereka. Inilah yang mengukuhkan AWS sebagai penguasa pasar <em>cloud</em> hingga saat ini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w5qOQ6NMkq2dyHOcfxL9Ew.jpeg" /><figcaption>sumber : <a href="https://i.pinimg.com/originals/e8/c6/2f/e8c62fe995e7cef80f609d9a70ac50a0.jpg">https://i.pinimg.com/originals/e8/c6/2f/e8c62fe995e7cef80f609d9a70ac50a0.jpg</a></figcaption></figure><p><strong>3. Memiliki Lebih dari 200 Layanan</strong></p><p>Hingga saat ini AWS menawarkan lebih dari 200 layanan yang mencakup hampir semua kebutuhan, seperti <em>compute, networking, storage, database</em>, AI, ML, IoT, dan sebagainya.</p><p>Dengan banyaknya layanan yang ditawarkan, pengguna memiliki banyak pilihan yang bisa disesuaikan dengan kebutuhan mereka. Namun, di sisi lain pengguna sering kali dibuat bingung ketika harus memilih layanan yang hampir sama.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-baK939Ch5Ts9ebteQWUFA.jpeg" /><figcaption>sumber : <a href="https://static.packt-cdn.com/products/9781787124349/graphics/1774b9b4-55ed-48b8-985c-64c0a55e8c7d.jpg">https://static.packt-cdn.com/products/9781787124349/graphics/1774b9b4-55ed-48b8-985c-64c0a55e8c7d.jpg</a></figcaption></figure><p><strong>4. Sertifikat Paling Diburu</strong></p><p>Sebagaimana provider lain AWS juga mengeluarkan sertifikasi profesional untuk membantu ekosistem pengguna AWS. Sertifikasi AWS menjadi standar de facto di industri <em>cloud</em>. Bagi profesional yang ingin berkecimpung di dunia <em>cloud</em>, menjadi “kewajiban” untuk mengambil sertifikasi AWS. Selain menaikkan “harga” bagi pemegang sertifikat, perusahaan juga membutuhkan profesional yang sudah bersertifikat untuk bergabung dalam tim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*a60mZCsrwrxOckROC658cw.png" /><figcaption>sumber <a href="https://aws-developer.com/aws-certifications-1.png">https://aws-developer.com/aws-certifications-1.png</a></figcaption></figure><p><strong>5. Jumlah Region Kalah dengan Azure</strong></p><p>Meskipun memimpin pasar <em>cloud</em>, fakta mengejutkan adalah jumlah region AWS kalah jauh dibandingkan Azure. Berdasarkan data tahun 2020, jumlah region yang dimiliki Azure adalah 57 sedangkan AWS hanya 22. Data terbaru 2021 menyebutkan, jumlah region Azure telah mencapai lebih dari 60, sementara AWS masih bertahan di angka 24. Artinya, jumlah region yang dimiliki Azure lebih dari 2,5 kali milik AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljGwb_9CHT3iAWJDsJsx1g.png" /><figcaption>sumber : <a href="https://i0.wp.com/ryanswanstrom.com/wp-content/uploads/2020/03/regions-per-cloud-provider.png">https://i0.wp.com/ryanswanstrom.com/wp-content/uploads/2020/03/regions-per-cloud-provider.png</a></figcaption></figure><p>Dari semua fakta di atas, kehadiran AWS Region Jakarta bisa dikatakan akan memanjakan dengan semakin banyaknya pilihan <em>cloud provider </em>yang bisa mereka gunakan. Ini juga akan berdampak bagi perusahaan, terutama yang bergerak di bidang finance. Latensi diharapkan akan semakin kecil dan <em>security compliance </em>makin terpenuhi. Semoga hadirnya AWS Region Jakarta akan makin mempercepat transformasi digital di Indonesia.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a3f6683cb5a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/dsf-developers/5-fakta-tentang-aws-yang-perlu-diketahui-8a3f6683cb5a">5 Fakta tentang AWS yang Perlu Diketahui</a> was originally published in <a href="https://medium.com/dsf-developers">DSF Web Services Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>