<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vuong Bach Doan</title>
    <description>The latest articles on DEV Community by Vuong Bach Doan (@bachdoanvuong).</description>
    <link>https://dev.to/bachdoanvuong</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1040166%2F547d9da2-458a-4c44-946d-7ea84bf970c7.jpeg</url>
      <title>DEV Community: Vuong Bach Doan</title>
      <link>https://dev.to/bachdoanvuong</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/bachdoanvuong"/>
    <language>en</language>
    <item>
      <title>[VN] Hướng dẫn Cài đặt CloudWatch Agent để Giám sát Lưu lượng Lightsail (Ubuntu OS)</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Thu, 10 Jul 2025 06:44:20 +0000</pubDate>
      <link>https://dev.to/aws-builders/vn-huong-dan-cai-dat-cloudwatch-agent-tren-ubuntu-de-giam-sat-luu-luong-lightsail-2eac</link>
      <guid>https://dev.to/aws-builders/vn-huong-dan-cai-dat-cloudwatch-agent-tren-ubuntu-de-giam-sat-luu-luong-lightsail-2eac</guid>
      <description>&lt;h2&gt;
  
  
  Tóm tắt
&lt;/h2&gt;

&lt;p&gt;Thiết lập cảnh báo cho lưu lượng truyền tải mỗi tháng khi vượt quá &lt;strong&gt;50% hoặc 80% của 4TB&lt;/strong&gt; (giới hạn miễn phí của gói Lightsail 4GB):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bước 1&lt;/strong&gt;: Lấy metric Network In/Out từ CloudWatch.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bước 2&lt;/strong&gt;: Tạo cron job tính tổng lưu lượng.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bước 3&lt;/strong&gt;: Tạo cảnh báo (alarm) khi vượt ngưỡng.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Trước khi bắt đầu, cài AWS CLI
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  1. Khởi tạo IAM User
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Truy cập &lt;a href="https://console.aws.amazon.com/iam" rel="noopener noreferrer"&gt;AWS IAM Console&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chọn &lt;strong&gt;Users&lt;/strong&gt; &amp;gt; &lt;strong&gt;Create user&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nhập tên: &lt;code&gt;lightsail-cloudwatch-agent&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chọn &lt;strong&gt;Attach policies directly&lt;/strong&gt; và gán policy &lt;code&gt;CloudWatchAgentServerPolicy&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Nhấn &lt;strong&gt;Next&lt;/strong&gt;, thêm tag (tùy chọn), và chọn &lt;strong&gt;Create user&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sau khi tạo, chọn user &amp;gt; &lt;strong&gt;Create access key&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chọn &lt;strong&gt;CLI use case&lt;/strong&gt;, tải file &lt;code&gt;.csv&lt;/code&gt; chứa &lt;code&gt;Access key&lt;/code&gt; và &lt;code&gt;Secret&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  2. Cài đặt và Cấu hình CloudWatch Agent
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Bước 1: Cài đặt CloudWatch Agent
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-y&lt;/span&gt; wget unzip
wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
&lt;span class="nb"&gt;sudo &lt;/span&gt;dpkg &lt;span class="nt"&gt;-i&lt;/span&gt; amazon-cloudwatch-agent.deb

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Bước 2: Thiết lập credential profile
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure &lt;span class="nt"&gt;--profile&lt;/span&gt; AmazonCloudWatchAgent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Nhập &lt;code&gt;Access Key&lt;/code&gt; và &lt;code&gt;Secret&lt;/code&gt; từ bước trước.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Region: &lt;code&gt;ap-southeast-1&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Output format: để trống hoặc &lt;code&gt;json&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Cấu hình CloudWatch Agent
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Bước 1: Tạo file config metric
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /opt/aws/amazon-cloudwatch-agent/bin/config.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dán nội dung sau:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"metrics_collection_interval"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"run_as_user"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"root"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"region"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ap-southeast-1"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"metrics"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"append_dimensions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"InstanceId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"${aws:InstanceId}"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"metrics_collected"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"net"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"measurement"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"bytes_recv"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"bytes_sent"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"metrics_collection_interval"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"resources"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="s2"&gt;"*"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"total"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Bước 2: Thiết lập profile sử dụng
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;nano /opt/aws/amazon-cloudwatch-agent/etc/common-config.toml

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dán nội dung sau:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight toml"&gt;&lt;code&gt;&lt;span class="nn"&gt;[credentials]&lt;/span&gt;
&lt;span class="py"&gt;shared_credential_profile&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"AmazonCloudWatchAgent"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Lưu lại bằng tổ hợp &lt;code&gt;Ctrl + O&lt;/code&gt;, &lt;code&gt;Enter&lt;/code&gt;, sau đó &lt;code&gt;Ctrl + X&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bước 3: Khởi động Agent
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl &lt;span class="nt"&gt;-a&lt;/span&gt; fetch-config &lt;span class="nt"&gt;-m&lt;/span&gt; ec2 &lt;span class="nt"&gt;-c&lt;/span&gt; file:/opt/aws/amazon-cloudwatch-agent/bin/config.json &lt;span class="nt"&gt;-s&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kiểm tra trạng thái:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo&lt;/span&gt; /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl &lt;span class="nt"&gt;-a&lt;/span&gt; status

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Kiểm tra Metric Trên CloudWatch
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Vào &lt;a href="https://console.aws.amazon.com/cloudwatch/" rel="noopener noreferrer"&gt;CloudWatch Console&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chọn &lt;strong&gt;Metrics &amp;gt; All metrics &amp;gt; Browse&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kiểm tra tại &lt;strong&gt;Custom namespaces &amp;gt; CWAgent&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Để tìm &lt;code&gt;Instance ID&lt;/code&gt; và &lt;code&gt;interface&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws cloudwatch list-metrics &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--namespace&lt;/span&gt; &lt;span class="s2"&gt;"CWAgent"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--metric-name&lt;/span&gt; &lt;span class="s2"&gt;"net_bytes_recv"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; ap-southeast-1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output&lt;/span&gt; json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5. Cron Job Tính Tổng Lưu Lượng Mỗi Tháng
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Bước 1: Tạo script
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;nano ~/network_monthly_usage.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dán nội dung sau (chỉnh &lt;code&gt;INSTANCE_ID&lt;/code&gt; và &lt;code&gt;INTERFACE_NAME&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;AWS_PROFILE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;AmazonCloudWatchAgent

&lt;span class="nv"&gt;INSTANCE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"i-07b283c143999f4d0"&lt;/span&gt;
&lt;span class="nv"&gt;INTERFACE_NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"eth0"&lt;/span&gt;
&lt;span class="nv"&gt;REGION&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ap-southeast-1"&lt;/span&gt;

&lt;span class="nv"&gt;START_DATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; +%Y-%m-01T00:00:00Z&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nv"&gt;END_DATE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="nt"&gt;-u&lt;/span&gt; +%Y-%m-%dT%H:%M:%SZ&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nv"&gt;RECV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;aws cloudwatch get-metric-data &lt;span class="nt"&gt;--metric-data-queries&lt;/span&gt; &lt;span class="s2"&gt;"[{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Id&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;recv&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;MetricStat&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Metric&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Namespace&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;CWAgent&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;MetricName&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;net_bytes_recv&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Dimensions&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;InstanceId&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Value&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$INSTANCE_ID&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;},{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;interface&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Value&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$INTERFACE_NAME&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}]} ,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Period&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:86400,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Stat&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Sum&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;},&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;ReturnData&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:true}]"&lt;/span&gt; &lt;span class="nt"&gt;--start-time&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$START_DATE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--end-time&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$END_DATE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--region&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$REGION&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'MetricDataResults[0].Values'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; text | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{sum+=$1} END {print sum+0}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;SENT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;aws cloudwatch get-metric-data &lt;span class="nt"&gt;--metric-data-queries&lt;/span&gt; &lt;span class="s2"&gt;"[{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Id&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;sent&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;MetricStat&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Metric&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Namespace&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;CWAgent&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;MetricName&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;net_bytes_sent&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Dimensions&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:[{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;InstanceId&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Value&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$INSTANCE_ID&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;},{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Name&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;interface&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Value&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="nv"&gt;$INTERFACE_NAME&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}]} ,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Period&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:86400,&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Stat&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;Sum&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;},&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;ReturnData&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:true}]"&lt;/span&gt; &lt;span class="nt"&gt;--start-time&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$START_DATE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--end-time&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$END_DATE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--region&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$REGION&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="s1"&gt;'MetricDataResults[0].Values'&lt;/span&gt; &lt;span class="nt"&gt;--output&lt;/span&gt; text | &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="s1"&gt;'{sum+=$1} END {print sum+0}'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;TOTAL_BYTES&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$RECV&lt;/span&gt;&lt;span class="s2"&gt; + &lt;/span&gt;&lt;span class="nv"&gt;$SENT&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | bc&lt;span class="si"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;TOTAL_GB&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"scale=3; &lt;/span&gt;&lt;span class="nv"&gt;$TOTAL_BYTES&lt;/span&gt;&lt;span class="s2"&gt; / 1024 / 1024 / 1024"&lt;/span&gt; | bc&lt;span class="si"&gt;)&lt;/span&gt;

aws cloudwatch put-metric-data &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--namespace&lt;/span&gt; &lt;span class="s2"&gt;"Custom/MonthlyNetworkTraffic"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--metric-name&lt;/span&gt; &lt;span class="s2"&gt;"TotalNetworkTrafficBytes"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--value&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$TOTAL_BYTES&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--unit&lt;/span&gt; Bytes &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$REGION&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Total monthly traffic so far for &lt;/span&gt;&lt;span class="nv"&gt;$INSTANCE_ID&lt;/span&gt;&lt;span class="s2"&gt; (&lt;/span&gt;&lt;span class="nv"&gt;$INTERFACE_NAME&lt;/span&gt;&lt;span class="s2"&gt;): &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;TOTAL_GB&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; GiB"&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"Metric pushed to CloudWatch: Custom/MonthlyNetworkTraffic → TotalNetworkTrafficBytes"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Cấp quyền thực thi:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ~/network_monthly_usage.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Bước 2: Tạo cron job
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;crontab &lt;span class="nt"&gt;-e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thêm dòng sau (chạy mỗi phút):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; &lt;span class="k"&gt;*&lt;/span&gt; /bin/bash /home/ubuntu/network_monthly_usage.sh &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /home/ubuntu/network_usage.log 2&amp;gt;&amp;amp;1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kiểm tra log:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;tail&lt;/span&gt; &lt;span class="nt"&gt;-n&lt;/span&gt; 50 /home/ubuntu/network_usage.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  6. Tạo Alarm Cảnh Báo
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Truy cập &lt;strong&gt;CloudWatch Console&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vào &lt;strong&gt;Alarms &amp;gt; All alarms &amp;gt; Create alarm &amp;gt; Select metric&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chọn namespace: &lt;code&gt;Custom/MonthlyNetworkTraffic&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chọn metric: &lt;code&gt;TotalNetworkTrafficBytes&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thiết lập threshold:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-   Statistic: Average

-   Period: 1 minute

-   Threshold type: Static

-   Condition: Greater than or equal to `2199023255552` (Bytes = 50% của 4TB)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt; Chọn gửi cảnh báo qua email với SNS:&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-   Chọn Create new topic

-   Đặt tên và nhập email nhận cảnh báo

-   Xác nhận email khi nhận được
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt; Đặt tên cho alarm, xác nhận và tạo.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  7. Tạo Alarm thứ hai (80%)
&lt;/h2&gt;

&lt;p&gt;Lặp lại các bước trên, thay giá trị ngưỡng thành &lt;code&gt;3518437208883&lt;/code&gt; Bytes (~80% của 4TB).&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ Kết luận
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  Khi lưu lượng vượt ngưỡng 50% hoặc 80%/tháng, hệ thống sẽ gửi cảnh báo email.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
      <category>lightsail</category>
      <category>cloudwatch</category>
    </item>
    <item>
      <title>Building a Geometry Dash-Style Game with Amazon Q and AI Tools</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Tue, 27 May 2025 17:19:04 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/building-a-geometry-dash-style-game-with-amazon-q-and-ai-tools-410f</link>
      <guid>https://dev.to/bachdoanvuong/building-a-geometry-dash-style-game-with-amazon-q-and-ai-tools-410f</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06" class="crayons-story__hidden-navigation-link"&gt;I build a game within 15 minutes with Amazon Q CLI and AI Tools&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;
          &lt;a class="crayons-logo crayons-logo--l" href="/aws-builders"&gt;
            &lt;img alt="AWS Community Builders  logo" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F2794%2F88da75b6-aadd-4ea1-8083-ae2dfca8be94.png" class="crayons-logo__image"&gt;
          &lt;/a&gt;

          &lt;a href="/bachdoanvuong" class="crayons-avatar  crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1040166%2F547d9da2-458a-4c44-946d-7ea84bf970c7.jpeg" alt="bachdoanvuong profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/bachdoanvuong" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Vuong Bach Doan
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Vuong Bach Doan
                
              
              &lt;div id="story-author-preview-content-2534201" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/bachdoanvuong" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1040166%2F547d9da2-458a-4c44-946d-7ea84bf970c7.jpeg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Vuong Bach Doan&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

            &lt;span&gt;
              &lt;span class="crayons-story__tertiary fw-normal"&gt; for &lt;/span&gt;&lt;a href="/aws-builders" class="crayons-story__secondary fw-medium"&gt;AWS Community Builders &lt;/a&gt;
            &lt;/span&gt;
          &lt;/div&gt;
          &lt;a href="https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;May 27 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06" id="article-link-2534201"&gt;
          I build a game within 15 minutes with Amazon Q CLI and AI Tools
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/aws"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;aws&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/awschallenge"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;awschallenge&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/amazonqcli"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;amazonqcli&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;11&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              1&lt;span class="hidden s:inline"&gt; comment&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            3 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>aws</category>
      <category>awschallenge</category>
      <category>amazonqcli</category>
    </item>
    <item>
      <title>I build a game within 15 minutes with Amazon Q CLI and AI Tools</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Tue, 27 May 2025 17:18:09 +0000</pubDate>
      <link>https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06</link>
      <guid>https://dev.to/aws-builders/i-build-a-game-within-15-minutes-with-amazon-q-cli-and-ai-tools-5f06</guid>
      <description>&lt;h1&gt;
  
  
  &lt;strong&gt;Building a Geometry Dash-Style Game with Amazon Q and AI Tools&lt;/strong&gt;
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;This guide walks through the process of creating a simple Geometry Dash-inspired game using Amazon Q, Bedrock, and various creative tools. The main steps include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Drafting a game idea and refining it into a structured prompt using Bedrock (Claude 3 Haiku)&lt;/li&gt;
&lt;li&gt;Generating the initial game project with Amazon Q CLI&lt;/li&gt;
&lt;li&gt;Enhancing visuals and audio using Figma, Stable Audio &amp;amp; Claude 3 Sonet, and fonts from itch.io&lt;/li&gt;
&lt;li&gt;Writing a helpful &lt;code&gt;README.md&lt;/code&gt; with assistance from Amazon Q CLI&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Q CLI installed and configured&lt;/li&gt;
&lt;li&gt;Python installed on your system&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1: Create a High-Quality Prompt with Bedrock
&lt;/h2&gt;

&lt;p&gt;To kickstart the project, I drafted my initial game idea and used Amazon Bedrock (Claude 3 Haiku) to help refine it into a well-structured prompt for Amazon Q.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My initial idea:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I have an idea of using Amazon Q to create a game with Pygame, the game style is like Geometry Dash. The player presses SPACE to jump, R to restart the game. Include an "x2" coin that boosts speed and doubles coin collection. Provide a well-structured prompt for Amazon Q to generate the game project.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Claude's refined prompt:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a 2D side-scrolling platform game inspired by Geometry Dash using Pygame with the following features and requirements:

## Game Mechanics:
- Auto-forward movement
- Jump with SPACE
- Restart with R
- Coins to collect
- "x2" power-up that doubles speed and coin value

## Technical Implementation:
- Object-oriented structure
- Classes for game manager, player, obstacles, coins, power-ups, UI

## Visuals and Controls:
- Simple geometric character
- Spikes and obstacles
- Parallax scrolling background
- Score counter and game over screen

## Additional Features:
- Sound effects and music
- Particle effects
- Progressive difficulty
- High score system

Please use modular code files and implement proper game loops, collision detection, and resource management.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run &lt;code&gt;q chat&lt;/code&gt;, paste the prompt, and Amazon Q will generate a basic folder structure like the one below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbojwy6zi7sl6ygsk9so2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbojwy6zi7sl6ygsk9so2.png" alt="Generated folder structure"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Enhance the Game with Custom Assets
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🎵 Generate a Custom Theme Song with Stable Audio
&lt;/h3&gt;

&lt;p&gt;I used Claude 3 Sonet via Bedrock to generate a prompt for a custom game theme:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Geometry Dash-Style Electronic Theme Song
- Tempo: 160 BPM
- Key: F minor
- Loop duration: 30s seamless loop
- Instruments: bright saw synth, digital tom rolls, square wave arpeggios, side-chained kick and snare, reverse cymbals
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Paste this into Stable Audio to generate a high-energy game soundtrack.&lt;/p&gt;

&lt;p&gt;You can download my generated theme song here: Cloud Dash Song&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffk9au0vdce71upba7mqn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffk9au0vdce71upba7mqn.png" alt="Stable Audio Preview"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🧍‍♂️ Create Custom Characters with Figma
&lt;/h3&gt;

&lt;p&gt;Use &lt;a href="https://figma.com" rel="noopener noreferrer"&gt;Figma&lt;/a&gt; to draw and export a unique character sprite for your game.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6tgo83ss4z5yw1iu52bg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6tgo83ss4z5yw1iu52bg.png" alt="Character design in Figma"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🔤 Add Pixel-Style Fonts
&lt;/h3&gt;

&lt;p&gt;You can find retro and pixel-style fonts on &lt;a href="https://itch.io" rel="noopener noreferrer"&gt;itch.io&lt;/a&gt; to enhance the game's visual appeal.&lt;/p&gt;




&lt;h3&gt;
  
  
  🛠️ Fix Bugs and Add Features with Amazon Q
&lt;/h3&gt;

&lt;p&gt;Use &lt;code&gt;q chat&lt;/code&gt; to ask Amazon Q for help with fixing bugs or extending game logic. It can assist in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Debugging game logic&lt;/li&gt;
&lt;li&gt;Adding new mechanics&lt;/li&gt;
&lt;li&gt;Refactoring code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Also, ask Amazon Q to write your &lt;code&gt;README.md&lt;/code&gt; file for better project documentation.&lt;/p&gt;




&lt;h2&gt;
  
  
  DEMO
&lt;/h2&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/EGyLwYhnBaA"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;All source code will be on my GitHub repo: &lt;a href="https://github.com/vuongbachdoan/cloud-dash" rel="noopener noreferrer"&gt;Cloud Dash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>awschallenge</category>
      <category>amazonqcli</category>
    </item>
    <item>
      <title>From Capstone to Cloud: Deploying a Steam-like Platform for Students with AWS 🚀</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Wed, 21 May 2025 08:27:36 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/from-capstone-to-cloud-deploying-a-steam-like-platform-for-students-with-aws-48mf</link>
      <guid>https://dev.to/bachdoanvuong/from-capstone-to-cloud-deploying-a-steam-like-platform-for-students-with-aws-48mf</guid>
      <description>&lt;div class="ltag__link--embedded"&gt;
  &lt;div class="crayons-story "&gt;
  &lt;a href="https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5" class="crayons-story__hidden-navigation-link"&gt;Building GameHub Platform: A Steam-like Ecosystem for Students with AWS Cloud&lt;/a&gt;


  &lt;div class="crayons-story__body crayons-story__body-full_post"&gt;
    &lt;div class="crayons-story__top"&gt;
      &lt;div class="crayons-story__meta"&gt;
        &lt;div class="crayons-story__author-pic"&gt;
          &lt;a class="crayons-logo crayons-logo--l" href="/aws-builders"&gt;
            &lt;img alt="AWS Community Builders  logo" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F2794%2F88da75b6-aadd-4ea1-8083-ae2dfca8be94.png" class="crayons-logo__image"&gt;
          &lt;/a&gt;

          &lt;a href="/bachdoanvuong" class="crayons-avatar  crayons-avatar--s absolute -right-2 -bottom-2 border-solid border-2 border-base-inverted  "&gt;
            &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1040166%2F547d9da2-458a-4c44-946d-7ea84bf970c7.jpeg" alt="bachdoanvuong profile" class="crayons-avatar__image"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;a href="/bachdoanvuong" class="crayons-story__secondary fw-medium m:hidden"&gt;
              Vuong Bach Doan
            &lt;/a&gt;
            &lt;div class="profile-preview-card relative mb-4 s:mb-0 fw-medium hidden m:inline-block"&gt;
              
                Vuong Bach Doan
                
              
              &lt;div id="story-author-preview-content-2509663" class="profile-preview-card__content crayons-dropdown branded-7 p-4 pt-0"&gt;
                &lt;div class="gap-4 grid"&gt;
                  &lt;div class="-mt-4"&gt;
                    &lt;a href="/bachdoanvuong" class="flex"&gt;
                      &lt;span class="crayons-avatar crayons-avatar--xl mr-2 shrink-0"&gt;
                        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1040166%2F547d9da2-458a-4c44-946d-7ea84bf970c7.jpeg" class="crayons-avatar__image" alt=""&gt;
                      &lt;/span&gt;
                      &lt;span class="crayons-link crayons-subtitle-2 mt-5"&gt;Vuong Bach Doan&lt;/span&gt;
                    &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="print-hidden"&gt;
                    
                      Follow
                    
                  &lt;/div&gt;
                  &lt;div class="author-preview-metadata-container"&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;

            &lt;span&gt;
              &lt;span class="crayons-story__tertiary fw-normal"&gt; for &lt;/span&gt;&lt;a href="/aws-builders" class="crayons-story__secondary fw-medium"&gt;AWS Community Builders &lt;/a&gt;
            &lt;/span&gt;
          &lt;/div&gt;
          &lt;a href="https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5" class="crayons-story__tertiary fs-xs"&gt;&lt;time&gt;May 21 '25&lt;/time&gt;&lt;span class="time-ago-indicator-initial-placeholder"&gt;&lt;/span&gt;&lt;/a&gt;
        &lt;/div&gt;
      &lt;/div&gt;

    &lt;/div&gt;

    &lt;div class="crayons-story__indention"&gt;
      &lt;h2 class="crayons-story__title crayons-story__title-full_post"&gt;
        &lt;a href="https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5" id="article-link-2509663"&gt;
          Building GameHub Platform: A Steam-like Ecosystem for Students with AWS Cloud
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;div class="crayons-story__tags"&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/aws"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;aws&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/devops"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;devops&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/kubernetes"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;kubernetes&lt;/a&gt;
            &lt;a class="crayons-tag  crayons-tag--monochrome " href="/t/microservices"&gt;&lt;span class="crayons-tag__prefix"&gt;#&lt;/span&gt;microservices&lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="crayons-story__bottom"&gt;
        &lt;div class="crayons-story__details"&gt;
          &lt;a href="https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left"&gt;
            &lt;div class="multiple_reactions_aggregate"&gt;
              &lt;span class="multiple_reactions_icons_container"&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/exploding-head-daceb38d627e6ae9b730f36a1e390fca556a4289d5a41abb2c35068ad3e2c4b5.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/multi-unicorn-b44d6f8c23cdd00964192bedc38af3e82463978aa611b4365bd33a0f1f4f3e97.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
                  &lt;span class="crayons_icon_container"&gt;
                    &lt;img src="https://assets.dev.to/assets/sparkle-heart-5f9bee3767e18deb1bb725290cb151c25234768a0e9a2bd39370c382d02920cf.svg" width="18" height="18"&gt;
                  &lt;/span&gt;
              &lt;/span&gt;
              &lt;span class="aggregate_reactions_counter"&gt;9&lt;span class="hidden s:inline"&gt; reactions&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/a&gt;
            &lt;a href="https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left flex items-center"&gt;
              Comments


              2&lt;span class="hidden s:inline"&gt; comments&lt;/span&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="crayons-story__save"&gt;
          &lt;small class="crayons-story__tertiary fs-xs mr-2"&gt;
            5 min read
          &lt;/small&gt;
            
              &lt;span class="bm-initial"&gt;
                

              &lt;/span&gt;
              &lt;span class="bm-success"&gt;
                

              &lt;/span&gt;
            
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;


</description>
      <category>aws</category>
      <category>devops</category>
      <category>kubernetes</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Building GameHub Platform: A Steam-like Ecosystem for Students with AWS Cloud</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Wed, 21 May 2025 08:18:26 +0000</pubDate>
      <link>https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5</link>
      <guid>https://dev.to/aws-builders/building-gamehub-platform-a-steam-like-ecosystem-for-students-with-aws-cloud-3mi5</guid>
      <description>&lt;h3&gt;
  
  
  1. Introduction
&lt;/h3&gt;

&lt;p&gt;In this blog post, I’ll share my journey creating &lt;strong&gt;GameHub Platform&lt;/strong&gt;, a student-focused gaming ecosystem inspired by Steam, built using a variety of AWS services.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For security reasons, I won’t reveal sensitive implementation details. Instead, I’ll provide clear architectural insights and technical highlights so you can envision and build a similar system on your own.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  2. Problem Statement
&lt;/h3&gt;

&lt;p&gt;At FPT University, two majors naturally complement each other: graphic design and game development. Students in graphic design create stunning 2D and 3D assets, while game developers craft engaging games. Yet, despite their synergy, these groups lacked a shared platform to &lt;strong&gt;collaborate, showcase, and monetize&lt;/strong&gt; their work.&lt;/p&gt;

&lt;p&gt;Here’s the gap GameHub Platform aims to fill:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Graphic design students&lt;/strong&gt; can upload and display their game assets like images, models, and animations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game development students&lt;/strong&gt; browse, download, and use these assets to build their games.&lt;/li&gt;
&lt;li&gt;Finished games get published and sold right on the platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result? A vibrant ecosystem that promotes &lt;strong&gt;learning, creativity, and entrepreneurship&lt;/strong&gt; among students - a mini Steam tailored for campus talents.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Architecture Overview
&lt;/h3&gt;

&lt;p&gt;Here’s a high-level look at the GameHub Platform’s architecture, organized into three layers:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2oithaf4xqbkuwicycex.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2oithaf4xqbkuwicycex.png" alt="Architecture Overview" width="800" height="376"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  3.1 CI/CD Pipeline
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Source code for frontend and backend lives in GitHub.&lt;/li&gt;
&lt;li&gt;On each commit, &lt;strong&gt;GitHub Actions&lt;/strong&gt; builds Docker images and pushes them to &lt;strong&gt;Amazon ECR&lt;/strong&gt; (Elastic Container Registry).&lt;/li&gt;
&lt;li&gt;Automated deployments trigger updates to development, staging, and production environments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3.2 Cloud Environment
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Backend services run on &lt;strong&gt;Amazon EKS&lt;/strong&gt; (Elastic Kubernetes Service), handling traffic via a &lt;strong&gt;Load Balancer&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Persistent data is stored in a combination of &lt;strong&gt;Amazon RDS&lt;/strong&gt; for relational data, &lt;strong&gt;MongoDB Atlas&lt;/strong&gt; for flexible metadata, and &lt;strong&gt;Amazon S3&lt;/strong&gt; for asset storage.&lt;/li&gt;
&lt;li&gt;Frontend UI is served via &lt;strong&gt;AWS Amplify&lt;/strong&gt; and cached globally with &lt;strong&gt;CloudFront CDN&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Security is enforced using &lt;strong&gt;AWS WAF&lt;/strong&gt;, Security Groups, and network policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3.3 Feature Services
&lt;/h4&gt;

&lt;p&gt;Additional services enrich the platform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Payment Gateway&lt;/strong&gt; integrates Stripe/PayOS for smooth transactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Student ID Verification&lt;/strong&gt; uses Amazon Textract for automated card scanning.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Virus Scanning&lt;/strong&gt; ensures uploaded files are safe using the VirusTotal API.&lt;/li&gt;
&lt;li&gt;Real-time &lt;strong&gt;Notification Service&lt;/strong&gt; alerts users of important events.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. Tech Stack &amp;amp; Key Services Used
&lt;/h3&gt;

&lt;p&gt;Choosing the right tech stack was critical to ensuring the platform could scale, stay secure, and remain cost-effective. Here’s a snapshot of the core tools and why they were chosen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xbebbuinro3nlg8wvuk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5xbebbuinro3nlg8wvuk.png" alt="Image description" width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;strong&gt;Service / Tool&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Category&lt;/strong&gt;&lt;/th&gt;
&lt;th&gt;&lt;strong&gt;Why It Was Chosen&lt;/strong&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Next.js + TailwindCSS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Front-End Framework&lt;/td&gt;
&lt;td&gt;Fast development with modern UI utilities and great SEO support.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AWS Amplify + CloudFront&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Front-End Hosting &amp;amp; CDN&lt;/td&gt;
&lt;td&gt;Low-latency global distribution for frontend assets.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;.NET Core (Dockerized)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Back-End API&lt;/td&gt;
&lt;td&gt;Robust, cross-platform, high-performance microservices.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon ECR&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Container Registry&lt;/td&gt;
&lt;td&gt;Seamless integration with AWS services and CI/CD pipelines.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GitHub Actions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;CI/CD Pipeline&lt;/td&gt;
&lt;td&gt;Native GitHub integration, flexible YAML workflows.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon EKS (Kubernetes)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Container Orchestration&lt;/td&gt;
&lt;td&gt;Managed Kubernetes with scaling, high availability, and strong AWS integration.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;RabbitMQ&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Message Broker&lt;/td&gt;
&lt;td&gt;Decouples services and handles asynchronous tasks efficiently.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon RDS (MySQL)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Relational Database&lt;/td&gt;
&lt;td&gt;Reliable, managed SQL database with automated backups.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon ElastiCache (Redis)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Caching Layer&lt;/td&gt;
&lt;td&gt;Speeds up frequent queries, reduces load on databases.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon OpenSearch&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Log Aggregation &amp;amp; Search&lt;/td&gt;
&lt;td&gt;Centralizes logs for monitoring and troubleshooting.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon S3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Object Storage&lt;/td&gt;
&lt;td&gt;Durable storage for game assets, screenshots, and other user uploads.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AWS WAF + Security Groups&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Protects infrastructure from malicious traffic and controls access.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon Route 53 + ACM&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;DNS &amp;amp; SSL&lt;/td&gt;
&lt;td&gt;Custom domain routing and free TLS certificates.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon CloudWatch&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Monitoring &amp;amp; Logging&lt;/td&gt;
&lt;td&gt;Provides metrics, alarms, and insights for operational health.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;AWS Lambda&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Event-Driven Functions&lt;/td&gt;
&lt;td&gt;Lightweight, on-demand compute for scanning, notifications, and integration.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;VirusTotal API&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Malware Detection&lt;/td&gt;
&lt;td&gt;Automatically scans uploaded files to detect threats.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Amazon Textract&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Document Extraction&lt;/td&gt;
&lt;td&gt;Extracts and verifies student ID card data automatically.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stripe / PayOS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Payment Processing&lt;/td&gt;
&lt;td&gt;Secure and simple API for processing payments.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;MongoDB Atlas&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;NoSQL Data Store&lt;/td&gt;
&lt;td&gt;Flexible metadata storage for assets and user data.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;A thoughtfully chosen tech stack forms the foundation for a reliable, scalable, and maintainable platform.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  5. Deep Dive: Back-End Services on EKS with gRPC
&lt;/h3&gt;

&lt;p&gt;To handle the platform’s complexity, the backend is split into microservices running in a &lt;strong&gt;Kubernetes cluster on Amazon EKS&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  5.1 Microservices Breakdown
&lt;/h4&gt;

&lt;p&gt;Key services include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Main Service:&lt;/strong&gt; Manages games, assets, and user interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payment Service:&lt;/strong&gt; Handles all transaction-related logic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Role Management:&lt;/strong&gt; Manages user permissions and access levels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notification Service:&lt;/strong&gt; Sends emails, in-app alerts, and push notifications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each service runs in its own Kubernetes pod, enabling independent scaling and easier updates.&lt;/p&gt;

&lt;h4&gt;
  
  
  5.2 Why Kubernetes (EKS)?
&lt;/h4&gt;

&lt;p&gt;EKS was selected because:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It offers &lt;strong&gt;automatic scaling&lt;/strong&gt; and &lt;strong&gt;high availability&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Deep integration with AWS services (IAM, CloudWatch, VPC).&lt;/li&gt;
&lt;li&gt;Simplifies deployments using standard Kubernetes tooling and GitOps workflows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This allows the platform to efficiently adapt to varying traffic from student uploads, downloads, and transactions.&lt;/p&gt;

&lt;h4&gt;
  
  
  5.3 gRPC for Inter-Service Communication
&lt;/h4&gt;

&lt;p&gt;Instead of REST APIs, services communicate via &lt;strong&gt;gRPC&lt;/strong&gt; using protocol buffers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Benefit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;Compact binary format for faster serialization.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Low Latency&lt;/td&gt;
&lt;td&gt;Efficient use of HTTP/2 improves speed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strong Typing&lt;/td&gt;
&lt;td&gt;Protobuf contracts reduce errors.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bi-directional&lt;/td&gt;
&lt;td&gt;Supports streaming data and advanced RPCs.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This ensures fast, reliable, and maintainable communication inside the Kubernetes cluster.&lt;/p&gt;

&lt;h4&gt;
  
  
  5.4 Security
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;gRPC traffic is confined to the private VPC network.&lt;/li&gt;
&lt;li&gt;Kubernetes Network Policies restrict service-to-service access.&lt;/li&gt;
&lt;li&gt;Public-facing endpoints are secured with authentication and AWS WAF rules.&lt;/li&gt;
&lt;li&gt;IAM and Kubernetes RBAC policies enforce least privilege access.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  6. Feature Services
&lt;/h3&gt;

&lt;p&gt;Beyond core gameplay and asset management, GameHub Platform integrates specialized services to boost security and usability:&lt;/p&gt;

&lt;h4&gt;
  
  
  6.1 VirusTotal for Malware Scanning
&lt;/h4&gt;

&lt;p&gt;Before any game or asset is published, it is scanned via the VirusTotal API to detect viruses or malware. This protects the community from harmful content and builds trust in the platform.&lt;/p&gt;

&lt;h4&gt;
  
  
  6.2 Amazon Textract for Student ID Verification
&lt;/h4&gt;

&lt;p&gt;Users upload photos of their student ID cards. Amazon Textract extracts textual data, which is then cross-checked against the university’s database to verify enrollment status. This helps gatekeep student-only features.&lt;/p&gt;

&lt;h4&gt;
  
  
  6.3 Payment Gateway Integration
&lt;/h4&gt;

&lt;p&gt;Payments are handled via Stripe or PayOS, offering students an easy and secure way to buy and sell games and assets.&lt;/p&gt;

&lt;h4&gt;
  
  
  6.4 Notification Service
&lt;/h4&gt;

&lt;p&gt;Real-time alerts via email and in-app notifications keep users informed about new assets, transactions, and platform updates.&lt;/p&gt;

&lt;h4&gt;
  
  
  6.5 Storage and Asset Management
&lt;/h4&gt;

&lt;p&gt;Amazon S3 provides scalable, secure storage for all uploaded content, backed by lifecycle policies and encryption.&lt;/p&gt;




&lt;h3&gt;
  
  
  7. Conclusion &amp;amp; Lessons Learned
&lt;/h3&gt;

&lt;p&gt;Building GameHub Platform was a rewarding journey that taught me a lot about cloud architecture, container orchestration, and integrating multiple AWS services to build a real-world application.&lt;/p&gt;

&lt;p&gt;Key takeaways:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modular microservices running on Kubernetes offer flexibility and scalability.&lt;/li&gt;
&lt;li&gt;Using gRPC improves performance and maintainability for internal APIs.&lt;/li&gt;
&lt;li&gt;Cloud-native services like Amazon Textract and VirusTotal APIs add critical security layers.&lt;/li&gt;
&lt;li&gt;Automating deployments with CI/CD pipelines accelerates delivery and reduces errors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you’re inspired to build your own cloud-native platform or want to learn more about AWS, Kubernetes, and modern microservices design, feel free to reach out. I’m happy to share insights or collaborate!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Let’s keep innovating and building great things together!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can contact me at:&lt;br&gt;
📧 &lt;a href="mailto:vbachdoan@gmail.com"&gt;vbachdoan@gmail.com&lt;/a&gt;&lt;br&gt;
🔗 &lt;a href="https://www.linkedin.com/in/vuongbd2007" rel="noopener noreferrer"&gt;LinkedIn Profile: vuongbd2007&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading and happy coding! 🚀&lt;/p&gt;

</description>
      <category>aws</category>
      <category>devops</category>
      <category>kubernetes</category>
      <category>microservices</category>
    </item>
    <item>
      <title>Terraform Automation tool powered by Amazon Q Developer</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Mon, 05 May 2025 10:21:09 +0000</pubDate>
      <link>https://dev.to/aws-builders/terraform-automation-tool-powered-by-amazon-q-developer-3ecc</link>
      <guid>https://dev.to/aws-builders/terraform-automation-tool-powered-by-amazon-q-developer-3ecc</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/aws-amazon-q-v2025-04-30"&gt;Amazon Q Developer "Quack The Code" Challenge&lt;/a&gt;: Crushing the Command Line&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built a &lt;strong&gt;CLI-based automation tool&lt;/strong&gt; called &lt;strong&gt;Terraform Automation Tool&lt;/strong&gt; that simplifies and streamlines the process of managing and bootstrapping AWS infrastructure lab environments using Terraform. The tool allows developers and educators to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose from a list of pre-configured AWS labs (e.g., 3-tier architecture, static websites, RDS setup).&lt;/li&gt;
&lt;li&gt;Automatically generate, configure, and deploy the necessary Terraform code.&lt;/li&gt;
&lt;li&gt;Customize lab scaffolding interactively using a cross-platform terminal interface.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This solves the problem of manual setup and error-prone provisioning of AWS labs, especially useful for students, trainers, and workshop facilitators who want to spin up consistent and reproducible environments quickly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Here's a quick demo of the tool in action:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/BFGhe2YnBs0"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;The CLI interface is intuitive and works across macOS, Linux, and Windows.&lt;/p&gt;




&lt;h2&gt;
  
  
  Code Repository
&lt;/h2&gt;

&lt;p&gt;Explore the full project here:&lt;br&gt;
🔗 &lt;strong&gt;&lt;a href="https://github.com/vuongbachdoan/terraform-automation-bot" rel="noopener noreferrer"&gt;GitHub – vuongbachdoan/terraform-automation-bot&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  How I Used Amazon Q Developer
&lt;/h2&gt;

&lt;p&gt;Amazon Q Developer was instrumental in shaping both the &lt;strong&gt;design&lt;/strong&gt; and &lt;strong&gt;functionality&lt;/strong&gt; of this CLI-based tool. It supported me in building a smart, task-driven menu with the following interactive options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;? What do you want to do?
&amp;gt;   ✨ Generate Terraform Folder Structure
    ✨ Optimize Terraform Source Code
    ✨ Check for Security Issues
    ✨ Deploy Terraform Resources
    ✨ Destroy Terraform Resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here’s how Amazon Q Developer contributed throughout the development process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🛠️ &lt;strong&gt;Generated Terraform scaffolding logic&lt;/strong&gt; for the “Generate Terraform Folder Structure” option, ensuring clean, modular layouts that follow best practices.&lt;/li&gt;
&lt;li&gt;🚀 &lt;strong&gt;Recommended optimizations&lt;/strong&gt; for Terraform source code by highlighting unused variables, redundant resources, and performance tweaks.&lt;/li&gt;
&lt;li&gt;🔐 &lt;strong&gt;Guided me in integrating security checks&lt;/strong&gt;, helping build logic to detect exposed credentials, misconfigured IAM policies, and open ports.&lt;/li&gt;
&lt;li&gt;📦 &lt;strong&gt;Assisted with deployment and teardown workflows&lt;/strong&gt; by suggesting reliable patterns for &lt;code&gt;terraform apply&lt;/code&gt; and &lt;code&gt;terraform destroy&lt;/code&gt;, including state locking and error handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Amazon Q served as a real-time AI collaborator that accelerated the build process, reduced trial-and-error, and made the CLI smarter and safer for any user working with AWS infrastructure.&lt;/p&gt;




&lt;p&gt;⚠️ By submitting this entry, I agree to receive communications from AWS regarding products, services, events, and special offers. I can unsubscribe at any time. My information will be handled in accordance with &lt;a href="https://aws.amazon.com/privacy/" rel="noopener noreferrer"&gt;AWS's Privacy Policy&lt;/a&gt;. Additionally, my submission and project may be publicly featured on AWS's social media channels or related promotional materials.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>awschallenge</category>
      <category>ai</category>
      <category>terraform</category>
    </item>
    <item>
      <title>Connecting to a Private RDS Instance via an EC2 Proxy</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Wed, 09 Apr 2025 03:59:45 +0000</pubDate>
      <link>https://dev.to/aws-builders/connecting-to-a-private-rds-instance-via-an-ec2-proxy-4al1</link>
      <guid>https://dev.to/aws-builders/connecting-to-a-private-rds-instance-via-an-ec2-proxy-4al1</guid>
      <description>&lt;h1&gt;
  
  
  Context
&lt;/h1&gt;

&lt;p&gt;To enhance security, RDS instances are typically placed in a private subnet within a VPC, making them inaccessible from outside the VPC.&lt;/p&gt;

&lt;p&gt;In dev/test environment, this can pose a challenge when you need to connect to the database from your local machine to test your application.&lt;/p&gt;

&lt;h1&gt;
  
  
  About this solution
&lt;/h1&gt;

&lt;p&gt;This solution provides a way to set up a proxy that forwards traffic from your client to the private RDS instance using an EC2 proxy instance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You will setup an EC2 instance, at public subnet that it can receive request from developer.&lt;/li&gt;
&lt;li&gt;The EC2 instance will forward traffic to RDS instance at private subnet&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Architecture Overview
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Setup
&lt;/h1&gt;

&lt;h3&gt;
  
  
  1. Create EC2 Instance
&lt;/h3&gt;

&lt;p&gt;Create an EC2 instance with following setting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AMI&lt;/strong&gt;: &lt;code&gt;Amazon Linux 2 Kernel 5.10&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance type&lt;/strong&gt;: &lt;code&gt;t2.micro&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Key pair&lt;/strong&gt;: &lt;code&gt;process without a key pair&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network&lt;/strong&gt; 

&lt;ul&gt;
&lt;li&gt;VPC: choose the &lt;code&gt;VPC that same with VPC you are using with RDS instance&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Subnet: choose &lt;code&gt;public subnet&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Security Group: &lt;code&gt;allow all inbound&lt;/code&gt; traffic&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Then click &lt;code&gt;Launch instance&lt;/code&gt; to create proxy server.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Collect RDS instance information
&lt;/h3&gt;

&lt;p&gt;To forward traffic to RDS instance, you need to know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;DB Endpoint&lt;/code&gt;: example.XXXXXXXXXXXX.ap-southeast-1.rds.amazonaws.com&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;DB Port&lt;/code&gt;: 3306 or 5432,...&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Config Firewall
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;For proxy server security group:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inbound: allow &lt;code&gt;Anywhere-Ipv4&lt;/code&gt; (MYSQL/Aurora, PostgreSQL,... depend on your database engine) on port (3306, 5432,... depend on your database port)&lt;/li&gt;
&lt;li&gt;Outbound: &lt;code&gt;security group of RDS instance&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;For security group of database instance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Inbound: add additional rule to &lt;code&gt;allow traffic from security group of proxy server&lt;/code&gt;. Don't remove any existing rule.&lt;/li&gt;
&lt;li&gt;Outbound: add additional rule to &lt;code&gt;allow traffic to security group of proxy server&lt;/code&gt;. Don't remove any existing rule.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Setup Proxy
&lt;/h3&gt;

&lt;p&gt;SSH to the EC2 instance and run following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yum install haproxy -y

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace content of &lt;code&gt;/etc/haproxy/haproxy.cfg&lt;/code&gt; with following values:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;global
    log /dev/log local0
    log /dev/log local1 notice
    chroot /var/lib/haproxy
    stats socket /var/run/haproxy.sock mode 660 level admin
    user haproxy
    group haproxy
    daemon

defaults
    log     global
    option  dontlognull
    option  httplog
    timeout connect 5000ms
    timeout client  50000ms
    timeout server  50000ms

frontend mysql_front
    bind *:&amp;lt;YOUR_DB_PORT&amp;gt;
    mode tcp
    default_backend mysql_back

backend mysql_back
    mode tcp
    server db_server &amp;lt;YOUR_DB_ENDPOINT&amp;gt;:&amp;lt;YOUR_DB_PORT&amp;gt; check
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;YOUR_DB_ENDPOINT&amp;gt;&lt;/code&gt;: RDS Endpoint&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;YOUR_DB_PORT&amp;gt;&lt;/code&gt;: Database port&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. Test Connection
&lt;/h3&gt;

&lt;p&gt;Now you can connect to RDS instance in private subnet by replace the RDS Endpoint with Public IP of EC2 proxy server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fal6t6g6nyea84tlpohy2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fal6t6g6nyea84tlpohy2.png" alt="Image description" width="393" height="152"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Cleanup Resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Delete EC2 proxy server if you no longer need it to reduce cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Disclaimer
&lt;/h1&gt;

&lt;p&gt;This solution is prefer using for dev/test environment. For production workload, be careful when manage firewall to ensure secure connection.&lt;/p&gt;




&lt;p&gt;🚀 BE HAPPY ON CLOUD 🚀&lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>database</category>
    </item>
    <item>
      <title>AWS App Studio</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Thu, 14 Nov 2024 03:43:10 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/aws-app-studio-32ec</link>
      <guid>https://dev.to/bachdoanvuong/aws-app-studio-32ec</guid>
      <description>&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;App Studio is a generative AI-powered service that uses natural language to build enterprise-grade applications, empowering a new set of builders to create applications in minutes. With App Studio, technical professionals without deep software development skills, such as IT project managers, data engineers, and enterprise architects, can quickly develop business applications tailored to their organization's needs.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Benefits and features&lt;/strong&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Accelerate application development with a generative AI–powered assistant&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Simply describe the application you want to build using natural language, App Studio will deliver an application with a multi-page user interface (UI), a data model, and custom business logic to your needs. You can then ask questions about how to modify your application, and App Studio will guide you with providing detailed answers on how to make changes using the point-and-click interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Deploy highly scalable applications without operational overhead&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;With App Studio, you get a highly secure, scalable, and performant application and you do not have to think about the underlying code or infrastructure—App Studio handles all deployment, operations, and maintenance, freeing technical professionals to focus on innovating rather than application management.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Enhance security and governance that delights IT&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;App Studio provides granular access control policies over your data, users, and applications, also gives IT teams visibility into every application, enabling them to track usage and maintain compliance with company policies.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Save up to 80% versus comparable offerings&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;App Studio upends the pricing models of existing low-code tools that charge expensive per-end user licenses. With App Studio, it’s free to build an application, and you only pay when end users interact with published applications.&lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;Use cases&lt;/strong&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Streamline claims processing&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;With App Studio, you can build an application that automates the manual and repetitive tasks of claims processing in minutes. The application can deal with large volumes of claims in custom processing workflows, such as data entry, file uploads, and status tracking.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Manage inventory and equipment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Build an application that gives you a centralized view of inventory levels, equipment assignments, and reordering needs. You can connect your application to data stores to track parts compatibility information and record inventory levels. The application can automate notifications when compatibility complaints and returns reach specified levels, reducing operational costs through efficient inventory management.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Easily approve projects&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Build an application for project managers that centralizes the project intake, review, and approval processes for your organization. The application can increase visibility into project status and approver information as well as automate notifications and integrate with existing tools for contract management and project kickoffs.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>genai</category>
    </item>
    <item>
      <title>[From Whizlab] AWS Cheatsheet</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Tue, 05 Nov 2024 04:37:07 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/from-whizlab-aws-cheatsheet-1jb2</link>
      <guid>https://dev.to/bachdoanvuong/from-whizlab-aws-cheatsheet-1jb2</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;a href="https://media.whizlabs.com/website/AWS-Cloud-Practitioner-(CLF-C02).pdf" rel="noopener noreferrer"&gt;AWS Certified Cloud Practitioner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://media.whizlabs.com/website/Cheat-Sheet-AWS-AI-Practitioner.pdf" rel="noopener noreferrer"&gt;AWS Certified AI Practitioner (AIF-C01)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://media.whizlabs.com/website/AWS-Certified-SysOps-Administrator-Associate-Whizcard.pdf" rel="noopener noreferrer"&gt;AWS Certified SysOps Administrator Associate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://media.whizlabs.com/website/(SAA-C03)AWS-Solutions-Architect-Associate-Whizcard.pdf" rel="noopener noreferrer"&gt;Solution Architect Associate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://media.whizlabs.com/website/Cheat-Sheet-AWS-Solution-Architect-Professional.pdf" rel="noopener noreferrer"&gt;Solution Architect Professional&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://media.whizlabs.com/website/WhizCard-AWS-Certified-Developer-Associate-(DVA_C02).pdf" rel="noopener noreferrer"&gt;Developer Associate&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Generative AI Call Center</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Thu, 24 Oct 2024 06:31:08 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/generative-ai-call-center-1po6</link>
      <guid>https://dev.to/bachdoanvuong/generative-ai-call-center-1po6</guid>
      <description>&lt;h1&gt;
  
  
  First Cloud Journey Cloud Day - Generative AI Call Center
&lt;/h1&gt;

&lt;p&gt;This guide provides step-by-step instructions to create a call center solution that integrates Amazon Bedrock as an AI assistant and uses OpenAI's Whisper model for real-time voice-to-text transcription. The implementation will utilize Amazon SageMaker to deploy Whisper and Amazon Bedrock to enhance the interaction with AI-driven responses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Prerequisites&lt;/li&gt;
&lt;li&gt;Architecture Overview&lt;/li&gt;
&lt;li&gt;
Setup Instructions

&lt;ul&gt;
&lt;li&gt;Step 1: Create Whisper Endpoint&lt;/li&gt;
&lt;li&gt;Step 2: Deploy Lambda Function&lt;/li&gt;
&lt;li&gt;Step 3: Set Up Amazon Connect Flow&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Congratulations&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/vuongbachdoan/fcj-cd-demo" rel="noopener noreferrer"&gt;Download resource at here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/vuongbachdoan/fcj-cd-demo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before getting started, ensure you have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;An AWS account with access to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Amazon Connect &lt;/li&gt;
&lt;li&gt;Kinesis Video Stream&lt;/li&gt;
&lt;li&gt;Bedrock&lt;/li&gt;
&lt;li&gt;SQS&lt;/li&gt;
&lt;li&gt;Lambda&lt;/li&gt;
&lt;li&gt;SageMaker&lt;/li&gt;
&lt;li&gt;DynamoDB&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Basic knowledge of Python, Jupyter Notebook, and familiarity with AWS services.&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href="https://aws.amazon.com/cli/" rel="noopener noreferrer"&gt;AWS CLI&lt;/a&gt; and &lt;a href="https://aws.amazon.com/sagemaker/studio/" rel="noopener noreferrer"&gt;SageMaker Studio&lt;/a&gt; set up on your machine.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Architecture Overview
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fen9yjglyajnmdtq62tzh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fen9yjglyajnmdtq62tzh.png" alt="Architecture" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup Instructions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Create Whisper Endpoint
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;About Whisper&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The Whisper endpoint is a powerful tool for speech recognition, offering extensive capabilities for transcription and understanding spoken language across various applications. It leverages advanced machine learning techniques to deliver accurate and efficient transcriptions.&lt;/p&gt;
&lt;h4&gt;
  
  
  How it Works
&lt;/h4&gt;

&lt;p&gt;The Jupyter notebook deploys a SageMaker endpoint with a custom inference script similar to this &lt;a href="https://sagemaker-examples.readthedocs.io/en/latest/introduction_to_amazon_algorithms/xgboost_abalone/xgboost_inferenece_script_mode.html" rel="noopener noreferrer"&gt;example in the SageMaker SDK documentation&lt;/a&gt;. The components required to deploy a pre-trained model to an endpoint in SageMaker are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A serialized model artifact (tar file) in Amazon S3.&lt;/li&gt;
&lt;li&gt;The code and requirements that run inference.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These components are packaged into a SageMaker endpoint, which serves the serialized model with custom code behind it as an API. See the architecture below for a visual description.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6el8pj6n9y6rt9rkudli.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6el8pj6n9y6rt9rkudli.png" alt="Architecture" width="800" height="299"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Setup SageMaker Notebook
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;a href="https://us-west-2.console.aws.amazon.com/sagemaker" rel="noopener noreferrer"&gt;SageMaker dashboard&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Go to &lt;strong&gt;Application and IDEs&lt;/strong&gt; &amp;gt; &lt;strong&gt;Notebooks&lt;/strong&gt; in the left sidebar.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create notebook instance&lt;/strong&gt; and complete the following configurations:

&lt;ul&gt;
&lt;li&gt;For &lt;strong&gt;Notebook instance name&lt;/strong&gt;, enter a unique name.&lt;/li&gt;
&lt;li&gt;For &lt;strong&gt;Notebook instance type&lt;/strong&gt;, choose &lt;strong&gt;ml.m5.2xlarge&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Expand &lt;strong&gt;Additional configuration&lt;/strong&gt; and set the &lt;strong&gt;Volume size&lt;/strong&gt; in GB to &lt;strong&gt;10GB&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Leave other fields as default.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Wait until the status of the notebook instance changes to &lt;strong&gt;In service&lt;/strong&gt; before using the instance.&lt;/li&gt;
&lt;li&gt;Open &lt;strong&gt;JupyterLab&lt;/strong&gt; to run your notebook.&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
  
  
  Run Notebook
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to the &lt;code&gt;/whisper&lt;/code&gt; folder in your current repository.&lt;/li&gt;
&lt;li&gt;Copy all files and folders, upload them to the current notebook, and run the notebook.&lt;/li&gt;
&lt;li&gt;It is recommended to run every cell one by one.&lt;/li&gt;
&lt;li&gt;The folder structure will look like this:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7n8bir4vw15s1x1yh7a7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7n8bir4vw15s1x1yh7a7.png" alt="Folder Structure" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You will have an endpoint named &lt;strong&gt;whisper-endpoint&lt;/strong&gt; under &lt;strong&gt;Inference&lt;/strong&gt; &amp;gt; &lt;strong&gt;Endpoints&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Step 2: Deploy Lambda Function
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;code&gt;/amazon-connect&lt;/code&gt; in your current repository.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following command on your local computer:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;aws configure
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;/ol&gt;

&lt;p&gt;Then enter your AWS Access Key ID, AWS Secret Access Key, and Default region name (&lt;strong&gt;us-west-2&lt;/strong&gt;).&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clone the repository:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/vuongbachdoan/fcj-cd-demo.git
&lt;span class="nb"&gt;cd &lt;/span&gt;amazon-connect
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Create a &lt;code&gt;.env&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt; &amp;gt; .env
WHISPER_ENDPOINT="whisper-endpoint"
&lt;/span&gt;&lt;span class="no"&gt;EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Execute the following script once:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/create_deployment_bucket.sh dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;To deploy, execute this script as often as required:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./scripts/serverless_deploy.sh dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set up a contact flow that starts media streaming and passes the following parameters to the ProcessStream Lambda:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;kvsStreamArn&lt;/code&gt;: the stream ARN from the contact attribute in Connect.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;kvsStartFragment&lt;/code&gt;: the KVS start fragment number from the contact attribute in Connect.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add any Lambda functions used to the Amazon Connect instance. The &lt;code&gt;ContactId&lt;/code&gt; is fetched from the standard request attribute:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ContactData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ContactId&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This should start populating an IVR real-time transcript into DynamoDB.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Enable KVS media streaming&lt;/strong&gt; in your Amazon Connect instance and set a sane retention period for KVS (24 hours minimum during testing).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fquzlu3tb9u6vpqlrh6sv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fquzlu3tb9u6vpqlrh6sv.png" alt="KVS Enable" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Set Up Amazon Connect Flow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Access your Amazon Connect instance with your account credentials.&lt;/li&gt;
&lt;li&gt;Create a flow using the template located at &lt;code&gt;amazon-connect/contact_flow/prsv-aws-connect-flow.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Claim a phone number by navigating to &lt;strong&gt;Phone numbers &amp;gt; Voice &amp;gt; Toll free &amp;gt; Choose the flow you imported previously&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You're all set! Call your contact center now.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  DEMO
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/user-attachments/assets/dfa474e0-186e-428e-873c-f7f2c991da4d" rel="noopener noreferrer"&gt;https://github.com/user-attachments/assets/dfa474e0-186e-428e-873c-f7f2c991da4d&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  🎉 Congratulations! 🎉
&lt;/h2&gt;

&lt;p&gt;In this workshop, you have learned how to implement a call center using Amazon Connect and Generative AI. You’ve gained valuable insights into setting up efficient customer support systems that leverage cutting-edge technology to enhance user experience.&lt;/p&gt;

&lt;p&gt;Feel free to ask me any questions about this solution! Connect with me on &lt;a href="https://www.linkedin.com/in/vuongbd2007/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>genai</category>
      <category>bedrock</category>
      <category>amazonconnect</category>
    </item>
    <item>
      <title>Resolve Lambda URL Error - signature not match when using POST/PUT</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Sat, 31 Aug 2024 05:51:22 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/resolve-lambda-url-error-signature-not-match-when-using-postput-44jm</link>
      <guid>https://dev.to/bachdoanvuong/resolve-lambda-url-error-signature-not-match-when-using-postput-44jm</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
   &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  I. Current issue
&lt;/h2&gt;

&lt;p&gt;💥 &lt;strong&gt;A guy with same problem posted a question at this link:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://repost.aws/questions/QUbHCI9AfyRdaUPCCo_3XKMQ/lambda-function-url-behind-cloudfront-invalidsignatureexception-only-on-post" rel="noopener noreferrer"&gt;https://repost.aws/questions/QUbHCI9AfyRdaUPCCo_3XKMQ/lambda-function-url-behind-cloudfront-invalidsignatureexception-only-on-post&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Describe:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;He using CloudFront in front of Lambda Function URL, but he can only using GET method, POST/PUT request is rejected&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawijhx7ap7a35nmwb60n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawijhx7ap7a35nmwb60n.png" alt="Image description" width="800" height="70"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;&lt;strong&gt;Analysis problem:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⚠️ Lambda URL have 2 type of authentication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;NONE&lt;/code&gt;: anyone with URL can access function&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AWS_IAM&lt;/code&gt;: require signed-header&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl168zfheopx6w33ciisa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fl168zfheopx6w33ciisa.png" alt="Image description" width="800" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are using AWS_IAM, all user can’t directly access Lambda URL. It require signed-header as &lt;code&gt;x-amz-content-sha256&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  II. Solution
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Solution 1: Create signed-header with boto3 session
&lt;/h3&gt;

&lt;p&gt;The custom header is add manually from client side. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that with this solution, using CloudFront is optional as we do nothing to sign header at CloudFront side, we do it from client side. &lt;/p&gt;

&lt;p&gt;CloudFront in this case only for CDN purpose.&lt;/p&gt;

&lt;p&gt;Using CloudFront, you &lt;strong&gt;can&lt;/strong&gt; using GET method even though you don’t have &lt;code&gt;x-amz-content-sha256&lt;/code&gt; in header. But if you call directly to Lambda URL, it will reject all METHODs immediately.&lt;/p&gt;
&lt;/blockquote&gt;





&lt;p&gt;&lt;strong&gt;Here is how you can sign request:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Step 1. Create boto3 session to sign header&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;boto3&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;botocore&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;crt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;awsrequest&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;SigV4ASign&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;boto3_session&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;boto3&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Session&lt;/span&gt;&lt;span class="p"&gt;()):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;boto3_session&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_headers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;aws_request_config&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;sigV4A&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;crt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CrtS3SigV4AsymAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_credentials&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;awsrequest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AWSRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;aws_request_config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sigV4A&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_auth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;prepped&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;prepped&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_headers_basic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;sigV4A&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;crt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CrtS3SigV4AsymAuth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_credentials&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;region&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;awsrequest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;AWSRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sigV4A&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_auth&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;prepped&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;prepare&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;prepped&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Using header in our request&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from sigv4a_sign import SigV4ASign
import requests

service = 'lambda'
region = '*'
method = 'GET'
url = 'https://4xmze5deqxjjy4ltw2ze3h7gr40tlvcp.lambda-url.us-east-1.on.aws'

headers = SigV4ASign().get_headers_basic(service, region, method, url)
r = requests.get(url, headers=headers)
print(f'status_code: {r.status_code} \nobject text: {r.text}')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Solution 2: Bypass signed-header by create LambdaEdge to assign token at CloudFront
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;With this solution, all traffic is signed at CloudFront by LambdaEdge no matter who send the request. It means that everyone can call Lambda URL through CloudFront distribution domain.&lt;/p&gt;

&lt;p&gt;It only helpful to prevent traffic go directly to Lambda function, but not validate if a user go through CloudFront.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;strong&gt;You can implement a solution to sign custom header by follow this document:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-how-it-works-tutorial.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-how-it-works-tutorial.html&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Futher Read - Why only GET method can bypass CloudFront to invoke Lambda URL
&lt;/h2&gt;

&lt;p&gt;⁉️ &lt;strong&gt;We know that Lambda URL requires all methods to have signed header, but why GET method can go through CloudFront to invoke function?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is message when I test with GET method at CloudFront, as you see it includes the Headers, and it included &lt;code&gt;x-amz-content-sha256&lt;/code&gt; .&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello from Lambda!"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amz-content-sha256"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-is-android-viewer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"content-length"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amzn-tls-version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"TLSv1.3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-viewer-country"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"US"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"postman-token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2b178115-dd65-4567-8cfb-07b95ed45d6e"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amz-source-account"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"058264411535"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-viewer-tls"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"TLSv1.3:TLS_AES_128_GCM_SHA256:sessionResumed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-forwarded-port"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"443"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amz-security-token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"IQoJb3JpZ2luX2VjED0aCXVzLWVhc3QtMSJHMEUCIQDVVeJvqePhgQHPp2rQwVkuB1eNg7lIwpqLd7UpIw4ihwIgBjkJsp9pna8XikOc8Oo0sIW5wsKteL1gc/2PvgVwcu8qtQIIVhAAGgw4NTYzNjkwNTMxODEiDOcCEWCBKujgcCE8KCqSAk3VAG17dDtr7yyyni1Eclx3bOChaK3Lq8ZKhz3LDFZ9KwHErLm5CVFMLg7fHmqHbxYPFxRft6rFJfnePq3XV2x12r8WVNiPMr4rrrNevzB7Qyn2n2CdwOalsFYm7I3fLB4oT5hR7CNN61tzJpupy5XnzbkQJ1HmjnlXRmbQTnkWjpooWuZXZF5hmNKpOAH7+nrn+L97+9xSkYKGs5Yj66BD/TxeoUKBD1extNk8Dz49yvyX3Le9O7rUwWuMof8Qih6aABL8IRQQs5qo2tpuCIODe+nRi2F1j7CJ85YW5MPp2FVvCLOCi0y7ApAiIpzn+g3fQCd830DqEwA1FJ3Mc+eDDy+SZ3j0oDK97lOgAJFtOMQw5JXFtgY6jwGzvIJEeEV29B3yHCpalJciUNzGxWtt2Vw7f1Btv02KgbnGyVzFvs4Dh3Ia6ldLAWevM6ZB/h62870hj0XKBUw5Q/sZR+LqJGDFyD/UfMWb6zSbv6mCc3xtbO/HoxUW7qwNiBGwqDvxvls9383cnpTT8rHPviOGv78QAnNF7qGmKGVPlGWignUvEzYx2Tur8g=="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"via"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.1 eb8674b99d3dfcc6867fb20af353442a.cloudfront.net (CloudFront)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amzn-tls-cipher-suite"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"TLS_AES_128_GCM_SHA256"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-viewer-asn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"14618"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-is-desktop-viewer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"true"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"host"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"4xmze5deqxjjy4ltw2ze3h7gr40tlvcp.lambda-url.us-east-1.on.aws"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cache-control"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"no-cache"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-viewer-city"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ashburn"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-viewer-http-version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"1.1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-viewer-address"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"54.86.50.139:4863"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amz-date"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"20240830T061644Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-forwarded-proto"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-is-ios-viewer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-forwarded-for"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"54.86.50.139"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"accept"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"*/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amz-source-arn"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"arn:aws:cloudfront::058264411535:distribution/E1ZAD106XSWJF5"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-is-smarttv-viewer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amzn-trace-id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Self=1-66d163cc-0bda717d14f2a84850a6eed2;Root=1-66d163cc-711a9a2d2cad036f1be882a4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-is-tablet-viewer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-forwarded-proto"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"accept-encoding"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gzip, deflate, br"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"x-amz-cf-id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"89c8mF_r2r7fOOOaYREIJ5ZZW4mfurh81xCmzYA5VHbyDTy56i0Crg=="&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"user-agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PostmanRuntime/7.41.2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"cloudfront-is-mobile-viewer"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"false"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I did not sign the request before, so we can imagine that CloudFront automatically sign request header for requests that using GET method.&lt;/p&gt;

&lt;p&gt;But when I call POST method it show error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It clearly that the POST method is not signed by default by CloudFront, we need to create signed token to header.&lt;/p&gt;




&lt;p&gt;In this document it saids about why GET is enable by default ( &lt;a href="https://community.aws/content/2fuBTcoVg7nnRIVLnqjIsIC8LAi/enhancing-security-for-lambda-function-urls?lang=en" rel="noopener noreferrer"&gt;https://community.aws/content/2fuBTcoVg7nnRIVLnqjIsIC8LAi/enhancing-security-for-lambda-function-urls?lang=en&lt;/a&gt; ). &lt;/p&gt;

&lt;p&gt;To summary, it saids that the solution is for easier access if we enable for GET requests at CloudFront, POST requests still require signed payloads.&lt;/p&gt;




&lt;p&gt;In my view, bypass GET can help us with less effort to sign request header, and we know that GET is very common method so if every request need to be signed will take a lot of cost and time. Disadvantage is less secure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Refs
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;To read more about solution, I have some helpful link below:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/vuongbachdoan/sigv4a-signing-examples/tree/main/python" rel="noopener noreferrer"&gt;https://github.com/vuongbachdoan/sigv4a-signing-examples/tree/main/python&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-lambda.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-lambda.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-how-it-works-tutorial.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-how-it-works-tutorial.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://community.aws/content/2fuBTcoVg7nnRIVLnqjIsIC8LAi/enhancing-security-for-lambda-function-urls?lang=en" rel="noopener noreferrer"&gt;https://community.aws/content/2fuBTcoVg7nnRIVLnqjIsIC8LAi/enhancing-security-for-lambda-function-urls?lang=en&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>cloudfront</category>
      <category>security</category>
    </item>
    <item>
      <title>Compare DynamoDB DAX with ElasticCache</title>
      <dc:creator>Vuong Bach Doan</dc:creator>
      <pubDate>Tue, 20 Feb 2024 08:43:36 +0000</pubDate>
      <link>https://dev.to/bachdoanvuong/compare-dynamodb-dax-with-elasticcache-haj</link>
      <guid>https://dev.to/bachdoanvuong/compare-dynamodb-dax-with-elasticcache-haj</guid>
      <description>&lt;p&gt;AWS's DynamoDB, a NoSQL database service, is renowned for its scalability and performance across a range of applications. However, when dealing with read-intensive workloads, frequent interactions with DynamoDB can lead to increased latency and cost. This issue can be mitigated by implementing a caching layer, which stores frequently accessed data closer to the application, thereby reducing database roundtrips. Two popular choices for this purpose are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon DynamoDB Accelerator (DAX):&lt;/strong&gt; A fully managed, in-memory caching service tailored specifically for DynamoDB.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Amazon ElasticCache:&lt;/strong&gt; A versatile caching service that supports various engines such as Memcached and Redis, offering a wider range of applications beyond DynamoDB.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While both options boost performance, they differ in several key aspects:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Design and Optimization:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DAX:&lt;/strong&gt; Specifically designed for DynamoDB, DAX employs the Memcached protocol and optimizes caching strategies for DynamoDB's unique data structures and access patterns, resulting in enhanced efficiency and compatibility with DynamoDB operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ElasticCache:&lt;/strong&gt; Provides a variety of engines, each with its own strengths and trade-offs. Selecting the appropriate engine and configuration requires a careful analysis of data access patterns and performance requirements. It may not integrate as seamlessly with DynamoDB as DAX does.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Caching Mechanism:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DAX:&lt;/strong&gt; Operates in a write-through mode, ensuring data consistency by automatically propagating all writes to the underlying DynamoDB table. It also maintains separate item and query caches, allowing for granular control over caching behavior.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ElasticCache:&lt;/strong&gt; Supports a range of caching strategies depending on the chosen engine. Some engines, like Memcached, adopt a write-through approach similar to DAX. Others, like Redis, support various strategies such as write-back or read-through, necessitating careful configuration based on specific use cases.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Cost and Management:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DAX:&lt;/strong&gt; Pricing is based on the provisioned cluster size and node type. As a fully managed service, it eliminates the need for manual configuration and maintenance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ElasticCache:&lt;/strong&gt; Offers a range of pricing models depending on the chosen engine, instance type, and reserved instances options. It requires more manual configuration and management compared to DAX.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Use Cases:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;DAX:&lt;/strong&gt; Ideal for read-intensive workloads specifically targeting DynamoDB. Its close integration and optimized caching strategies make it the go-to choice for maximizing performance and minimizing latency for DynamoDB operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ElasticCache:&lt;/strong&gt; Supports a broader range of use cases beyond DynamoDB, allowing caching for various data sources and applications. It offers more flexibility in caching strategies but may require additional configuration and management effort.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;✅Choosing the Right Option:&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Key Aspects&lt;/th&gt;
&lt;th&gt;Amazon DynamoDB Accelerator (DAX)&lt;/th&gt;
&lt;th&gt;Amazon ElasticCache&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Design and Optimization&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Specifically designed for DynamoDB, employing the Memcached protocol and optimizing caching strategies for DynamoDB's unique data structures and access patterns.&lt;/td&gt;
&lt;td&gt;Provides a variety of engines, each with its own strengths and trade-offs. Selecting the appropriate engine and configuration requires a careful analysis of data access patterns and performance requirements.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Caching Mechanism&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Operates in a write-through mode, ensuring data consistency by automatically propagating all writes to the underlying DynamoDB table. It also maintains separate item and query caches, allowing for granular control over caching behavior.&lt;/td&gt;
&lt;td&gt;Supports a range of caching strategies depending on the chosen engine. Some engines, like Memcached, adopt a write-through approach similar to DAX. Others, like Redis, support various strategies such as write-back or read-through.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost and Management&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pricing is based on the provisioned cluster size and node type. As a fully managed service, it eliminates the need for manual configuration and maintenance.&lt;/td&gt;
&lt;td&gt;Offers a range of pricing models depending on the chosen engine, instance type, and reserved instances options. It requires more manual configuration and management compared to DAX.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Use Cases&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Ideal for read-intensive workloads specifically targeting DynamoDB. Its close integration and optimized caching strategies make it the go-to choice for maximizing performance and minimizing latency for DynamoDB operations.&lt;/td&gt;
&lt;td&gt;Supports a broader range of use cases beyond DynamoDB, allowing caching for various data sources and applications. It offers more flexibility in caching strategies but may require additional configuration and management effort.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The choice between DAX and ElasticCache depends on your specific requirements:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your application is solely focused on enhancing DynamoDB read performance, DAX provides a simpler, optimized, and fully managed solution.&lt;/li&gt;
&lt;li&gt;If you require a caching layer for a variety of data sources beyond DynamoDB and need more control over caching strategies, ElasticCache offers greater flexibility.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aws</category>
    </item>
  </channel>
</rss>
