<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Tuan Do's Blog]]></title><description><![CDATA[The blog acts like a personal notebook for jotting down thoughts]]></description><link>https://blog.tuando.app</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 03:46:26 GMT</lastBuildDate><atom:link href="https://blog.tuando.app/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to daily back up PostgreSQL into S3]]></title><description><![CDATA[Create a shell bash file as shown below
#!/bin/bash
# Directory containing temporary backup files
BACKUP_DIR="~/temp_backup"

# Format for backup file names (Ex: bk_2025-03-01.tar)
FILE_NAME="bk_$(date +%Y-%m-%d).tar"
FILE_PATH="$BACKUP_DIR/$FILE_NAM...]]></description><link>https://blog.tuando.app/how-to-daily-back-up-postgresql-into-s3</link><guid isPermaLink="true">https://blog.tuando.app/how-to-daily-back-up-postgresql-into-s3</guid><category><![CDATA[S3]]></category><category><![CDATA[PostgreSQL]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Sat, 01 Mar 2025 10:35:24 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-create-a-shell-bash-file-as-shown-below">Create a shell bash file as shown below</h2>
<pre><code class="lang-bash"><span class="hljs-meta">#!/bin/bash</span>
<span class="hljs-comment"># Directory containing temporary backup files</span>
BACKUP_DIR=<span class="hljs-string">"~/temp_backup"</span>

<span class="hljs-comment"># Format for backup file names (Ex: bk_2025-03-01.tar)</span>
FILE_NAME=<span class="hljs-string">"bk_<span class="hljs-subst">$(date +%Y-%m-%d)</span>.tar"</span>
FILE_PATH=<span class="hljs-string">"<span class="hljs-variable">$BACKUP_DIR</span>/<span class="hljs-variable">$FILE_NAME</span>"</span>

<span class="hljs-comment"># S3 Bucket</span>
S3_BUCKET=<span class="hljs-string">"s3://your-bucket-name"</span>

<span class="hljs-comment"># PostgreSQL</span>
PG_HOST=localhost
PG_PORT=5432
PG_USERNAME=postgre
PG_PASSWORD=&lt;PGPASSWORD&gt;
DB_NAME=postgres
DB_SCHEMA_NAME=public

<span class="hljs-comment"># Execute a database backup leveraging Docker and the `pg_dump` utility.</span>
docker run --rm -v <span class="hljs-string">"<span class="hljs-variable">$BACKUP_DIR</span>"</span>:/temp_backup --user root postgres bash -c <span class="hljs-string">"PGPASSWORD=<span class="hljs-variable">$PG_PASSWORD</span> pg_dump --verbose --host=<span class="hljs-variable">$PG_HOST</span> --port=<span class="hljs-variable">$PG_PORT</span> --username=<span class="hljs-variable">$PG_USERNAME</span> --format=t --encoding=UTF-8 --file /temp_backup/<span class="hljs-variable">$FILE_NAME</span> -n <span class="hljs-variable">$DB_SCHEMA_NAME</span> <span class="hljs-variable">$DB_NAME</span>"</span>

<span class="hljs-comment"># Checking the file's successful creation, then updating it in S3.</span>
<span class="hljs-keyword">if</span> [ -f <span class="hljs-string">"<span class="hljs-variable">$FILE_PATH</span>"</span> ]; <span class="hljs-keyword">then</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Uploading to S3..."</span>
    aws s3 cp <span class="hljs-string">"<span class="hljs-variable">$FILE_PATH</span>"</span> <span class="hljs-string">"<span class="hljs-variable">$S3_BUCKET</span>/<span class="hljs-variable">$FILE_NAME</span>"</span>

    <span class="hljs-comment"># If uploading file successfully (exit code = 0) then remove local temporary file (optional)</span>
    <span class="hljs-keyword">if</span> [ $? -eq 0 ]; <span class="hljs-keyword">then</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"Uploaded file to S3 successfully. Removing local temporary file"</span>
        rm -f <span class="hljs-string">"<span class="hljs-variable">$FILE_PATH</span>"</span>
    <span class="hljs-keyword">else</span>
        <span class="hljs-built_in">echo</span> <span class="hljs-string">"Failed to upload backup file to S3"</span>
    <span class="hljs-keyword">fi</span>
<span class="hljs-keyword">else</span>
    <span class="hljs-built_in">echo</span> <span class="hljs-string">"Could not find the backup file: <span class="hljs-variable">$FILE_PATH</span>"</span>
<span class="hljs-keyword">fi</span>
</code></pre>
<h2 id="heading-create-a-crontab-to-run-daily-or-at-any-time-you-prefer">Create a crontab to run daily or at any time you prefer</h2>
<pre><code class="lang-bash">crontab -e
0 0 * * * /path/to/backup_script.sh &gt;&gt; /var/<span class="hljs-built_in">log</span>/backup_script.log 2&gt;&amp;1
chmod +x /path/to/backup_script.sh
</code></pre>
<h2 id="heading-check-the-crontab-log">Check the Crontab log</h2>
<h3 id="heading-ubuntudebian">Ubuntu/Debian</h3>
<pre><code class="lang-bash">grep CRON /var/<span class="hljs-built_in">log</span>/syslog
</code></pre>
<h3 id="heading-centosredhat">CentOS/RedHat</h3>
<pre><code class="lang-bash">grep CRON /var/<span class="hljs-built_in">log</span>/cron
</code></pre>
]]></content:encoded></item><item><title><![CDATA[How to install Redis Sentinel using Helm in K8S]]></title><description><![CDATA[Adding bitnami repo into local repo helm
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo ls

Cloning repository Redis on bitnami to machine
mkdir redis-sentinel
cd ./redis-sentinel
helm fetch bitnami/redis --untar

Make changes to ...]]></description><link>https://blog.tuando.app/how-to-install-redis-sentinel-using-helm-in-k8s</link><guid isPermaLink="true">https://blog.tuando.app/how-to-install-redis-sentinel-using-helm-in-k8s</guid><category><![CDATA[k8s]]></category><category><![CDATA[Redis]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Wed, 19 Feb 2025 07:59:11 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-adding-bitnami-repo-into-local-repo-helm">Adding bitnami repo into local repo helm</h2>
<pre><code class="lang-powershell">helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo <span class="hljs-built_in">ls</span>
</code></pre>
<h2 id="heading-cloning-repository-redis-on-bitnami-to-machine">Cloning repository Redis on bitnami to machine</h2>
<pre><code class="lang-powershell">mkdir redis<span class="hljs-literal">-sentinel</span>
<span class="hljs-built_in">cd</span> ./redis<span class="hljs-literal">-sentinel</span>
helm fetch bitnami/redis -<span class="hljs-literal">-untar</span>
</code></pre>
<h2 id="heading-make-changes-to-the-configurations">Make changes to the configurations</h2>
<h3 id="heading-edit-valuesyaml-file">Edit <strong><em>values.yaml</em></strong> file</h3>
<pre><code class="lang-yaml"><span class="hljs-attr">replica.replicaCount:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">sentinel.enabled:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">sentinel.quorum:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">sentinel.masterSet:</span> <span class="hljs-string">mymaster</span>
<span class="hljs-attr">global.redis.password:</span> <span class="hljs-string">&lt;YOUR_PASSWORD&gt;</span>
</code></pre>
<h2 id="heading-creating-a-new-namespace-and-installing-redis-sentinel">Creating a new namespace and installing redis-sentinel</h2>
<pre><code class="lang-powershell">kubectl create namespace redis<span class="hljs-literal">-sentinel</span>
helm install redis<span class="hljs-literal">-sentinel</span> ./ <span class="hljs-literal">-n</span> redis<span class="hljs-literal">-sentinel</span>
kubectl get pods <span class="hljs-literal">-n</span> redis<span class="hljs-literal">-sentinel</span>
</code></pre>
<hr />
<h2 id="heading-how-to-find-a-current-primary-master-host">How to find a current primary master host</h2>
<pre><code class="lang-powershell">redis<span class="hljs-literal">-cli</span> <span class="hljs-literal">-h</span> redis<span class="hljs-literal">-sentinel</span> <span class="hljs-literal">-p</span> <span class="hljs-number">26379</span> <span class="hljs-literal">-a</span> <span class="hljs-string">'YOUR_PASSWORD'</span> SENTINEL <span class="hljs-built_in">get-master</span><span class="hljs-literal">-addr</span><span class="hljs-literal">-by</span><span class="hljs-literal">-name</span> mymaster
</code></pre>
<blockquote>
<p>Example response: <strong><em>redis-sentinel-node-0.redis-sentinel-headless.redis-sentinel.svc.cluster.local</em></strong></p>
</blockquote>
<p><strong>The format of that response is:</strong></p>
<blockquote>
<p>&lt;pod_name&gt;.&lt;service_name&gt;.&lt;namespace&gt;.svc.cluster.local</p>
</blockquote>
<hr />
<h2 id="heading-config-redis-commander-for-accessing-redis-sentinel">Config Redis Commander for accessing Redis Sentinel</h2>
<pre><code class="lang-yaml"><span class="hljs-attr">apiVersion:</span> <span class="hljs-string">apps/v1</span>
<span class="hljs-attr">kind:</span> <span class="hljs-string">Deployment</span>
<span class="hljs-attr">metadata:</span>
  <span class="hljs-attr">name:</span> <span class="hljs-string">redis-commander</span>
  <span class="hljs-attr">annotations:</span>
    <span class="hljs-attr">container.apparmor.security.beta.kubernetes.io/redis-commander:</span> <span class="hljs-string">runtime/default</span>
    <span class="hljs-attr">container.security.alpha.kubernetes.io/redis-commander:</span> <span class="hljs-string">runtime/default</span>
  <span class="hljs-attr">labels:</span>
    <span class="hljs-attr">app.kubernetes.io/part-of:</span> <span class="hljs-string">redis-sentinel</span>
    <span class="hljs-attr">app.kubernetes.io/name:</span> <span class="hljs-string">redis-commander</span>
<span class="hljs-attr">spec:</span>
  <span class="hljs-attr">replicas:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">selector:</span>
    <span class="hljs-attr">matchLabels:</span>
      <span class="hljs-attr">app:</span> <span class="hljs-string">redis-commander</span>
  <span class="hljs-attr">template:</span>
    <span class="hljs-attr">metadata:</span>
      <span class="hljs-attr">labels:</span>
        <span class="hljs-attr">app:</span> <span class="hljs-string">redis-commander</span>
        <span class="hljs-attr">app.kubernetes.io/part-of:</span> <span class="hljs-string">redis-sentinel</span>
        <span class="hljs-attr">app.kubernetes.io/name:</span> <span class="hljs-string">redis-commander</span>
    <span class="hljs-attr">spec:</span>
      <span class="hljs-attr">automountServiceAccountToken:</span> <span class="hljs-literal">false</span>
      <span class="hljs-attr">containers:</span>
        <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">redis-commander</span>
          <span class="hljs-attr">image:</span> <span class="hljs-string">ghcr.io/joeferner/redis-commander</span>
          <span class="hljs-attr">imagePullPolicy:</span> <span class="hljs-string">Always</span>
          <span class="hljs-attr">env:</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">SENTINEL_GROUP</span>
              <span class="hljs-attr">value:</span> <span class="hljs-string">"mymaster"</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">SENTINEL_PASSWORD</span>
              <span class="hljs-attr">value:</span> <span class="hljs-string">"sJxpl1HBQZLpNoI"</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">REDIS_PASSWORD</span>
              <span class="hljs-attr">value:</span> <span class="hljs-string">"sJxpl1HBQZLpNoI"</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">SENTINELS</span>
              <span class="hljs-attr">value:</span> <span class="hljs-string">"redis-sentinel-node-0.redis-sentinel-headless.redis-sentinel.svc.cluster.local:26379,redis-sentinel-node-1.redis-sentinel-headless.redis-sentinel.svc.cluster.local:26379,redis-sentinel-node-2.redis-sentinel-headless.redis-sentinel.svc.cluster.local:26379"</span>
          <span class="hljs-attr">ports:</span>
            <span class="hljs-bullet">-</span> <span class="hljs-attr">name:</span> <span class="hljs-string">redis-commander</span>
              <span class="hljs-attr">containerPort:</span> <span class="hljs-number">8081</span>
          <span class="hljs-attr">resources:</span>
            <span class="hljs-attr">limits:</span>
              <span class="hljs-attr">cpu:</span> <span class="hljs-string">"500m"</span>
              <span class="hljs-attr">memory:</span> <span class="hljs-string">"512M"</span>
          <span class="hljs-attr">securityContext:</span>
            <span class="hljs-attr">runAsNonRoot:</span> <span class="hljs-literal">true</span>
            <span class="hljs-attr">readOnlyRootFilesystem:</span> <span class="hljs-literal">false</span>
            <span class="hljs-attr">allowPrivilegeEscalation:</span> <span class="hljs-literal">false</span>
            <span class="hljs-attr">capabilities:</span>
              <span class="hljs-attr">drop:</span>
                <span class="hljs-bullet">-</span> <span class="hljs-string">ALL</span>
</code></pre>
]]></content:encoded></item><item><title><![CDATA[Adding a new hostname or IP Address to K8S API Server]]></title><description><![CDATA[Retrieve the kubeadm configuration file
kubectl -n kube-system get configmap kubeadm-config -o jsonpath='{.data.ClusterConfiguration}' --insecure-skip-tls-verify > kubeadm.yaml

Fine-tune the configuration file
apiServer:
  certSANs:
  - "10.10.10.10...]]></description><link>https://blog.tuando.app/adding-a-new-hostname-or-ip-address-to-k8s-api-server</link><guid isPermaLink="true">https://blog.tuando.app/adding-a-new-hostname-or-ip-address-to-k8s-api-server</guid><category><![CDATA[k8s]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Mon, 13 Jan 2025 14:16:12 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-retrieve-the-kubeadm-configuration-file">Retrieve the kubeadm configuration file</h2>
<pre><code class="lang-bash">kubectl -n kube-system get configmap kubeadm-config -o jsonpath=<span class="hljs-string">'{.data.ClusterConfiguration}'</span> --insecure-skip-tls-verify &gt; kubeadm.yaml
</code></pre>
<h2 id="heading-fine-tune-the-configuration-file">Fine-tune the configuration file</h2>
<pre><code class="lang-yaml"><span class="hljs-attr">apiServer:</span>
  <span class="hljs-attr">certSANs:</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">"10.10.10.100"</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">"kubernetes.default"</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">"new-hostname"</span>
  <span class="hljs-bullet">-</span> <span class="hljs-string">"X.X.X.X"</span> <span class="hljs-comment">#newIPaddress</span>
  <span class="hljs-attr">extraArgs:</span>
    <span class="hljs-string">...</span>
</code></pre>
<h2 id="heading-re-create-api-server-certificates">Re-create API Server Certificates</h2>
<pre><code class="lang-bash">mv /etc/kubernetes/pki/apiserver.{crt,key} ~
kubeadm init phase certs apiserver --config kubeadm.yaml
</code></pre>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Other Services]]></title><description><![CDATA[CloudFormation
Benefits of AWS CloudFormation

Infrastructure as code

Cost

Each resource in the stack is tagged with an identifier so you can easily see how much a stack costs

Estimate the costs of resources using the CloudFormation template

Savi...]]></description><link>https://blog.tuando.app/saa-c03-certification-other-services</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-other-services</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Tue, 03 Dec 2024 07:14:08 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-cloudformation">CloudFormation</h1>
<h2 id="heading-benefits-of-aws-cloudformation">Benefits of AWS CloudFormation</h2>
<ul>
<li><p>Infrastructure as code</p>
</li>
<li><p>Cost</p>
<ul>
<li><p>Each resource in the stack is tagged with an identifier so you can easily see how much a stack costs</p>
</li>
<li><p>Estimate the costs of resources using the CloudFormation template</p>
</li>
<li><p>Saving strategy: In Dev, you could automate the deletion of templates at 5 PM and recreate them at 8 A, safely</p>
</li>
</ul>
</li>
<li><p>Productivity</p>
<ul>
<li>Automated generations of Diagram for template</li>
</ul>
</li>
<li><p>Do not reinvent the wheel</p>
<ul>
<li><p>Leverage existing templates on the web</p>
</li>
<li><p>Leverage the documentation</p>
</li>
</ul>
</li>
<li><p>Supports (almost) all AWS resources</p>
</li>
</ul>
<h2 id="heading-service-role">Service Role</h2>
<ul>
<li><p>Use cases:</p>
<ul>
<li><p>You want to achieve the least privilege principle</p>
</li>
<li><p>But you do not want to give the user all the required permissions to create the stack resources</p>
</li>
</ul>
</li>
<li><p>User must have <strong>iam:PassRole</strong> permissions</p>
</li>
</ul>
<h1 id="heading-aws-ses">AWS SES</h1>
<ul>
<li><p>Fully managed service to send emails securely, globally, and at scale</p>
</li>
<li><p>Allow inbound/outbound emails</p>
</li>
<li><p>Reputation dashboard, performance insights, anti-spam feedback</p>
</li>
<li><p>Use cases: transactional, marketing, and bulk email communications</p>
</li>
</ul>
<h1 id="heading-amazon-pinpoint">Amazon Pinpoint</h1>
<ul>
<li><p>Supports email, SMS, push, voice, and in-app messaging</p>
</li>
<li><p>Possibility of receiving replies</p>
</li>
<li><p>Scales to billions of messages per day</p>
</li>
<li><p>Use cases: run campaigns by sending marketing, bulk, and transactional SMS messages</p>
</li>
<li><p>Versus SNS or SES</p>
<ul>
<li><p>In SNS &amp; SES you managed each message’s audience, content, and delivery schedule.</p>
</li>
<li><p>In Pinpoint, you create message templates, delivery schedules, highly-targeted segments, and full campaigns.s</p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-system-manager-ssm-session-manager">System Manager - SSM Session Manager</h1>
<ul>
<li><p>Allows to start a secure shell on EC2 and on-premises servers</p>
</li>
<li><p>No SSH access, bastion hosts, or SSH Keys needed</p>
</li>
<li><p>There is no need to open port 22</p>
</li>
<li><p>Supports Linux, MacOS, Windows</p>
</li>
<li><p>Send session log data to S3 or CloudWatch Logs</p>
</li>
</ul>
<h1 id="heading-system-manager">System Manager</h1>
<h2 id="heading-run-command">Run command</h2>
<ul>
<li><p>Execute a script or just run a command</p>
</li>
<li><p>Run command across multiple instances (using resource groups)</p>
</li>
<li><p>No need for SSH</p>
</li>
<li><p>Command output can be shown in the AWS Console, and sent to the S3 bucket or CloudWatch Lo.gs.</p>
</li>
<li><p>Send notifications to SNS about command status</p>
</li>
<li><p>Integrated with IAM &amp; CloudTrail</p>
</li>
<li><p>It can be invoked using EventBridge</p>
</li>
</ul>
<h2 id="heading-patch-manager">Patch Manager</h2>
<ul>
<li><p>Automates the process of patching managed instances</p>
</li>
<li><p>OS updates, application updates, security updates</p>
</li>
<li><p>Supports EC2 instances and on-premises servers</p>
</li>
<li><p>Supports Linux, MacOS, Windows</p>
</li>
<li><p>Patch on-demand or on a schedule using <strong>Maintenance Windows</strong></p>
</li>
<li><p>Scan instances and generate patch compliance reports (missing patches)</p>
</li>
</ul>
<h2 id="heading-maintenance-windows"><strong>Maintenance Windows</strong></h2>
<ul>
<li><p>Defines a schedule for when to perform actions on instances</p>
</li>
<li><p>Example: OS patching, updating drivers, installing software,…</p>
</li>
</ul>
<h2 id="heading-automation">Automation</h2>
<ul>
<li><p>Simplifies common maintenance and deployment tasks of EC2 instances and other AWS resources</p>
</li>
<li><p>Ex: restart instances, create an AMI, EBS Snapshot,…</p>
</li>
<li><p><strong>Automation Runbook</strong> - SSM Documents to define actions pre-formed on EC2 instances or AWS Resources</p>
</li>
<li><p>Can be triggered using:</p>
<ul>
<li><p>Manually using AWS Console, AWS CLI, SDK</p>
</li>
<li><p>EventBridge</p>
</li>
<li><p>On a schedule using <strong>Maintenance Windows</strong></p>
</li>
<li><p>By AWS Config for <strong>rules remediations</strong></p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-aws-outposts">AWS Outposts</h1>
<ul>
<li><p>Benefits:</p>
<ul>
<li><p>Low-latency access to on-premises systems</p>
</li>
<li><p>Local data processing</p>
</li>
<li><p>Data residency</p>
</li>
<li><p>Easier migration from on-premises to the cloud</p>
</li>
<li><p>Fully managed service</p>
</li>
</ul>
</li>
<li><p>Some service that work on Outposts: EC2, EBS, S3, EKS, ECS, RDS, EMR</p>
</li>
</ul>
<h1 id="heading-aws-batch">AWS Batch</h1>
<ul>
<li><p>Fully managed batch processing at any scale</p>
</li>
<li><p>Efficiently run 100,000s of computing batch jobs on AWS</p>
</li>
<li><p>A “batch” job is a job with a start and an end</p>
</li>
<li><p>Batch will dynamically launch EC2 or Spot Instances</p>
</li>
<li><p>Batch jobs are defined as Docker images and run on ECS</p>
</li>
<li><p>Helpful for cost optimizations and focusing less on the infrastructure</p>
</li>
</ul>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Lambda</strong></td><td><strong>Batch</strong></td></tr>
</thead>
<tbody>
<tr>
<td>Time Limit</td><td>No time limit</td></tr>
<tr>
<td>Limited runtimes</td><td>Any runtime as long as it’s packaged as a docker image</td></tr>
<tr>
<td>Limited temporary disk space</td><td>rely on EBS/Instance storage</td></tr>
<tr>
<td>Serverless</td><td>Relies on EC2</td></tr>
</tbody>
</table>
</div><h1 id="heading-amazon-appflow">Amazon AppFlow</h1>
<ul>
<li><p>Fully managed integration service that enables secure transfer of data between SaaS applications and AWS</p>
</li>
<li><p>Sources: Salesforce, SAP, ServiceNow</p>
</li>
<li><p>Destinations: S3, Redshift,…</p>
</li>
<li><p>Frequency: on a schedule, in response to events, on-demand</p>
</li>
</ul>
<h1 id="heading-aws-amplify">AWS Amplify</h1>
<ul>
<li>A set of tools and services that helps develop and deploy scalable full-stack web and mobile applications</li>
</ul>
<h1 id="heading-instance-scheduler-on-aws">Instance Scheduler on AWS</h1>
<ul>
<li><p>Automatically start/stop AWS services</p>
</li>
<li><p>Supports cross-account and cross-region resources</p>
</li>
<li><p>Schedules are managed in a DynamoDB table</p>
</li>
<li><p>Supports EC2, EC2 Auto Scaling Groups, and RDS instances</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: More Solution Architectures]]></title><description><![CDATA[High-Performance Computing
Data Management & Transfer

AWS Direct Connect: Move Gb/s of data to the cloud, over a private secure network

Snowball & Snowmobile: Move PB of data to the cloud

AWS DataSync: Move large amounts of data between on-premise...]]></description><link>https://blog.tuando.app/saa-c03-certification-more-solution-architectures</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-more-solution-architectures</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Mon, 02 Dec 2024 17:41:20 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-high-performance-computing">High-Performance Computing</h1>
<h2 id="heading-data-management-amp-transfer">Data Management &amp; Transfer</h2>
<ul>
<li><p>AWS Direct Connect: Move Gb/s of data to the cloud, over a private secure network</p>
</li>
<li><p>Snowball &amp; Snowmobile: Move PB of data to the cloud</p>
</li>
<li><p>AWS DataSync: Move large amounts of data between on-premise and S3, EFS, and FSx for Windows</p>
</li>
</ul>
<h2 id="heading-compute-and-networking">Compute and Networking</h2>
<ul>
<li><p>EC2 Instances:</p>
<ul>
<li><p>CPU optimized, GPU optimized</p>
</li>
<li><p>Spot Instances, Spot Fleets for cost savings + Auto Scaling</p>
</li>
</ul>
</li>
<li><p>EC2 Placement Groups: Cluster for good network performance</p>
</li>
</ul>
<h3 id="heading-networking">Networking</h3>
<ul>
<li><p>EC2 Enhanced Networking (SR-IOV)</p>
<ul>
<li><p>Higher bandwidth, higher PPS (packet per second), lower latency</p>
</li>
<li><p>Option 1: Elastic Network Adapter (EFA) up to 100 Gbps</p>
</li>
<li><p>Option 2: Intel 82599 VF up to 10 Gbps - LEGACY</p>
</li>
</ul>
</li>
<li><p>Elastic Fabric Adapter (EFA)</p>
<ul>
<li><p>Improved ENA for HPC, only works for Linux</p>
</li>
<li><p>Great for inter-node communications, tightly coupled workloads</p>
</li>
<li><p>Leverages Message Passing Interface standard</p>
</li>
<li><p>Bypasses the underlying Linux OS to provide low-latency, reliable transport</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-storage">Storage</h2>
<ul>
<li><p>Instance-attached storage:</p>
<ul>
<li><p>EBS: scale up to 256,000 IOPS with io2 Block Express</p>
</li>
<li><p>Instance Store: scale to millions of IOPS, linked to EC2 instance, low latency</p>
</li>
</ul>
</li>
<li><p>Network storage:</p>
<ul>
<li><p><strong>S3:</strong> large blob, not a file system</p>
</li>
<li><p><strong>EFS:</strong> scale IOPS based on total size, or use provisioned IOPS</p>
</li>
<li><p><strong>FSx for Lustre:</strong></p>
<ul>
<li><p>HPC-optimized distributed file system, millions of IOPS</p>
</li>
<li><p>Backed by S3</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-automation-and-orchestration">Automation and Orchestration</h2>
<ul>
<li><p><strong>AWS Batch</strong></p>
<ul>
<li><p>AWS Batch supports multi-node parallel jobs, which enables the running of single jobs that span multiple EC2 instances</p>
</li>
<li><p>Easily schedule jobs and launch EC2 instances accordingly</p>
</li>
</ul>
</li>
<li><p><strong>AWS ParallelCluster</strong></p>
<ul>
<li><p>Open-source cluster management tool to deploy HPC on AWS</p>
</li>
<li><p>Configure with text files</p>
</li>
<li><p>Automate the creation of VPC, Subnet, Cluster type, and instance types</p>
</li>
<li><p><strong>Ability to enable EFA on the cluster (improves network performance)</strong></p>
</li>
</ul>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Disaster Recovery and Migrations]]></title><description><![CDATA[Disaster Recovery in AWS
There are different kinds of Disaster Recovery

On-premise → On-premise: traditional DR, and very expensive

On-premise → AWS Cloud: hybrid recovery

AWS Cloud Region A → AWS Cloud Region B


RPO and RTO
RPO

How much of a da...]]></description><link>https://blog.tuando.app/saa-c03-certification-disaster-recovery-and-migrations</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-disaster-recovery-and-migrations</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Mon, 02 Dec 2024 15:47:26 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-disaster-recovery-in-aws">Disaster Recovery in AWS</h1>
<h2 id="heading-there-are-different-kinds-of-disaster-recovery">There are different kinds of Disaster Recovery</h2>
<ul>
<li><p>On-premise → On-premise: traditional DR, and very expensive</p>
</li>
<li><p>On-premise → AWS Cloud: hybrid recovery</p>
</li>
<li><p>AWS Cloud Region A → AWS Cloud Region B</p>
</li>
</ul>
<h2 id="heading-rpo-and-rto">RPO and RTO</h2>
<h3 id="heading-rpo">RPO</h3>
<ul>
<li>How much of a data loss</li>
</ul>
<h3 id="heading-rto">RTO</h3>
<ul>
<li>The amount of downtime of the application</li>
</ul>
<h2 id="heading-pilot-light">Pilot Light</h2>
<ul>
<li><p>A small version of the app is always running in the cloud</p>
</li>
<li><p>Useful for the critical core (pilot light)</p>
</li>
<li><p>Very similar to Backup and Restore</p>
</li>
<li><p>Faster than Backup and Restore</p>
</li>
</ul>
<h2 id="heading-warm-standby">Warm Standby</h2>
<ul>
<li><p>The full system is up and running but at a minimum size</p>
</li>
<li><p>Upon disaster, we can scale to production load</p>
</li>
</ul>
<h2 id="heading-multi-site-hot-site-approach">Multi-Site / Hot Site Approach</h2>
<ul>
<li><p>Very low RTO (minutes or seconds) - very expensive</p>
</li>
<li><p>Full Production Scale is running AWS and On-Premise</p>
</li>
</ul>
<h2 id="heading-disaster-recovery-tips">Disaster Recovery Tips</h2>
<ul>
<li><p>Backup</p>
<ul>
<li><p>EBS Snapshots, RDS Automated backups / Snapshots,…</p>
</li>
<li><p>Regular pushes to S3/S3 IA/Glacier, LifeCycle Policy, Cross Region Replication</p>
</li>
<li><p>From On-Premise: Snowball or Storage Gateway</p>
</li>
</ul>
</li>
<li><p>HA</p>
<ul>
<li><p>Use Route53 to migrate DNS over from Region to Region</p>
</li>
<li><p>RDS Multi-AZ, ElasticCache Multi-AZ, EFS, S3</p>
</li>
<li><p>Site to Site VPN as a recovery from Direct Connect</p>
</li>
</ul>
</li>
<li><p>Replication</p>
<ul>
<li><p>RDS Replication, AWS Aurora + Global Database</p>
</li>
<li><p>Database replication from on-premise to RDS</p>
</li>
<li><p>Storage Gateway</p>
</li>
</ul>
</li>
<li><p>Automation</p>
<ul>
<li><p>CloudFormation / Elastic Beanstalk to re-create a whole new environment</p>
</li>
<li><p>Recover / Reboot EC2 instances with CloudWatch if alarms fail</p>
</li>
<li><p>AWS Lambda functions for customized automation</p>
</li>
</ul>
</li>
<li><p>Chaos</p>
<ul>
<li>Netflix has a “<strong>simian-army</strong>” randomly terminating EC2</li>
</ul>
</li>
</ul>
<h1 id="heading-database-migration-service">Database Migration Service</h1>
<ul>
<li><p>Supports:</p>
<ul>
<li><p>Homogeneous migrations: Oracle to Oracle</p>
</li>
<li><p>Heterogeneous: SQL Server to Aurora</p>
</li>
</ul>
</li>
<li><p>Continuous Data Replication using the CDC</p>
</li>
<li><p>Must create an EC2 instance to perform the replication tasks</p>
</li>
</ul>
<h2 id="heading-aws-schema-conversion-tool">AWS Schema Conversion Tool</h2>
<ul>
<li><p>Convert Database’s Schema from one engine to another</p>
</li>
<li><p>You do not need to use SCT if you are migrating the same DB engine</p>
</li>
</ul>
<h1 id="heading-rds-amp-aurora-migrations">RDS &amp; Aurora Migrations</h1>
<h2 id="heading-migrate-to-mysql-aurora">Migrate to MySQL Aurora</h2>
<ul>
<li><p>RDS MySQL to Aurora MySQL</p>
<ul>
<li><p>Option 1: DB Snapshots from RDS MySQL restored as MySQL AuroraDB</p>
</li>
<li><p>Options 2: Create an Aurora Read Replica from RDS MySQL, and when the replication lag is 0, promote it as its DB cluster (can take time and cost)</p>
</li>
</ul>
</li>
<li><p>External MySQL to Aurora MySQL</p>
<ul>
<li><p>Option 1:</p>
<ul>
<li><p>Use <strong>Percona Xtrabackup</strong> to create a file backup in S3</p>
</li>
<li><p>Create an Aurora MySQL DB from S3</p>
</li>
</ul>
</li>
<li><p>Option 2:</p>
<ul>
<li><p>Create an Aurora MySQL DB</p>
</li>
<li><p>Use the <strong>mysqldump</strong> utility to migrate MySQL into Aurora (slower than the S3 method)</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Use DMS if both databases are up and running</strong></p>
</li>
</ul>
<h2 id="heading-migrate-to-postgresql-aurora">Migrate to PostgreSQL Aurora</h2>
<ul>
<li><p>RDS PostgreSQL to Aurora PostgreSQL</p>
<ul>
<li><p>Option 1: DB Snapshots from RDS PostgreSQLrestored as PostgreSQL AuroraDB</p>
</li>
<li><p>Options 2: Create an Aurora Read Replica from RDS PostgreSQL, and when the replication lag is 0, promote it as its DB cluster (can take time and cost)</p>
</li>
</ul>
</li>
<li><p>External PostgreSQL to Aurora PostgreSQL</p>
<ul>
<li><p>Create a backup and put it in S3</p>
</li>
<li><p>Import it using the <strong>aws_s3 Aurora extension</strong></p>
</li>
</ul>
</li>
<li><p><strong>Use DMS if both databases are up and running</strong></p>
</li>
</ul>
<h1 id="heading-aws-backup">AWS Backup</h1>
<ul>
<li><p>Fully managed services</p>
</li>
<li><p>Supported services:</p>
<ul>
<li><p>EC2 / EBS</p>
</li>
<li><p>S3</p>
</li>
<li><p>RDS / Aurora / DynamoDB</p>
</li>
<li><p>DocumentDB / Neptune</p>
</li>
<li><p>EFS / FSx (Lustre &amp; Windows File Server)</p>
</li>
<li><p>AWS Storage Gateway</p>
</li>
</ul>
</li>
<li><p>Supports cross-region backups</p>
</li>
<li><p>Supports cross-account backups</p>
</li>
</ul>
<h2 id="heading-aws-backup-vault-lock">AWS Backup Vault Lock</h2>
<ul>
<li><p>Enforce a WORM (Write Once Read Many) state for all the backups that are stored in AWS Backup Vault</p>
</li>
<li><p>Even the root user cannot delete backups when enabled</p>
</li>
</ul>
<h1 id="heading-aws-application-discovery-service">AWS Application Discovery Service</h1>
<ul>
<li><p>Plan migration projects by gathering information about on-premises data centers</p>
</li>
<li><p>Server utilization data and dependency mapping are important for migrations</p>
</li>
<li><p>Agentless Discovery: VM inventory, configuration, and performance history such as CPU, memory, and disk usage</p>
</li>
<li><p>Agent-based Discovery: System configuration, system performance, running processes, and details of the network connections between systems</p>
</li>
<li><p>The resulting data can be viewed in the <strong>AWS Migration Hub</strong></p>
</li>
</ul>
<h1 id="heading-transferring-large-amounts-of-data-to-aws">Transferring large amounts of data to AWS</h1>
<p>Example: transfer 200 TB of data in the cloud. We have a 100 Mbps internet connection</p>
<ul>
<li><p>Snowball</p>
<ul>
<li><p>Will take 2 to 3 snowballs in parallel</p>
</li>
<li><p>Takes about 1 week for the end-to-end transfer</p>
</li>
<li><p>Can be combined with DMS</p>
</li>
</ul>
</li>
<li><p>Direct Connect 1 Gbps</p>
<ul>
<li><p>Long for the one-time setup (over a month)</p>
</li>
<li><p>Will take 200(TB) * <em>1000(GB)</em> * 8(MB)/1 Gbps = 1,600,000s = 18.5d</p>
</li>
</ul>
</li>
<li><p>The Internet / Site-to-Site VPN</p>
<ul>
<li><p>Immediate set up</p>
</li>
<li><p>Will take 200(TB) <em>\</em> 1000(GB)<em> \</em> <em>1000(MB)</em> * 8(MB)/1 Gbps = 185d</p>
</li>
</ul>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Networking]]></title><description><![CDATA[Public and Private IP

Private IP

10.0.0.0 - 10.255.255.255 (10.0.0.0/8)

172.16.0.0 - 172.31.255.255 (172.16.0.0/12) ← AWS default VPC in that range

192.168.0.0 - 192.168.255.255 (192.168.0.0/16) ← home networks



Public IP: All the rest of the I...]]></description><link>https://blog.tuando.app/saa-c03-certification-networking</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-networking</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Sun, 01 Dec 2024 08:59:03 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-public-and-private-ip">Public and Private IP</h1>
<ul>
<li><p><strong>Private IP</strong></p>
<ul>
<li><p>10.0.0.0 - 10.255.255.255 (10.0.0.0/8)</p>
</li>
<li><p>172.16.0.0 - 172.31.255.255 (172.16.0.0/12) ← AWS default VPC in that range</p>
</li>
<li><p>192.168.0.0 - 192.168.255.255 (192.168.0.0/16) ← home networks</p>
</li>
</ul>
</li>
<li><p><strong>Public IP</strong>: All the rest of the IP addresses</p>
</li>
</ul>
<h1 id="heading-subnet">Subnet</h1>
<ul>
<li><p>AWS reserves 5 IP addressed (first 4 and last 1) in each subnet</p>
<ul>
<li><p>Example: if CIDR blocks 10.0.0.0/24, then reserved IP addresses are:</p>
<ul>
<li><p><strong>10.0.0.0</strong> - Network Address</p>
</li>
<li><p><strong>10.0.0.1</strong> - reserved by AWS for the VPC router</p>
</li>
<li><p><strong>10.0.0.2</strong> - mapping to Amazon-provided DNS</p>
</li>
<li><p><strong>10.0.03</strong> - future use</p>
</li>
<li><p><strong>10.0.0.255</strong> - Network Broadcast Address</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h1 id="heading-nat-instance">NAT Instance</h1>
<ul>
<li><p>Allows EC2 Instances in a private subnet to connect to the Internet</p>
</li>
<li><p><strong>Must be launched in a public subnet</strong></p>
</li>
<li><p><strong>Must disable EC2 Setting: Source/destination Check</strong></p>
</li>
<li><p><strong>Must have Elastic IP attached to it</strong></p>
</li>
<li><p>Route Tables must be configured to route traffic from <strong>Private Subnets</strong> to the <strong>NAT Instance</strong></p>
</li>
</ul>
<h2 id="heading-comments">Comments</h2>
<ul>
<li><p>Pre-configured Amazon Linux AMI is available</p>
<ul>
<li>Reached the end of standard support on 31/12/2020</li>
</ul>
</li>
<li><p>Not HA / Resilient setup out of the box</p>
<ul>
<li>It would help if you created an ASG in multi-AZ + resilient user-data script</li>
</ul>
</li>
<li><p>Internet traffic bandwidth depends on EC2 Instance Type</p>
</li>
<li><p>You must manage Security Groups &amp; Rules:</p>
<ul>
<li><p>Inbound</p>
<ul>
<li><p>Allow HTTP/HTTPS traffic coming from Private Subnets</p>
</li>
<li><p>Allow SSH from your home network</p>
</li>
</ul>
</li>
<li><p>Outbound</p>
<ul>
<li>Allow HTTP/HTTPS traffic to the Internet</li>
</ul>
</li>
</ul>
</li>
</ul>
<h1 id="heading-nat-gateway">NAT Gateway</h1>
<ul>
<li><p>AWS-managed NAT, higher bandwidth, HA, no administration</p>
</li>
<li><p>Pay per hour for usage and bandwidth</p>
</li>
<li><p>NATGW is created in a specific AZ, uses an Elastic IP</p>
</li>
<li><p>Cannot be used by EC2 instance in the same subnet</p>
</li>
<li><p><strong>Requires an IGW</strong> (Private Subnet → NATGW → IGW)</p>
</li>
<li><p>5 Gbps of bandwidth with automatic scaling up to 100 Gbps</p>
</li>
<li><p>No Security Groups to manage/required</p>
</li>
</ul>
<h2 id="heading-nat-gateway-with-ha">NAT Gateway with HA</h2>
<ul>
<li><p>NAT Gateway is resilient within a single AZ</p>
</li>
<li><p>Must <strong>create multiple NAT Gateways</strong> in multiple AZs for fault-tolerance</p>
</li>
</ul>
<h1 id="heading-vpc-peering">VPC Peering</h1>
<ul>
<li><p>You can create VPC Peeing connections between VPCs in different AWS accounts/regions</p>
</li>
<li><p>You can reference a security group in a peered VPC (works cross accounts - same region)</p>
</li>
</ul>
<h1 id="heading-vpc-endpoints-aws-privatelink">VPC Endpoints (AWS PrivateLink)</h1>
<ul>
<li><p>Every AWS service is publicly exposed (public URL)</p>
</li>
<li><p>VPC Endpoints (powered by AWS PrivateLink) allows you to connect to AWS services using a private network instead of using the public internet</p>
</li>
</ul>
<h2 id="heading-types-of-endpoints">Types of Endpoints</h2>
<ul>
<li><p>Interface Endpoints (powered by PrivateLink)</p>
<ul>
<li><p>Provisions an ENI (private IP address) as an entry point (must attach a Security Group)</p>
</li>
<li><p>Supports most AWS Services</p>
</li>
<li><p>$ per hour + $ per GB of data processed</p>
</li>
</ul>
</li>
<li><p>Gateway Endpoints</p>
<ul>
<li><p>Provisions a gateway and must be used as a target in a route table (does not use security group)</p>
</li>
<li><p>Supports both <strong>S3</strong> and <strong>DynamoDB</strong></p>
</li>
<li><p>Free</p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-aws-site-to-site-vpn">AWS Site-to-Site VPN</h1>
<ul>
<li><p><strong>Virtual Private Gateway (VGW)</strong></p>
<ul>
<li><p>VPN concentrator on the AWS side of the VPN connection</p>
</li>
<li><p>VGW is created and attached to the VPC from which you want to create the Site-to-Site VPN connection</p>
</li>
<li><p>Possibility to customize the ASN (Autonomous System Number)</p>
</li>
</ul>
</li>
<li><p><strong>Customer Gateway (CGW)</strong></p>
<ul>
<li>A software application or physical device on the customer side of the VPN connection</li>
</ul>
</li>
</ul>
<blockquote>
<p>Enable Route Propagation for the <strong>VGW</strong> in the route table that is accociated with subnets</p>
</blockquote>
<h2 id="heading-aws-vpn-cloudhub">AWS VPN CloudHub</h2>
<ul>
<li><p>Provide secure communication between multiple sites, if you have multiple VPN connections</p>
</li>
<li><p>Low-cost hub-and-spoke model for primary or secondary network connectivity between different locations (VPN only)</p>
</li>
<li><p>It’s a VPN connection so it goes over the public internet</p>
</li>
<li><p>To set it up, connect multiple VPN connections on the same VGW, set dynamic routing, and configure route tables</p>
</li>
</ul>
<h1 id="heading-direct-connect-dx">Direct Connect (DX)</h1>
<ul>
<li><p>Provides a dedicated private connection from a remote network to VPC</p>
</li>
<li><p>Supports both IPv4 and IPv6</p>
</li>
<li><p>Use Cases:</p>
<ul>
<li><p>Increase bandwidth throughput</p>
</li>
<li><p>More consistent network experience</p>
</li>
<li><p>Hybrid Environments (on-prem + cloud)</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-connection-types">Connection Types</h2>
<ul>
<li><p>Dedicated Connections: 1 Gbps, 10 Gbps and 100 Gbps capacity</p>
</li>
<li><p>Hosted Connections: 50 Mbps, 500 Mbps, to 10 Gbps</p>
</li>
<li><p>Lead times are often longer than 1 month to establish a new connection</p>
</li>
</ul>
<h2 id="heading-encryption">Encryption</h2>
<ul>
<li><p>Data in transit is not encrypted but is private</p>
</li>
<li><p>AWS Direct Connect + VPN provides an IPsec-encrypted private connection</p>
</li>
<li><p>Good for an extra level of security</p>
</li>
</ul>
<blockquote>
<p>In case Direct Connect fails, you can set up a backup Direct Connect connection (expensive), or a Site-to-Site VPN connectio</p>
</blockquote>
<h1 id="heading-transit-gateway">Transit Gateway</h1>
<ul>
<li><p>For having transitive peering between thousands of VPC and on-prem connection</p>
</li>
<li><p>Regional resources can work cross-region</p>
</li>
<li><p>Supports IP Multicast</p>
</li>
</ul>
<h1 id="heading-traffic-mirroring">Traffic Mirroring</h1>
<ul>
<li><p>Allows to capture and inspect network traffic in VPC</p>
</li>
<li><p>Route the traffic to security appliances</p>
</li>
<li><p>Capture the traffic</p>
<ul>
<li><p>From (Source)</p>
</li>
<li><p>To (Targets)</p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-egress-only-internet-gateway">Egress Only Internet Gateway</h1>
<ul>
<li><p>Used for IPv6 only (similar to a NAT Gateway but for IPv6)</p>
</li>
<li><p>Must update the <strong>Route Tables</strong></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Security & Encryption]]></title><description><![CDATA[KMS Service

Manages encryption keys

Able to audit KMS usage using CloudTrail

Having three kinds of Keys:

KMS Keys

Symmetric

Asymmetric




KMS Keys
Types of KMS Keys:

AWS Owned Keys (free): SSE-S3, SSE-SQS,…

AWS Managed Keys (free): aws/servi...]]></description><link>https://blog.tuando.app/saa-c03-certification-security-encryption</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-security-encryption</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Sat, 30 Nov 2024 10:51:19 GMT</pubDate><content:encoded><![CDATA[<h1 id="heading-kms-service">KMS Service</h1>
<ul>
<li><p>Manages encryption keys</p>
</li>
<li><p>Able to audit KMS usage using <strong>CloudTrail</strong></p>
</li>
<li><p>Having <strong>three</strong> kinds of Keys:</p>
<ol>
<li><p>KMS Keys</p>
</li>
<li><p>Symmetric</p>
</li>
<li><p>Asymmetric</p>
</li>
</ol>
</li>
</ul>
<h2 id="heading-kms-keys">KMS Keys</h2>
<p><strong>Types of KMS Keys:</strong></p>
<ul>
<li><p>AWS Owned Keys (free): SSE-S3, SSE-SQS,…</p>
</li>
<li><p>AWS Managed Keys (free): aws/service-name, ex: aws/rds</p>
</li>
<li><p>Customer-managed keys created in KMS: <strong>$1 per month</strong></p>
</li>
<li><p>Customer-managed keys imported: <strong>$1 per month</strong></p>
<ul>
<li>pay for the API call to KMS ($0.03/10.000 calls)</li>
</ul>
</li>
</ul>
<p><strong>Automatic Key rotation:</strong></p>
<ul>
<li><p>AWS Managed Keys: automatic every 1 year</p>
</li>
<li><p>Customer-managed keys: (must be enabled) automatic &amp; on-demand</p>
</li>
<li><p>Imported KMS key: only manual rotation possible using alias</p>
</li>
</ul>
<h2 id="heading-kms-multi-region-keys">KMS Multi-Region Keys</h2>
<ul>
<li><p>Identical KMS Keys in different regions that can be used interchangeably (you can encrypt in one Region and decrypt in Other Regions)</p>
</li>
<li><p>Multi-region keys have the same <strong>key ID, key material, and automatic rotation</strong>….</p>
</li>
<li><p>KMS multi regions are NOT global (Primary + Replicas)</p>
</li>
<li><p>Use cases: global client-side encryption, encryption on Global DynamoDB, Global Aurora</p>
</li>
</ul>
<h2 id="heading-s3-replication-encryption-considerations">S3 Replication Encryption Considerations</h2>
<ul>
<li><p>Unencrypted objects and objects encrypted with SSE-S3 are replicated by default.</p>
</li>
<li><p>Objects encrypted with SSE-C (Customer Key) can be replicated</p>
</li>
<li><p>For objects encrypted with SSE-KMS, you need to enable the option</p>
<ul>
<li><p>Specify which KMS key to encrypt the objects</p>
</li>
<li><p>Adapt the KMS Key Policy for the target key</p>
</li>
<li><p>An IAM Role with kms:Decrypt for the source KMS Key and km:Encrypt for the target KMS Key</p>
</li>
<li><p>You might get KMS throttling errors, so you can request a Service Quotas increase.</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-ami-sharing-process-encrypted-via-kms">AMI Sharing Process Encrypted via KMS</h2>
<ol>
<li><p>Must modify the image attribute to add a Launch Permission</p>
</li>
<li><p>Must share the KMS Keys</p>
</li>
<li><p>The IAM Role/User in the target account must have permission to DescribeKey, ReEncrypted, CreateGrant, and Decrypt.</p>
</li>
<li><p>When launching an EC2 Instance from the AMI, the target account can optionally specify a new KMS Key to re-encrypt the volumes.</p>
</li>
</ol>
<h2 id="heading-ssm-parameter-store">SSM Parameter Store</h2>
<ul>
<li><p>Secure storage for configuration and secrets</p>
</li>
<li><p>Optional Seamless Encryption using KMS</p>
</li>
<li><p>Serverless, scalable, durable, easy SDK</p>
</li>
<li><p>Version tracking</p>
</li>
<li><p>Security through IAM</p>
</li>
<li><p>Notifications with EventBridge</p>
</li>
<li><p>Integration with CloudFormation</p>
</li>
</ul>
<h4 id="heading-parameters-policies">Parameters Policies</h4>
<ul>
<li><p>Allow to assign a TTL to a parameter to force updating or deleting</p>
</li>
<li><p>Can assign multiple policies at a time</p>
</li>
</ul>
<h1 id="heading-aws-secrets-manager">AWS Secrets Manager</h1>
<h2 id="heading-overview">Overview</h2>
<ul>
<li><p>Capability to force rotation of secrets every X days</p>
</li>
<li><p>Integration with RDS (MySQL, PostgreSQL, Aurora)</p>
</li>
<li><p>Secrets are encrypted using KMS</p>
</li>
<li><p><strong>Mostly meant for RDS integration</strong></p>
</li>
</ul>
<h2 id="heading-multi-region-secrets">Multi-region Secrets</h2>
<ul>
<li><p><strong>Secrets Manager</strong> keeps reading replicas in sync with the primary Secret</p>
</li>
<li><p>Ability to promote a read replica Secret to a standalone Secret</p>
</li>
<li><p>Use cases: multi-region apps, disaster recovery, multi-region DB,…</p>
</li>
</ul>
<h1 id="heading-aws-certificate-manager-acm">AWS Certificate Manager (ACM)</h1>
<ul>
<li><p>Easily provision, manage, and deploy TLS Certificates</p>
</li>
<li><p>Provision in-flight encryption to for websites (HTTPS)</p>
</li>
<li><p>Supports both public and private TLS Certificates</p>
</li>
<li><p>Free of charge for public TLS Certificates</p>
</li>
<li><p>Automatic TLS certificate renewal</p>
</li>
<li><p>Integration with (load TLS certificates on)</p>
<ul>
<li><p>Elastic Load Balancers</p>
</li>
<li><p>CloudFront Distributions</p>
</li>
<li><p>APIs on API Gateway</p>
</li>
</ul>
</li>
<li><p>Cannot use ACM with EC2</p>
</li>
</ul>
<h2 id="heading-requesting-public-certificates">Requesting Public Certificates</h2>
<ol>
<li><p>List domain names to be included in the certificate</p>
<ul>
<li><p>Fully Qualified Domain Name (FQDN): corp.example.com</p>
</li>
<li><p>Wildcard Domain: *.example.com</p>
</li>
</ul>
</li>
<li><p>Select Validation Method: DNS Validation or Email Validation</p>
<ul>
<li><p>DNS Validation is preferred for automation purposes</p>
</li>
<li><p>Email validation will send emails to contact addressed in the WHOIS database</p>
</li>
<li><p>DNS Validation will leverage a CNAME record to DNS config</p>
</li>
</ul>
</li>
<li><p>It will take a few hours to get verified</p>
</li>
<li><p>The Public Cerfificated will be enrolled for automatic renewal</p>
<ul>
<li>ACM automatically renews ACM-generated certificates 60 days before expiry</li>
</ul>
</li>
</ol>
<h2 id="heading-importing-public-certificates">Importing Public Certificates</h2>
<ul>
<li><p>No automatic renewal, must import a new certificate before expiry</p>
</li>
<li><p>ACM sends daily expiration events starting <strong>45 days</strong> prior to expiration</p>
<ul>
<li><p>The # of days can be configured</p>
</li>
<li><p>Events are appearing in <strong>EventBridge</strong></p>
</li>
</ul>
</li>
<li><p><strong>AWS Config</strong> has a managed rule named <strong>acm-certificate-expiration-check</strong> to check for expiring certificates</p>
</li>
</ul>
<h2 id="heading-integration-with-api-gateway">Integration with API Gateway</h2>
<ul>
<li><p>Create a Custom Domain Name in API Gateway</p>
</li>
<li><p><strong>Edge-Optimized (default):</strong> For global clients</p>
<ul>
<li><p>Requests are routed through the CloudFront Edge locations (improves latency)</p>
</li>
<li><p>The API Gateway still lives in only one region</p>
</li>
<li><p><strong>The TLS Certificate must be in the same region as CloudFront</strong></p>
</li>
<li><p>Then setup CNAME or (better) A-Alias record in Route53</p>
</li>
</ul>
</li>
<li><p><strong>Regional</strong></p>
<ul>
<li><p>For clients in the same region</p>
</li>
<li><p><strong>The TLS Certificates must be imported on API Gateway, in the same region as the API Stage</strong></p>
</li>
<li><p>Then setup CNAME or (better) A-Alias record in Route53</p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-web-application-firewall-waf">Web Application Firewall (WAF)</h1>
<ul>
<li><p>Protects web application from common web exploit (Layer 7)</p>
</li>
<li><p>Layer 7 is HTTP (vs Layer 4 is TCP/UDP - WAF <strong>does not support</strong> this layer)</p>
</li>
<li><p>Deploy on</p>
<ul>
<li><p><strong>Application Load Balancer</strong></p>
</li>
<li><p><strong>API Gateway</strong></p>
</li>
<li><p><strong>CloudFront</strong></p>
</li>
<li><p><strong>Cognito User Pool</strong></p>
</li>
<li><p><strong>AppSync GraphSQL API</strong></p>
</li>
</ul>
</li>
<li><p>Define <strong>Web ACL Rules: IP Sets, Rate-based rules,…</strong></p>
</li>
<li><p>Web ACL are Regional except for CloudFront</p>
</li>
<li><p>A rule group is a reusable set of rules that you can add to a web ACL</p>
</li>
</ul>
<h2 id="heading-fixed-ip-while-using-waf-with-a-lb">Fixed IP while using WAF with a LB</h2>
<ul>
<li><p>WAF does not support the Network Load Balancer (Layer 4)</p>
</li>
<li><p>We can use <strong>Global Accelerator which provides fixed IPv4</strong> for fixed IP and WAF on the ALB</p>
</li>
</ul>
<h1 id="heading-shield-ddos-protection">Shield - DDOS Protection</h1>
<ul>
<li><p>AWS Shield Standard</p>
<ul>
<li><p>Free service that is active for every AWS customer</p>
</li>
<li><p>Provides protection form attacks such as SYN/UDP Floods, Refection attacks and other layer 3/payer 4 attacks</p>
</li>
</ul>
</li>
<li><p>AWS Shield Advanced</p>
<ul>
<li><p>Optional DDoS mitigation service ($3000 per month per organization)</p>
</li>
<li><p>Protect against more <strong>sophisticated attack</strong> on EC2, ELB, CloudFront, AWS Global Accelerator, Route53</p>
</li>
<li><p>24/7 access to AWS DDoS response team</p>
</li>
</ul>
</li>
</ul>
<h1 id="heading-firewall-manager">Firewall Manager</h1>
<ul>
<li><p>Manage rules in all accounts of an AWS Organization</p>
</li>
<li><p>Security policy: common set of security rules</p>
<ul>
<li><p>WAF rules</p>
</li>
<li><p>AWS Shield Advanced</p>
</li>
<li><p>Security Group for EC2, ALB</p>
</li>
<li><p>AWS Network Firewall (VPC Level)</p>
</li>
<li><p>Route53 Resolver DNS Firewall</p>
</li>
<li><p>Policies are created at the region level</p>
</li>
</ul>
</li>
<li><p><strong>Rules are applied to new resources as they are created across all and future accounts in Organization</strong></p>
</li>
</ul>
<h1 id="heading-amazon-guardduty">Amazon GuardDuty</h1>
<ul>
<li><p>Intelligent Threat discovery to protect AWS Account</p>
</li>
<li><p>Uses ML algorithms, anomaly detection, 3rd party data</p>
</li>
<li><p>Input data includes: CloudTrail Events Logs, VPC Flow Logs, DNS Logs,…</p>
</li>
<li><p>Can be setup EventBridgu rules to be notified in case of findings</p>
</li>
<li><p>Can protect against <strong>CryptoCurrency</strong> attacks</p>
</li>
</ul>
<h1 id="heading-amazon-inspector">Amazon Inspector</h1>
<ul>
<li><p>Automated Security Assessments</p>
</li>
<li><p>Used for <strong>EC2, Container Images, Lambda</strong></p>
</li>
<li><p>Reporting &amp; Integration with AWS Security Hub</p>
</li>
<li><p>Send findings to EventBridge</p>
</li>
</ul>
<h1 id="heading-amazon-macie">Amazon Macie</h1>
<ul>
<li>Helps identify and alert to sensitive data such as personally identifiable information (PII)</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Setting a Static IP on Ubuntu]]></title><description><![CDATA[Config the Static IP at /etc/netplan/00-installer-config.yaml
network:
  ethernets:
    enp0s8:
      dhcp4: no
      addresses: [192.168.202.10/24]
  version: 2

Apply the new changes
sudo netplan try]]></description><link>https://blog.tuando.app/setting-a-static-ip-on-ubuntu</link><guid isPermaLink="true">https://blog.tuando.app/setting-a-static-ip-on-ubuntu</guid><category><![CDATA[Ubuntu]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Wed, 27 Nov 2024 08:32:09 GMT</pubDate><content:encoded><![CDATA[<p>Config the Static IP at /etc/netplan/00-installer-config.yaml</p>
<pre><code class="lang-yaml"><span class="hljs-attr">network:</span>
  <span class="hljs-attr">ethernets:</span>
    <span class="hljs-attr">enp0s8:</span>
      <span class="hljs-attr">dhcp4:</span> <span class="hljs-literal">no</span>
      <span class="hljs-attr">addresses:</span> [<span class="hljs-number">192.168</span><span class="hljs-number">.202</span><span class="hljs-number">.10</span><span class="hljs-string">/24</span>]
  <span class="hljs-attr">version:</span> <span class="hljs-number">2</span>
</code></pre>
<p>Apply the new changes</p>
<pre><code class="lang-bash">sudo netplan try
</code></pre>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: CloudWatch, CloudTrail and Config]]></title><description><![CDATA[CloudWatch
Metrics

Provides metrics for every service in AWS

Metrics belong to namespaces

Dimension is an attribute of a metric (instance id, environment,…)

Up to 30 dimensions per metric

Metrics have timestamps

Can create CloudWatch dashboards...]]></description><link>https://blog.tuando.app/saa-c03-certification-cloudwatch-cloudtrail-and-config</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-cloudwatch-cloudtrail-and-config</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Tue, 26 Nov 2024 08:41:19 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-cloudwatch">CloudWatch</h2>
<h3 id="heading-metrics">Metrics</h3>
<ul>
<li><p>Provides metrics for every service in AWS</p>
</li>
<li><p>Metrics belong to <strong>namespaces</strong></p>
</li>
<li><p>Dimension is an attribute of a metric (instance id, environment,…)</p>
</li>
<li><p>Up to 30 dimensions per metric</p>
</li>
<li><p>Metrics have <strong>timestamps</strong></p>
</li>
<li><p>Can create CloudWatch dashboards of metrics</p>
</li>
<li><p>Can create <strong>Custom Metrics</strong></p>
</li>
</ul>
<h3 id="heading-metric-streams">Metric Streams</h3>
<ul>
<li><p>Continually stream CloudWatch metrics to a destination, with near-real-time delivery and low latency</p>
<ul>
<li><p>Amazon Kinesis Data Firehose</p>
</li>
<li><p>3rd party service provider: <strong>Datadog</strong>, <strong>Sumo Logic</strong>,…</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-logs">Logs</h3>
<ul>
<li><p>Log groups: arbitrary name, usually representing an application</p>
</li>
<li><p>Can define log expiration policies (never expire, 1 day to 10 years,…)</p>
</li>
<li><p>CloudWatch Logs can send logs to:</p>
<ul>
<li><p>S3 (export)</p>
</li>
<li><p>Kinesis Data Streams/Firehose</p>
</li>
<li><p>Lambda</p>
</li>
<li><p>OpenSearch</p>
</li>
</ul>
</li>
<li><p>Logs are encrypted by default</p>
</li>
<li><p>Can set KMS-based encryption with own keys</p>
</li>
</ul>
<h5 id="heading-logs-sources">Logs - Sources</h5>
<ul>
<li><p>SDK, CloudWatch Logs Agent, CloudWatch Unified Agent</p>
</li>
<li><p>Elastic Beanstalk, ECS, Lambda, VPC Flow Logs, API Gateway, CloudTrail, Route53</p>
</li>
</ul>
<h4 id="heading-logs-insights">Logs Insights</h4>
<ul>
<li><p>Search and analyze log data stored in CloudWatch Logs</p>
</li>
<li><p>Example: find a specific IP inside a log,…</p>
</li>
<li><p>Provides a purpose-built query language</p>
<ul>
<li><p>Automatically discovers fields from AWS Services and JSON log events</p>
</li>
<li><p>Can save queries and add them to <strong>CloudWatch Dashboards</strong></p>
</li>
</ul>
</li>
<li><p>Can query multiple Log Groups in different AWS Accounts</p>
</li>
<li><p>It’s a query engine, not a real-time engine</p>
</li>
</ul>
<h4 id="heading-s3-export">S3 Export</h4>
<ul>
<li><p>Log data can take up to 12 hours to become available for export</p>
</li>
<li><p>The API call is <strong>CreateExportTask</strong></p>
</li>
<li><p>Not near-real-time or real-time,… use <strong>Logs Subscription</strong> instead</p>
</li>
</ul>
<h4 id="heading-logs-subscriptions">Logs Subscriptions</h4>
<ul>
<li><p>Get real-time log events from CloudWatch Logs for processing and analysis</p>
</li>
<li><p>Send to Kinesis Data Streams/Firehose or Lambda</p>
</li>
<li><p><strong>Subscription Filter</strong></p>
</li>
</ul>
<h3 id="heading-cloudwatch-unified-agent">CloudWatch Unified Agent</h3>
<ul>
<li><p>Collected Linux server / EC2 instance directly</p>
</li>
<li><p>CPU</p>
</li>
<li><p>Disk metrics</p>
</li>
<li><p>RAM</p>
</li>
<li><p>Netstat</p>
</li>
<li><p>Processes</p>
</li>
<li><p>Swap Space</p>
</li>
<li><p>Reminder: out-of-the-box metrics for EC2 - disk, CPU, network (high level)</p>
</li>
</ul>
<h3 id="heading-cloudwatch-alarm">CloudWatch Alarm</h3>
<ul>
<li><p>Used to trigger notifications for any metric</p>
</li>
<li><p>Various options (sampling, %, max, min, etc,…)</p>
</li>
</ul>
<p>Alarm States:</p>
<ul>
<li><p>OK</p>
</li>
<li><p>INSUFFICIENT_DATA</p>
</li>
<li><p>ALARM</p>
</li>
</ul>
<h3 id="heading-alarm-target">Alarm Target</h3>
<ul>
<li><p>Stop, Terminate, Reboot or Recover an EC2 Instance</p>
</li>
<li><p>Trigger Auto Scaling Action</p>
</li>
<li><p>Send notification to <strong>SNS</strong></p>
</li>
</ul>
<h3 id="heading-composite-alarms">Composite Alarms</h3>
<ul>
<li><p>CloudWatch Alarms are on a single metric</p>
</li>
<li><p>Composite Alarms monitor the states of multiple other alarms</p>
</li>
<li><p><strong>AND</strong> and <strong>OR</strong> conditions</p>
</li>
</ul>
<h3 id="heading-good-to-know">Good to know</h3>
<ul>
<li><p>Alarms can be created based on CloudWatch Logs Metrics Filters</p>
</li>
<li><p>To test alarms and notifications, set the alarm state to Alarm using CLI</p>
</li>
<li><pre><code class="lang-bash">  aws cloudwatch set-alarm-state --alarm-name <span class="hljs-string">"myalarm"</span> --state-value ALARM --state-reason <span class="hljs-string">"testing purpose"</span>
</code></pre>
</li>
</ul>
<h2 id="heading-eventbridge-formerly-cloudwatch-events">EventBridge (formerly CloudWatch Events)</h2>
<ul>
<li><p>Schedule: Cron jobs</p>
</li>
<li><p>Event pattern: event rules to react to a service doing something</p>
</li>
<li><p>Trigger Lambda function, send SQS/SNQ messages,…</p>
</li>
</ul>
<h2 id="heading-cloudwatch-container-insights">CloudWatch Container Insights</h2>
<ul>
<li><p>Collect, aggregate, and summarize metrics and logs from containers</p>
</li>
<li><p>Available for containers on:</p>
<ul>
<li><p>ECS</p>
</li>
<li><p>EKS</p>
</li>
<li><p>K8S on EC2</p>
</li>
<li><p>Fargate</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-cloudwatch-lambda-insights">CloudWatch Lambda Insights</h2>
<ul>
<li><p>Collects, aggregates, and summaries system-level metrics including CPU time, memory, disk, and network</p>
</li>
<li><p><strong>Lambda insights</strong> are provided by the <strong>Lambda layer</strong></p>
</li>
</ul>
<h2 id="heading-cloudwatch-contributor-insights">CloudWatch Contributor Insights</h2>
<ul>
<li><p>Analyze log data and create a time series that displays contributor data</p>
<ul>
<li><p>See metrics about the top-N contributors</p>
</li>
<li><p>The total number of unique contributors and their usage</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-cloudwatch-application-insights">CloudWatch Application Insights</h2>
<ul>
<li><p>Provides automated dashboards that show potential problems with monitored applications, to help isolate ongoing issues</p>
</li>
<li><p>Powered by SageMaker</p>
</li>
<li><p>Enhance visibility into application health to reduce the time it will take to troubleshoot and repair application</p>
</li>
<li><p>Findings and alerts are sent to EvenBridge and SSM OpsCenter</p>
</li>
</ul>
<h2 id="heading-cloudtrail">CloudTrail</h2>
<ul>
<li><p>CloudTrail is enabled by default</p>
</li>
<li><p>It provides governance, compliance, and audit for AWS account</p>
</li>
<li><p>Get <strong>a history of events</strong> / <strong>API calls</strong> made within the AWS account</p>
<ul>
<li><p>SDK</p>
</li>
<li><p>Console</p>
</li>
<li><p>CLI</p>
</li>
<li><p>AWS Services</p>
</li>
</ul>
</li>
<li><p>Can put logs from CloudTrail into S3 or CloudWatch Logs</p>
</li>
<li><p><strong>A Trail can be applied to All Regions (default) or Single Region</strong></p>
</li>
<li><p>If a resource is deleted in AWS, investigate <strong>CloudTrail</strong> first</p>
</li>
</ul>
<h3 id="heading-cloudtrail-events">CloudTrail Events</h3>
<ul>
<li><p>Management Events</p>
</li>
<li><p>Data Events</p>
</li>
<li><p>CloudTrail Insights Events</p>
<ul>
<li><p>To detect unusual activity in an AWS account</p>
</li>
<li><p>CloudTrail Insights analyses normal management events to create a baseline</p>
</li>
<li><p>Then, it continuously analyzes written events to detect unusual activity</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-cloudtrail-events-retention">CloudTrail Events Retention</h3>
<ul>
<li><p>Events are stored for 90 days in CloudTrail</p>
</li>
<li><p>To keep events beyond this period, log them to S3 and use Athena</p>
</li>
</ul>
<h2 id="heading-aws-config">AWS Config</h2>
<ul>
<li><p>Helps with auditing and recording compliance of AWS resources</p>
</li>
<li><p>Helps record configurations and changes over time</p>
</li>
<li><p>Questions that can be solved by AWS Config</p>
<ul>
<li><p>Is there unrestricted SSH access to my security groups?</p>
</li>
<li><p>Do my buckets have any public access?</p>
</li>
</ul>
</li>
<li><p>You can receive alerts (SNS) for any changes</p>
</li>
<li><p>AWS Config is a per-region service</p>
</li>
<li><p>Possibility of storing the configuration data in S3</p>
</li>
</ul>
<h3 id="heading-config-rules">Config Rules</h3>
<ul>
<li><p>Can use AWS managed config rules (over 75)</p>
</li>
<li><p>Can make custom configuration rules (must be defined in AWS Lambda)</p>
</li>
<li><p>Rules can be evaluated/triggered:</p>
<ul>
<li><p>For each configuration change</p>
</li>
<li><p>And/or: at regular time intervals</p>
</li>
</ul>
</li>
<li><p><strong>AWS Config Rules</strong> does not prevent actions from happening</p>
</li>
</ul>
<h2 id="heading-summary">Summary</h2>
<ul>
<li><p>CloudWatch</p>
<ul>
<li><p>Performance monitoring &amp; dashboard</p>
</li>
<li><p>Events &amp; Alerting</p>
</li>
<li><p>Log Aggregation &amp; Analysis</p>
</li>
</ul>
</li>
<li><p>CloudTrail</p>
<ul>
<li><p>Record API calls made in the AWS Account by everyone</p>
</li>
<li><p>Can define trails for specific resources</p>
</li>
<li><p>Global service</p>
</li>
</ul>
</li>
<li><p>Config</p>
<ul>
<li><p>Record configuration changes</p>
</li>
<li><p>Evaluate resources against compliance rules</p>
</li>
<li><p>Get timeline of changes and compliance</p>
</li>
</ul>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Size of logs for each Docker container]]></title><description><![CDATA[Print the size of the log for each container by sorting it by size
sudo du -ch $(docker inspect --format='{{.LogPath}}' $(docker ps -qa)) | sort -h

Set default limited log size when creating new containers
On Linux

Path: /etc/docker/daemon.json

On...]]></description><link>https://blog.tuando.app/size-of-logs-for-each-docker-container</link><guid isPermaLink="true">https://blog.tuando.app/size-of-logs-for-each-docker-container</guid><category><![CDATA[Docker]]></category><category><![CDATA[tricks]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Tue, 26 Nov 2024 01:54:56 GMT</pubDate><content:encoded><![CDATA[<p><strong>Print the size of the log for each container by sorting it by size</strong></p>
<pre><code class="lang-bash">sudo du -ch $(docker inspect --format=<span class="hljs-string">'{{.LogPath}}'</span> $(docker ps -qa)) | sort -h
</code></pre>
<p><strong>Set default limited log size when creating new containers</strong></p>
<h4 id="heading-on-linux">On Linux</h4>
<ul>
<li>Path: <strong><em>/etc/docker/daemon.json</em></strong></li>
</ul>
<h4 id="heading-on-windows">On Windows</h4>
<ul>
<li>Path: <strong><em>%USERPROFILE%\.docker\daemon.json</em></strong></li>
</ul>
<pre><code class="lang-json">{
  <span class="hljs-attr">"log-driver"</span>: <span class="hljs-string">"local"</span>,
  <span class="hljs-attr">"log-opts"</span>: {
    <span class="hljs-attr">"max-size"</span>: <span class="hljs-string">"10m"</span>
  }
}
</code></pre>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Machine Learning]]></title><description><![CDATA[Amazon Rekognition

Find objects, text, people, and scenes in images and videos using ML

Facial analysis and facial search to do user verification, people counting

Create a database of “familiar faces” or compare them to celebrities



Use cases:

...]]></description><link>https://blog.tuando.app/saa-c03-certification-machine-learning</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-machine-learning</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Mon, 25 Nov 2024 17:20:06 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-amazon-rekognition">Amazon Rekognition</h2>
<ul>
<li><p>Find objects, text, people, and scenes in images and videos using ML</p>
</li>
<li><p>Facial analysis and facial search to do user verification, people counting</p>
</li>
<li><p>Create a database of “familiar faces” or compare them to celebrities</p>
</li>
</ul>
<blockquote>
<p>Use cases:</p>
<ul>
<li><p>Labeling</p>
</li>
<li><p>Content Moderation</p>
</li>
<li><p>Text Detection</p>
</li>
<li><p>Face Detection and Analysis</p>
</li>
<li><p>Face Search and Verification</p>
</li>
<li><p>Celebrity Regonnition</p>
</li>
<li><p>Pathing</p>
</li>
</ul>
</blockquote>
<h3 id="heading-content-moderation">Content Moderation</h3>
<ul>
<li><p>Detect content that is inappropriate, unwanted, or offensive (images and videos)</p>
</li>
<li><p>Used in social media, broadcast media, advertising, and e-commerce situations to create a safer user experience</p>
</li>
<li><p>Set a minimum confidence Threshold for items that will be flagged</p>
</li>
</ul>
<h2 id="heading-amazon-transcribe">Amazon Transcribe</h2>
<ul>
<li><p>Automatically convert speech to text</p>
</li>
<li><p><strong>Use cases:</strong></p>
<ul>
<li><p>transcribe customer service calls</p>
</li>
<li><p>automate closed captioning and subtitling</p>
</li>
<li><p>generate metadata for media assets</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-amazon-polly">Amazon Polly</h2>
<ul>
<li><p>Turn text into lifelike speech using deep learning</p>
</li>
<li><p>Allowing the creation application to talk</p>
</li>
</ul>
<h3 id="heading-lexicon-amp-ssml">Lexicon &amp; SSML</h3>
<ul>
<li><p>Customize the pronunciation of words with <strong>Pronunciation Lexicons</strong></p>
<ul>
<li><p>Stylized words: St3ph4ne =&gt; “Stephane”</p>
</li>
<li><p>Acronyms: AWS =&gt; “Amazon Web Services”</p>
</li>
</ul>
</li>
<li><p>Upload the lexicons and use them in <strong>SynthesizeSpeech</strong></p>
</li>
<li><p>Generate speech from plain text or documents marked up with <strong>Speech Synthesis Markup Language (SSML)</strong></p>
</li>
</ul>
<h2 id="heading-amazon-lex-amp-connect">Amazon Lex &amp; Connect</h2>
<ul>
<li><p>Amazon Lex: (like Siri)</p>
<ul>
<li><p>Automatic Speech Recognition to convert speech to text</p>
</li>
<li><p>Natural Language Understanding to recognize the intent of text, callers</p>
</li>
<li><p>Help build chatbots, call center bots</p>
</li>
</ul>
</li>
<li><p>Amazon Connect:</p>
<ul>
<li><p>Receive calls, create contact flows, and cloud-based virtual contact center</p>
</li>
<li><p>Can integrate with other CRM systems or AWS</p>
</li>
<li><p>No upfront payments, 80% cheaper than traditional contact center solutions</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-amazon-comprehend">Amazon Comprehend</h2>
<ul>
<li><p>For NLP</p>
</li>
<li><p>Fully managed and serverless service</p>
</li>
<li><p>Uses ML to find insights and relationships in text</p>
</li>
<li><p>Use cases:</p>
<ul>
<li><p>analyze customer interactions</p>
</li>
<li><p>create and group articles by topics</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-comprehend-medical">Comprehend Medical</h2>
<ul>
<li><p>Detects and returns useful information in unstructured clinical text: Physician’s notes, Discharge summaries, and Test results,…</p>
</li>
<li><p>Use NLP to detect Protected Health Information</p>
</li>
</ul>
<h2 id="heading-sagemaker">SageMaker</h2>
<ul>
<li><p>Fully managed service to build LM models</p>
</li>
<li><p>Typically difficult to do all the processes in one place + provision services</p>
</li>
</ul>
<h2 id="heading-amazon-forecast">Amazon Forecast</h2>
<ul>
<li><p>Fully managed service that uses ML to deliver highly accurate forecasts</p>
</li>
<li><p>Example: predict the future sales of a raincoat</p>
</li>
<li><p>Use cases: Product Demand Planning, Financial Planning,…</p>
</li>
</ul>
<h2 id="heading-amazon-kendra">Amazon Kendra</h2>
<ul>
<li><p>Fully managed document search service powered by ML</p>
</li>
<li><p>Extract answers from a document</p>
</li>
</ul>
<h2 id="heading-amazon-personalize">Amazon Personalize</h2>
<ul>
<li><p>Fully managed ML service to build apps with real-time personalized recommendations</p>
</li>
<li><p>Use cases: retail stores, media, and entertainment,…</p>
</li>
</ul>
<h2 id="heading-amazon-textract">Amazon Textract</h2>
<ul>
<li>Automatically extracts text, handwriting, and data from any scanned documents using AL and ML</li>
</ul>
<h2 id="heading-summary">Summary</h2>
<ul>
<li><p>Rekognition: face detection, labeling</p>
</li>
<li><p>Transcribe: audio to text</p>
</li>
<li><p>Polly: text to audio</p>
</li>
<li><p>Translate: translations</p>
</li>
<li><p>Lex: build conversational bots- chatbots</p>
</li>
<li><p>Connect: cloud contact center</p>
</li>
<li><p>Comprehend: NLP</p>
</li>
<li><p>SageMaker: build ML model</p>
</li>
<li><p>Forecast: build highly accurate forecasts</p>
</li>
<li><p>Kendra: ML-powered search engine</p>
</li>
<li><p>Personalize: real-time personalized recommendations</p>
</li>
<li><p>Textract: detect text and data in documents</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Data & Analytics]]></title><description><![CDATA[Athena

Serverless query service to analyze data stored in S3

Use SQL language to query the files (built on Presto)

Supports CSV, JSON, ORC, Avro, and Parquet

Pricing: 5$ per TB of data scanned

Commonly used with Amazon Quicksight for reporting/d...]]></description><link>https://blog.tuando.app/saa-c03-certification-data-analytics</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-data-analytics</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Mon, 25 Nov 2024 15:59:28 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-athena">Athena</h2>
<ul>
<li><p>Serverless query service to analyze data stored in S3</p>
</li>
<li><p>Use SQL language to query the files (built on Presto)</p>
</li>
<li><p>Supports CSV, JSON, ORC, Avro, and Parquet</p>
</li>
<li><p>Pricing: 5$ per TB of data scanned</p>
</li>
<li><p>Commonly used with <strong>Amazon Quicksight</strong> for reporting/dashboards</p>
</li>
</ul>
<blockquote>
<p>Use cases: Business intelligence / analytics / reporting, analyze &amp; query VPC Flow Logs, ELB Logs, CloudTrail trails,…</p>
<p>Exam tips: analyze data in S3 using serverless SQL, use Athena</p>
</blockquote>
<h3 id="heading-federated-query">Federated Query</h3>
<ul>
<li><p>Allows you to run SQL queries across data stored in SQL, NoSQL, object,…</p>
</li>
<li><p>Uses <strong>Data Source Connectors</strong> that run on <strong>AWS Lambda</strong> to run <strong>Federated Queries</strong></p>
</li>
<li><p>Store the result back in the S3 bucket</p>
</li>
</ul>
<h2 id="heading-redshift">Redshift</h2>
<ul>
<li><p>It is based on PostgreSQL, but it’s not used for OLTP</p>
</li>
<li><p><strong>It’s OLAP</strong> (Online Analytical Processing)</p>
</li>
<li><p>10x better performance than other data warehouses, scale to PBs of data</p>
</li>
<li><p>Columnar storage of data &amp; parallel query engine</p>
</li>
<li><p>Two modes: Serverless Cluster &amp; Provisioned Cluster</p>
</li>
<li><p>Has a SQL interface for performing the queries</p>
</li>
<li><p>BI Tools such as Amazon Quicksight or Tableau</p>
</li>
<li><p>vs <strong>Athena</strong>: faster queries/joins/aggregations thanks to indexes</p>
</li>
</ul>
<h3 id="heading-redshift-cluster">Redshift CLuster</h3>
<ul>
<li><p>The architecture:</p>
<ul>
<li><p><strong>Leader node</strong>: for query planning, results aggregation</p>
</li>
<li><p><strong>Compute node</strong>: for performing the queries, send results to the leader node</p>
</li>
<li><p><strong>Provisioned mode</strong>:</p>
<ul>
<li><p>Choose instance types in advance</p>
</li>
<li><p>Can reserve instances for cost savings</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h3 id="heading-snapshots-amp-dr">Snapshots &amp; DR</h3>
<ul>
<li><p>Snapshots are point-in-time backups of a cluster, stored internally in S3</p>
</li>
<li><p>Snapshots are incremental</p>
</li>
<li><p>You can restore a snapshot into a new cluster</p>
</li>
<li><p>Automated: every 8 hours, every 5 GB, or a schedule</p>
</li>
<li><p>Manual: snapshot is retained until you delete it</p>
</li>
<li><p>You can configure Redshift to copy snapshots of a cluster to another region automatically</p>
</li>
</ul>
<h3 id="heading-redshift-spectrum">Redshift Spectrum</h3>
<ul>
<li><p>Query data that is already in S3 without loading it</p>
</li>
<li><p>Must have a Redshift cluster available to start the query</p>
</li>
<li><p>The query is then submitted to thousands of Redshift Spectrum nodes</p>
</li>
</ul>
<h2 id="heading-opensearch">OpenSearch</h2>
<ul>
<li><p>Two modes:</p>
<ul>
<li><p><strong>managed cluster</strong></p>
</li>
<li><p><strong>serverless cluster</strong></p>
</li>
</ul>
</li>
<li><p>Does not natively support SQL (can be <strong>enabled</strong> via a plugin)</p>
</li>
<li><p>Ingestion from Kinesis Data Firehose, AWS IoT, and CloudWatch Logs,…</p>
</li>
<li><p>Comes with <strong>OpenSearch Dashboards</strong></p>
</li>
</ul>
<h2 id="heading-emr">EMR</h2>
<ul>
<li><p>EMR stands for “Elastic MapReduce”</p>
</li>
<li><p>EMR helps create Hadoop clusters to analyze and process vast amounts of data</p>
</li>
<li><p>The cluster can be made of hundreds of EC2 instances</p>
</li>
<li><p>EMR comes bundled with Spark, HBase, Presto, Flink,…</p>
</li>
<li><p>EMR takes care of all the provisioning and configuration</p>
</li>
<li><p>Auto-scaling and integrated with Spot instances</p>
</li>
</ul>
<blockquote>
<p>Use cases: data processing, machine learning, web indexing, big data,…</p>
</blockquote>
<h3 id="heading-node-types-amp-purchasing">Node types &amp; Purchasing</h3>
<ul>
<li><p>Master Node</p>
</li>
<li><p>Core Node</p>
</li>
<li><p>Task Node (optional)</p>
</li>
<li><p>Purchasing options:</p>
<ul>
<li><p>On-demand</p>
</li>
<li><p>Reserved (min 1 year): cost savings</p>
</li>
<li><p>Spot instances: cheaper</p>
</li>
</ul>
</li>
<li><p>Can have a long-running cluster, or transient (temporary) cluster</p>
</li>
</ul>
<h2 id="heading-quicksight">Quicksight</h2>
<ul>
<li><p>Serverless machine learning-powered business intelligence service to create interactive dashboards</p>
</li>
<li><p>Fast, automatically scalable, embeddable, with per-session pricing</p>
</li>
<li><p>Use cases:</p>
<ul>
<li><p>Business Analytics</p>
</li>
<li><p>Building visualizations</p>
</li>
<li><p>Perform ad-hoc analysis</p>
</li>
</ul>
</li>
<li><p>Integrated with RDS, Aurora, Athena, Redshift, S3,…</p>
</li>
<li><p>Im-memory computation using the SPICE engine if data is imported into QuickSight</p>
</li>
<li><p>Enterprise edition: Column-level Security</p>
</li>
</ul>
<h2 id="heading-glue">Glue</h2>
<ul>
<li><p>Managed <strong>extract, transform, and load</strong> (ETL) service</p>
</li>
<li><p>Useful to prepare and transform data for analytics</p>
</li>
<li><p>Full <strong>serverless</strong> services</p>
</li>
<li><p>Use cases: convert data into <strong>Parquet format</strong></p>
</li>
</ul>
<h3 id="heading-things-to-know-at-a-high-level">Things to know at a high level</h3>
<ul>
<li><p><strong>Glue Job Bookmarks</strong>: prevent re-processing old data</p>
</li>
<li><p><strong>Glue Elastic Views:</strong></p>
<ul>
<li><p>Combine and replicate data across multiple data stores using SQL</p>
</li>
<li><p>No custom code</p>
</li>
<li><p>Leverages a “virtual table”</p>
</li>
</ul>
</li>
<li><p><strong>Glue DataBrew:</strong> clean and normalize data using pre-built transformation</p>
</li>
<li><p><strong>Glue Studio:</strong> new GUI to create, run, and monitor ETL jobs in Glue</p>
</li>
<li><p><strong>Glue Streaming ETL</strong> (built on Spark): compatible with Kinesis Data Streaming, Kafka, MSK (managed Kafka)</p>
</li>
</ul>
<h2 id="heading-aws-lake-formation">AWS Lake Formation</h2>
<ul>
<li><p>Data lake = central place to have all data for analytics purposes</p>
</li>
<li><p>Fully managed service that makes it easy to set up a data lake in days</p>
</li>
<li><p>Discover, cleanse, transform, and ingest data into Data Lake</p>
</li>
<li><p>It automates many complex manual steps (collecting, cleansing, moving, cataloging data,…) and de-duplicate (using ML Transforms)</p>
</li>
<li><p>Combine structured and unstructured data in the data lake</p>
</li>
<li><p>Out-of-the-box source blueprints: S3, RDS, Relational &amp; NoSQL DB,…</p>
</li>
<li><p>Fine-grained Access Control for applications (row and column-level)</p>
</li>
<li><p>Built on top of AWS Glue</p>
</li>
</ul>
<h2 id="heading-kinesis-data-analytics">Kinesis Data Analytics</h2>
<p><strong>For SQL</strong></p>
<ul>
<li><p>Real-time analytics on Kinesis Data Stream &amp; Firehose using SQL</p>
</li>
<li><p>Add reference data from S3 to enrich streaming data</p>
</li>
<li><p>It is fully managed, with no servers to provision</p>
</li>
<li><p>Automatic scaling</p>
</li>
<li><p>Pay for actual consumption rate</p>
</li>
<li><p>Output:</p>
<ul>
<li><p>Kinesis Data Streams</p>
</li>
<li><p>Kinesis Data Firehose</p>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>Use cases: Time series analytics, Real-time dashboards, Real-time metrics</p>
</blockquote>
<p><strong>For Apache Flink</strong></p>
<ul>
<li><p>Use Flink (Java, Scala, or SQL) to process and analyze streaming data</p>
</li>
<li><p>Run any Apache Flink application on a managed cluster on AWS</p>
<ul>
<li><p>provisioning compute resources, parallel computation, automatic scaling</p>
</li>
<li><p>application backups</p>
</li>
<li><p>Use any Apache Flink programming features</p>
</li>
<li><p>Flink does not read from Firehose (use Kinesis Analytics for SQL instead)</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-msk-managed-streaming-for-apache-kafka">MSK (Managed Streaming for Apache Kafka)</h2>
<ul>
<li><p>Alternative to Amazon Kinesis</p>
</li>
<li><p>Fully managed Kafka on AWS</p>
<ul>
<li><p>Allow to create, update, and delete clusters</p>
</li>
<li><p>MSK creates &amp; manages Kafka brokers nodes &amp; Zookeeper nodes</p>
</li>
<li><p>Deploy the MSK cluster in VPC, multi-AZ (up to 3 for HA)</p>
</li>
<li><p>Automatic recovery from common Kafka failures</p>
</li>
<li><p>Data is stored on EBS volumes for as long as you want</p>
</li>
</ul>
</li>
<li><p><strong>MSK Serverless</strong></p>
<ul>
<li><p>Run Kafka on AWS on MSK without managing the capacity</p>
</li>
<li><p>MSK automatically provisions resources and scales computing &amp; storage</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-the-difference-between-kinesis-data-streams-vs-msk">The difference between Kinesis Data Streams vs MSK</h3>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Kinesis Data Stream</strong></td><td><strong>MSK</strong></td></tr>
</thead>
<tbody>
<tr>
<td>1 MB message size limit</td><td>1 MB default, configured for higher</td></tr>
<tr>
<td>Data Streams with Shards</td><td>Kafka Topic with Partitions</td></tr>
<tr>
<td>TLS in-flight encryption</td><td>PLAINTEXT or TLS In-flight encryption</td></tr>
<tr>
<td>KMS at-rest encryption</td><td>KMS at-rest encryption</td></tr>
</tbody>
</table>
</div>]]></content:encoded></item><item><title><![CDATA[Install Docker & Docker Compose on Amazon Linux EC2]]></title><description><![CDATA[To install Docker
sudo yum update -y 

sudo amazon-linux-extras install docker 

sudo yum install docker 

sudo service docker start 

sudo usermod -a -G docker ec2-user

To install Docker Compose
sudo curl -L https://github.com/docker/compose/releas...]]></description><link>https://blog.tuando.app/install-docker-docker-compose-on-amazon-linux-ec2</link><guid isPermaLink="true">https://blog.tuando.app/install-docker-docker-compose-on-amazon-linux-ec2</guid><category><![CDATA[Docker]]></category><category><![CDATA[tips]]></category><category><![CDATA[tricks]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Mon, 25 Nov 2024 03:47:48 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-to-install-docker">To install Docker</h2>
<pre><code class="lang-bash">sudo yum update -y 

sudo amazon-linux-extras install docker 

sudo yum install docker 

sudo service docker start 

sudo usermod -a -G docker ec2-user
</code></pre>
<h2 id="heading-to-install-docker-compose">To install Docker Compose</h2>
<pre><code class="lang-bash">sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/<span class="hljs-built_in">local</span>/bin/docker-compose

sudo chmod +x /usr/<span class="hljs-built_in">local</span>/bin/docker-compose

docker-compose version
</code></pre>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Database in AWS]]></title><description><![CDATA[RDS

Managed PostgreSQL, MySQL, Oracle, SQL Server, DB2, MariaDB, Custom

Provisioned RDS Instance Size and EBS Volume Type & Size

Auto-scaling capability for Storage

Support for Read Replicas and Multi-AZ (for HA and have a standby database)

Secu...]]></description><link>https://blog.tuando.app/saa-c03-certification-database-in-aws</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-database-in-aws</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Sun, 24 Nov 2024 05:18:51 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-rds">RDS</h2>
<ul>
<li><p>Managed PostgreSQL, MySQL, Oracle, SQL Server, DB2, MariaDB, Custom</p>
</li>
<li><p>Provisioned RDS Instance Size and EBS Volume Type &amp; Size</p>
</li>
<li><p>Auto-scaling capability for Storage</p>
</li>
<li><p>Support for Read Replicas and Multi-AZ (for HA and have a standby database)</p>
</li>
<li><p>Security through IAM, Securities Groups, KMS, SSL in transit</p>
</li>
<li><p>Automated Backup with Point in time restore feature (up to 35 days)</p>
</li>
<li><p>Manual DB Snapshot for longer-term recovery</p>
</li>
<li><p>Managed and Scheduled maintenance (with downtime)</p>
</li>
<li><p>Support for IAM Authentication, integration with Secrets Manager</p>
</li>
<li><p>RDS Custom for access to and customize the underlying instance (Oracle &amp; SQL Server)</p>
</li>
</ul>
<blockquote>
<p>Use cases: store relational datasets (RDMBS/OLTP), perform SQL queries, transactions</p>
</blockquote>
<h2 id="heading-aurora">Aurora</h2>
<ul>
<li><p>Compatible API for PostgreSQL / MySQL, separation of storage and compute</p>
</li>
<li><p>Storage: data is stored in 6 replicas, across 3 AZ - HA, self-healing, auto-scaling</p>
</li>
<li><p>Compute: Cluster of DB Instance across multiple AZ, auto-scaling of Read Replicas</p>
</li>
<li><p>Cluster: Custom endpoints for writer and reader DB instances</p>
</li>
<li><p>Same security/monitoring/maintenance features as RDS</p>
</li>
<li><p>Know the backup &amp; restore options for Aurora</p>
</li>
<li><p><strong>Aurora Serverless</strong> - for unpredictable workloads</p>
</li>
<li><p><strong>Aurora Global:</strong> up to 16 DB Read Instances in reach region, &lt; 1 second storage replication</p>
</li>
<li><p><strong>Aurora Machine Learning:</strong> perform ML using SageMaker &amp; Comprehend on Aurora</p>
</li>
<li><p><strong>Aurora Database Cloning:</strong> new cluster from existing one, faster than restoring a snapshot</p>
</li>
</ul>
<blockquote>
<p>Use cases: same as RDS, but with less maintenance, more flexibility, more performance, more features</p>
</blockquote>
<h2 id="heading-elasticache">ElastiCache</h2>
<ul>
<li><p>Managed Redis / Memcached</p>
</li>
<li><p>In-memory data store, sub-millisecond latency</p>
</li>
<li><p>Support for Clustering (Redis) and Multi-AZ, Read Replicas (sharding)</p>
</li>
<li><p>Security through IAM, Security Groups, KMS, Redis Auth</p>
</li>
<li><p>Backup / Snapshot, Point in time restore feature</p>
</li>
<li><p>Manage and Schedule maintenance</p>
</li>
<li><p><strong>Requires some application code changes to be leveraged</strong></p>
</li>
</ul>
<blockquote>
<p>Use cases: Key/Value store, frequent reads, less writes, cache results for DB queries, store session data for websites, cannot use SQL</p>
</blockquote>
<h2 id="heading-dynamodb">DynamoDB</h2>
<ul>
<li><p>AWS proprietary technology, managed serverless NoSQL db, millisecond latency</p>
</li>
<li><p>Capacity modes: provisioned capacity with optional auto-scaling or on-demand capacity</p>
</li>
<li><p>Can replace ElastiCache as a key/value store</p>
</li>
<li><p>HA, multi-AZ by default, Read and Writes are decoupled, transaction capability</p>
</li>
<li><p>DAX cluster for read cache, microsecond read latency</p>
</li>
<li><p>Security, authentication/author is done through IAM</p>
</li>
<li><p>Event Processing: DynamoDB Streams to integrate with Lambda or Kinesis Data Streams</p>
</li>
<li><p>Global Table feature: active-active setup</p>
</li>
<li><p>Automated backups up to 35 days with PITR (point-in-time recovery), or on-demand backups</p>
</li>
<li><p>Export to S3 without using RCU in the PITR window, import from S3 without using WCU</p>
</li>
<li><p>It is great to evolve schemas rapidly</p>
</li>
<li><p>Use case: serverless applications development (small document 100s KM), distributed serverless cache</p>
</li>
</ul>
<h2 id="heading-s3">S3</h2>
<ul>
<li><p>Great for bigger objects, not so great for many small objects</p>
</li>
<li><p>Serverless, scales infinitely, max object size is 5 TB, version capability</p>
</li>
<li><p>Tiers: S3 Standard, S3 IA, S3 Intelligent, S3 Glacier + lifecycle policy</p>
</li>
<li><p>Features: versioning, encryption, replication, MFA-Delete, Access Logs,…</p>
</li>
<li><p>Security: IAM, bucket policies, ACL, Access Points, Object Lambda, CORD, Object/Vault Lock</p>
</li>
<li><p>Encryption: SSE-S3, SSE-KMS,…</p>
</li>
<li><p>Batch operations on objects using S3 Batch, listing files using S3 Inventory</p>
</li>
<li><p>Performance: Multi-part upload, S3 Transfer Acceleration, S3 Select</p>
</li>
<li><p>Automation: S3 Event notifications (SNS, SQS, Lambda, EventBridge)</p>
</li>
</ul>
<blockquote>
<p>Use cases: static files, key valuie store for big files, website hosting</p>
</blockquote>
<h2 id="heading-documentdb">DocumentDB</h2>
<ul>
<li><p>Is the same for MongoDB (like Aurora for MongoDB)</p>
</li>
<li><p>Similar deployment concepts to Aurora</p>
</li>
<li><p>Fully managed, HA with replication across 3 AZ</p>
</li>
<li><p>DocumentDB storage automatically grows in increments of 10 GB</p>
</li>
<li><p>Automatically scales to workloads with millions of requests per second</p>
</li>
</ul>
<h2 id="heading-neptune">Neptune</h2>
<ul>
<li><p>Full-managed graph database</p>
</li>
<li><p>A popular graph database would be a social network</p>
</li>
<li><p>HA across 3 AZ, up to 15 read replicas</p>
</li>
<li><p>Build and run applications working with highly connected datasets - optimized for these complex and hard queries</p>
</li>
<li><p>Can store up to billions of relations and query the graph with milliseconds latency</p>
</li>
<li><p>Great for knowledge graphs, fraud detection, recommendation engines, social networking</p>
</li>
<li><p>Support for Streams (like Dynamo Data Streams)</p>
<ul>
<li><p>Send notifications when certain changes are made</p>
</li>
<li><p>Maintain graph data synchronized in another data store (S3, OpenSearch,…)</p>
</li>
<li><p>Replicate data across regions in Neptune</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-keyspaces-for-apache-cassandra">Keyspaces (for Apache Cassandra)</h2>
<ul>
<li><p>Cassandra is an open-source NoSQL distributed database</p>
</li>
<li><p>A managed Apache Cassandra-compatible database service</p>
</li>
<li><p>Serverless, Scalable, HA, fully managed by AWS</p>
</li>
<li><p>Automatically scale tables up/down based on the application’s traffic</p>
</li>
<li><p>Tables are replicated 3 times across multiple AZ</p>
</li>
<li><p>Using the Cassandra Query Language (CQL)</p>
</li>
<li><p>100s of requests per second</p>
</li>
<li><p>Capacity: on-demand mode or provisioned mode with auto-scaling</p>
</li>
<li><p>Encryption, backup, Point-In-Time recovery up to 35 days</p>
</li>
</ul>
<blockquote>
<p>Use cases: store IOT devices info, time-series data,…</p>
</blockquote>
<h2 id="heading-quantum-ledger-database">Quantum Ledger Database</h2>
<ul>
<li><p>A ledger is a book recording financial transactions</p>
</li>
<li><p>Fully managed, serverless, HA, replication across 3 AZ</p>
</li>
<li><p>Used to review the history of all the changes made to application data over time</p>
</li>
<li><p>Immutable system: no entry can be removed or modified, cryptographically verifiable</p>
</li>
<li><p>2-3x better performance than common ledger blockchain frameworks, manipulate data using SQL</p>
</li>
</ul>
<h2 id="heading-timestream">TimeStream</h2>
<ul>
<li><p>Full-managed, fast, scalable, serverless time series database</p>
</li>
<li><p>Automatically scales up/down to adjust capacity</p>
</li>
<li><p>Store and analyze trillions of events per day</p>
</li>
<li><p>100s time faster &amp; 1/10 the cost of relational databases</p>
</li>
<li><p>Scheduled queries, multi-measure records, SQL compatibility</p>
</li>
</ul>
<blockquote>
<p>Use cases: IoT apps, operatinal applications, real-time analytics,…</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Serverless]]></title><description><![CDATA[Lambda Function
Limits

Execution:

Memory allocation: 120 MB - 10 GB

Maximum execution time: 900 seconds (15 minutes)

Environment variables (4 KB)

Concurrency executions: 1000 (can be increased)

Disk capacity (in /tmp): 512 MB to 10 GB



Deploy...]]></description><link>https://blog.tuando.app/saa-c03-certification-serverless</link><guid isPermaLink="true">https://blog.tuando.app/saa-c03-certification-serverless</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Fri, 22 Nov 2024 17:14:10 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-lambda-function">Lambda Function</h2>
<h3 id="heading-limits">Limits</h3>
<ul>
<li><p>Execution:</p>
<ul>
<li><p>Memory allocation: 120 MB - 10 GB</p>
</li>
<li><p>Maximum execution time: 900 seconds (15 minutes)</p>
</li>
<li><p>Environment variables (4 KB)</p>
</li>
<li><p>Concurrency executions: 1000 (can be increased)</p>
</li>
<li><p>Disk capacity (in /tmp): 512 MB to 10 GB</p>
</li>
</ul>
</li>
<li><p>Deployment:</p>
<ul>
<li><p>Lambda function deployment size (compressed .zip): 50 MB</p>
</li>
<li><p>Size of uncompressed deployment: 250 MB</p>
</li>
<li><p>You can use the /tmp directory to load other files at startup</p>
</li>
<li><p>Size of environment variable: 4 KB</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-lambda-snapstart">Lambda SnapStart</h3>
<ul>
<li><p>Improves Lambda functions performance up to 10x at no extra cost for Java 11 and above</p>
</li>
<li><p>When enabled, the function is invoked from a pre-initialized state</p>
</li>
<li><p>When you publish a new version:</p>
<ul>
<li><p>Lambda initialize function</p>
</li>
<li><p>Takes a snapshot of memory and disk state of the initialize function</p>
</li>
<li><p>Snapshot is cached for low-latency access</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-customization-at-the-edge">Customization at the Edge</h3>
<ul>
<li><p>Edge Function:</p>
<ul>
<li><p>A code that you write and attach to CloudFront</p>
</li>
<li><p>Run close to your users to minimize latency</p>
</li>
</ul>
</li>
<li><p>CloudFront provides two types: <strong>CloudFont Functions &amp; Lambda Edge</strong></p>
</li>
<li><p>Use case: customize the CDN content</p>
</li>
<li><p>Pay only for what you use</p>
</li>
<li><p>Fully serverless</p>
</li>
</ul>
<h4 id="heading-some-use-cases">Some use-cases</h4>
<ul>
<li><p>Website Security and Privacy</p>
</li>
<li><p>Dynamic web application at the Edge</p>
</li>
<li><p>SEO</p>
</li>
<li><p>Intelligently Route Across Origins and Data Centers</p>
</li>
<li><p>Bot mitigation at the Edge</p>
</li>
<li><p>Real-time Image Transformation</p>
</li>
<li><p>A/B Testing</p>
</li>
<li><p>Use Authen/Author</p>
</li>
<li><p>User Tracking and Analytics</p>
</li>
</ul>
<h4 id="heading-cloudfront-functions">CloudFront Functions</h4>
<ul>
<li><p>Lightweight functions written in JavaScript</p>
</li>
<li><p>Sub-ms startup times, millions of requests/second</p>
</li>
<li><p>Used to change <strong>Viewer requests</strong> and <strong>Viewer responses</strong></p>
</li>
<li><p>Native feature of CloudFront (manage code directly in CloudFront)</p>
</li>
<li><p>Use cases: <strong>cache key normalization</strong> (transform request attributes to create an optimal Cache key), <strong>insert/modify/delete HTTP headers</strong>, <strong>URL rewrites</strong> or <strong>redirects</strong>, <strong>generate</strong></p>
</li>
</ul>
<ul>
<li><strong>and validate user-generated tokens</strong> (e.g. JWT) to allow/deny requests</li>
</ul>
<h4 id="heading-lambda-edge">Lambda Edge</h4>
<ul>
<li><p>Lambda functions written in NodeJS or Python</p>
</li>
<li><p>Scales to 1000s of requests/second</p>
</li>
<li><p>Used to change CloudFront requests CloudFront and responses to the origin</p>
</li>
<li><p>Author your functions in one AWS region (us-east-1) then CloudFront replicates to its locations</p>
</li>
<li><p>Use cases: Longer execution time, code depends on a 3rd library, network access to use external services for processing, file system access or access to the body of HTTP requests</p>
</li>
</ul>
<h3 id="heading-lambda-in-vpc">Lambda in VPC</h3>
<p>By default, the Lambda function is launched outside VPC, therefore, it cannot access resources in VPC (RDS, ElastiCache, internal ELB,…)</p>
<h4 id="heading-solutions">Solutions</h4>
<ul>
<li><p>Defint the VPC ID, the Subnets and Security Groups</p>
</li>
<li><p>Lambda will create an ENI (Elastic Network Interface) in a subnet</p>
</li>
</ul>
<h4 id="heading-lambda-with-rds-proxy">Lambda with RDS Proxy</h4>
<ul>
<li><p>To reduce the workload when lots of lambda functions directly access the database =&gt; using <strong>RDS Proxy</strong></p>
</li>
<li><p>RDS Proxy</p>
<ul>
<li><p>Improve scalability by pooling and sharing DB connections</p>
</li>
<li><p>Improve availability by reducing by 66% the failover time and preserving connections</p>
</li>
<li><p>Improve security by enforcing IAM authentication and storing credentials in Secrets Manager</p>
</li>
</ul>
</li>
</ul>
<blockquote>
<p>The Lambda Function must be deployed in VPC, because RDS Proxy is never publicly accessible</p>
</blockquote>
<h2 id="heading-amazon-dynamodb">Amazon DynamoDB</h2>
<ul>
<li><p>NoSQL - with transaction support</p>
</li>
<li><p>Scales to massive workload, distributed database</p>
</li>
<li><p>Millions of requests per second, trillions of rows, 100s of TB of storage</p>
</li>
<li><p>Fast and consistent in performance</p>
</li>
<li><p>Low-cost and auto-scaling capabilities</p>
</li>
<li><p>There is no maintenance or patching. It is always available</p>
</li>
<li><p>Standard &amp; Infrequent Access (IA) Table Class</p>
</li>
</ul>
<h3 id="heading-basics">Basics</h3>
<ul>
<li><p>Each table has a Primary Key that needs to be defined when creating it</p>
</li>
<li><p>Each table can have an infinite number of items</p>
</li>
<li><p>Each item has attributes (can be added over time - can be null)</p>
</li>
<li><p>The maximum size of an item is 400 KB</p>
</li>
<li><p>Data types supported are:</p>
<ul>
<li><p>Scalar Types - String, Number, Binary, Boolean, Null</p>
</li>
<li><p>DocumentTypes - List, Map</p>
</li>
<li><p>SetTypes - String Set, Number Set, Binary Set</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-readwrite-capacity-modes">Read/Write Capacity Modes</h3>
<p><strong>Provisioned Mode (default)</strong></p>
<ul>
<li><p>You specify the number of reads/writes per second</p>
</li>
<li><p>You need to plan capacity beforehand</p>
</li>
<li><p>Pay for provisioned Read Capacity Units (RCU) &amp; Write Capacity Units (WCU)</p>
</li>
<li><p>Possibility to add auto-scaling mode for RCU &amp; WCU</p>
</li>
</ul>
<p><strong>On-Demand Mode</strong></p>
<ul>
<li><p>Read/writes automatically scale up/down with your workload</p>
</li>
<li><p>No capacity planning is needed</p>
</li>
<li><p>Pay for what you use, more expensive</p>
</li>
<li><p>Great for <strong>unpredictable</strong> workloads</p>
</li>
</ul>
<h3 id="heading-dynamodb-accelerator-dax">DynamoDB Accelerator (DAX)</h3>
<ul>
<li><p>Help solve read congestion by caching</p>
</li>
<li><p>Microseconds latency for cached data</p>
</li>
<li><p>Doesn’t require application logic modification (compatible with existing DynamoDB APIs)</p>
</li>
<li><p>5 minutes TTL for cache (default)</p>
</li>
</ul>
<h3 id="heading-stream-processing">Stream Processing</h3>
<ul>
<li><p>Ordered stream of item-level modifications (create/update/delete) in a table</p>
</li>
<li><p>Use cases:</p>
<ul>
<li><p>React to change in real-time</p>
</li>
<li><p>Real-time usage analytics</p>
</li>
<li><p>Insert into derivative tables</p>
</li>
<li><p>Implement cross-region replication</p>
</li>
<li><p>Invoke AWS Lambda on changes to your DynamoDB table</p>
</li>
</ul>
</li>
<li><p>The characteristics of DynamoDB Streams:</p>
<ul>
<li><p>24 hours retention</p>
</li>
<li><p>Limited # of consumers</p>
</li>
<li><p>Process using AWS Lambda Triggers or Dynamoc DB Stream Kinesis adapter</p>
</li>
</ul>
</li>
<li><p>The characteristics of Kinesis Data Streams (newer):</p>
<ul>
<li><p>1-year retention</p>
</li>
<li><p>High # of consumers</p>
</li>
<li><p>Process using AWS Lambda, Kinesis Data Analytics, Kinesis Data Firehose, AWS Glue Streaming ETLs,...</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-global-tables">Global Tables</h3>
<ul>
<li><p>Make a DynamoDB table accessible with low latency in multiple regions</p>
</li>
<li><p>Active-Active replication</p>
</li>
<li><p>Applications can <strong>READ</strong> and <strong>WRITE</strong> to the table in any region</p>
</li>
<li><p>Must enable <strong>DynamoDB Stream</strong> as a pre-requisite</p>
</li>
</ul>
<h3 id="heading-time-to-live">Time To Live</h3>
<ul>
<li>Automatically delete items after an expiry timestamp</li>
</ul>
<h3 id="heading-backups-for-disaster-recovery">Backups for disaster recovery</h3>
<ul>
<li><p>Continuous backups using point-in-time recovery (PITR)</p>
<ul>
<li><p>Optionally enabled for the last 35 days</p>
</li>
<li><p>Point-in-time recovery to any time in the backup window</p>
</li>
<li><p>The recovery process creates a new table</p>
</li>
</ul>
</li>
<li><p>On-demand backups</p>
<ul>
<li><p>Full backups for long-term retention, until explicitly deleted</p>
</li>
<li><p>It does not affect performance or latency</p>
</li>
<li><p>Can be configured and managed in AWS Backup (enables cross-region copy)</p>
</li>
<li><p>The recovery process creates a new table</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-integration-with-s3">Integration with S3</h3>
<ul>
<li><p>Export to S3 (must enable PITR)</p>
<ul>
<li><p>It does not affect the reading capacity of the table</p>
</li>
<li><p>Perform data analysis on top of DynamoDB</p>
</li>
<li><p>Retain snapshots for auditing</p>
</li>
<li><p>ETL on top of S3 data before importing back into DynamoDB</p>
</li>
<li><p>Export in DynamoDB Json or ION format</p>
</li>
</ul>
</li>
<li><p>Import from S3</p>
<ul>
<li><p>Import CSV, DynamoDB Json, or ION format</p>
</li>
<li><p>It does not consume any writing capacity</p>
</li>
<li><p>Creates a new table</p>
</li>
<li><p>Import errors are logged in CloudWatch</p>
</li>
</ul>
</li>
</ul>
<h2 id="heading-api-gateway">API Gateway</h2>
<ul>
<li><p>AWS Lambda + API Gateway: no infra to manage</p>
</li>
<li><p>Support for the Websocket</p>
</li>
<li><p>Handle API versioning</p>
</li>
<li><p>Handle different environments</p>
</li>
<li><p>Handle security (authen/author)</p>
</li>
<li><p>Create API keys, handle request throttling</p>
</li>
<li><p>Swagger/Open API import to quickly define APIs</p>
</li>
<li><p>Transform and validate requests and responses</p>
</li>
<li><p>Cache API responses</p>
</li>
<li><p>Generate SDK and API specifications</p>
</li>
<li><p><strong>Endpoint Types:</strong></p>
<ul>
<li><p><strong>Edge-Optimized (default)</strong>: for global clients</p>
<ul>
<li><p>Requests are routed through the CloudFront Edge locations</p>
</li>
<li><p>The API gateway still lives in only one region</p>
</li>
</ul>
</li>
<li><p><strong>Regional</strong></p>
<ul>
<li><p>For clients in the same region</p>
</li>
<li><p>Could manually combine with CloudFront</p>
</li>
</ul>
</li>
<li><p><strong>Private</strong></p>
<ul>
<li><p>Can only be accessed from VPC using <strong>VPC Endpoint</strong> (ENI)</p>
</li>
<li><p>Use a resource policy to define access</p>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2 id="heading-aws-step-functions">AWS Step Functions</h2>
<ul>
<li><p>Build serverless visual workflow to orchestrate Lambda functions</p>
</li>
<li><p>Features: sequence, parallel, conditions, timeouts, error handling,…</p>
</li>
<li><p>Can integrate with EC2, ECS, On-premises servers, API Gateway, SQS,…</p>
</li>
<li><p>Possibility of implementing a human approval feature</p>
</li>
<li><p>Use cases: order fulfillment, data processing, web app, any workflow,…</p>
</li>
</ul>
<h2 id="heading-amazon-cognito">Amazon Cognito</h2>
<ul>
<li><p>Give users an identity to interact with web or mobile app</p>
</li>
<li><p><strong>Cognito User Pools</strong>:</p>
<ul>
<li><p>Sign-in functionality for app users</p>
</li>
<li><p>Integrate with API gateway &amp; ALB</p>
</li>
</ul>
</li>
<li><p><strong>Cognito Identity Pools</strong> (Federated Identity)</p>
<ul>
<li><p>Provide AWS credentials to users so they can access AWS resources directly</p>
</li>
<li><p>Integrate with Cognito User Pools as an identity provider</p>
</li>
</ul>
</li>
</ul>
<h3 id="heading-cognito-user-pools-cup">Cognito User Pools (CUP)</h3>
<h4 id="heading-user-features">User Features</h4>
<ul>
<li><p>Create a serverless database of users for web &amp; mobile app</p>
</li>
<li><p>Simple login: username/password</p>
</li>
<li><p>Password reset</p>
</li>
<li><p>Email &amp; phone number verification</p>
</li>
<li><p>MFA</p>
</li>
<li><p>Federated Identities: users from Fb, Google, SAML,…</p>
</li>
</ul>
<h4 id="heading-integrations">Integrations</h4>
<ul>
<li>CUP integrates with API Gateway and ALB</li>
</ul>
<h4 id="heading-federated-identities">Federated Identities</h4>
<ul>
<li><p>Get identities for “users” so they obtain temporary AWS credentials</p>
</li>
<li><p>Users can then access AWS services directly or through API Gateway</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Vietnamese Full-Text Search on PostgreSQL]]></title><description><![CDATA[Install extensions
CREATE EXTENSION IF NOT EXISTS unaccent;
CREATE EXTENSION vector SCHEMA "public" VERSION 0.7.2;

Use a custom text search configuration
CREATE TEXT SEARCH CONFIGURATION vietnamese (COPY = simple);
ALTER TEXT SEARCH CONFIGURATION vi...]]></description><link>https://blog.tuando.app/vietnamese-full-text-search-on-postgresql</link><guid isPermaLink="true">https://blog.tuando.app/vietnamese-full-text-search-on-postgresql</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[full text search]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Fri, 22 Nov 2024 02:51:21 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-install-extensions">Install extensions</h3>
<pre><code class="lang-bash">CREATE EXTENSION IF NOT EXISTS unaccent;
CREATE EXTENSION vector SCHEMA <span class="hljs-string">"public"</span> VERSION 0.7.2;
</code></pre>
<h3 id="heading-use-a-custom-text-search-configuration">Use a custom text search configuration</h3>
<pre><code class="lang-bash">CREATE TEXT SEARCH CONFIGURATION vietnamese (COPY = simple);
ALTER TEXT SEARCH CONFIGURATION vietnamese
ALTER MAPPING FOR asciiword, word
WITH unaccent, simple;
</code></pre>
<h3 id="heading-example-query">Example query</h3>
<pre><code class="lang-sql"><span class="hljs-keyword">SELECT</span> staffCode, userName, staffName, phoneNumber, email
<span class="hljs-keyword">FROM</span> public.users_embedding_table
<span class="hljs-keyword">WHERE</span> to_tsvector(<span class="hljs-string">'vietnamese'</span>, 
                  unaccent(<span class="hljs-keyword">COALESCE</span>(staffCode, <span class="hljs-string">''</span>) || <span class="hljs-string">' '</span> || 
                           <span class="hljs-keyword">COALESCE</span>(userName, <span class="hljs-string">''</span>) || <span class="hljs-string">' '</span> || 
                           <span class="hljs-keyword">COALESCE</span>(staffName, <span class="hljs-string">''</span>) || <span class="hljs-string">' '</span> || 
                           <span class="hljs-keyword">COALESCE</span>(phoneNumber, <span class="hljs-string">''</span>) || <span class="hljs-string">' '</span> || 
                           <span class="hljs-keyword">COALESCE</span>(email, <span class="hljs-string">''</span>)
                  )
                 ) @@ plainto_tsquery(<span class="hljs-string">'vietnamese'</span>, unaccent(<span class="hljs-string">'Hòa'</span>));
</code></pre>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: Containers on AWS]]></title><description><![CDATA[Docker Containers Management on AWS

Amazon Elastic Container Service (ECS) - Amazon’s container

Amazon Elastic Kubernetes Service (EKS) - Open-source

AWS Fargate - Amazon’s serverless container

Amazon Elastic Container Registry (ECR) - Store cont...]]></description><link>https://blog.tuando.app/ssa-c03-certification-containers-on-aws</link><guid isPermaLink="true">https://blog.tuando.app/ssa-c03-certification-containers-on-aws</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Thu, 21 Nov 2024 03:46:05 GMT</pubDate><content:encoded><![CDATA[<p>Docker Containers Management on AWS</p>
<ol>
<li><p><strong>Amazon Elastic Container Service</strong> (ECS) - Amazon’s container</p>
</li>
<li><p><strong>Amazon Elastic Kubernetes Service</strong> (EKS) - Open-source</p>
</li>
<li><p><strong>AWS Fargate</strong> - Amazon’s serverless container</p>
</li>
<li><p><strong>Amazon Elastic Container Registry</strong> (ECR) - Store container images</p>
</li>
</ol>
<h1 id="heading-amazon-ecs">Amazon ECS</h1>
<h2 id="heading-ec2-launch-type">EC2 Launch Type</h2>
<ul>
<li><p>Launch Docker containers on AWS = Launch <strong>ECS Tasks</strong> on ECS Cluster</p>
</li>
<li><p>You must provision and maintain the infrastructure (the EC2 instances)</p>
</li>
<li><p>Each EC2 instance must run the <strong>ECS Agent</strong> to register in the ECS Cluster</p>
</li>
<li><p>AWS takes care of stopping/starting container instances</p>
</li>
</ul>
<h2 id="heading-fargate-launch-type">Fargate Launch Type</h2>
<ul>
<li><p>You do not provision the infrastructure (no EC2 instances)</p>
</li>
<li><p>It is all Serverless</p>
</li>
<li><p>AWS runs <strong>ECS Tasks</strong> for you based on the CPU/RAM you need</p>
</li>
<li><p>To scale, increase the number of tasks, no more EC2 instances</p>
</li>
</ul>
<h2 id="heading-iam-roles-for-ecs">IAM Roles for ECS</h2>
<ul>
<li><p>EC2 Instance Profile (EC2 Launch Type only)</p>
<ul>
<li><p>Used by the ECS agent</p>
</li>
<li><p>Makes API calls to ECS service</p>
</li>
<li><p>Send container logs to CloudWatch Logs</p>
</li>
<li><p>Pull Docker image from ECR</p>
</li>
<li><p>Reference sensitive data in Secrets Manager</p>
</li>
</ul>
</li>
<li><p><strong>ECS Task</strong> Role</p>
<ul>
<li>Allow each task to have a specific role</li>
</ul>
</li>
</ul>
<h2 id="heading-load-balancer-integrations">Load Balancer Integrations</h2>
<ul>
<li><p>ALB is supported and works for most use cases</p>
</li>
<li><p>NLB is recommended only for high throughput / high-performance use cases, or to pair it with <strong>AWS Private Link</strong></p>
</li>
</ul>
<h2 id="heading-data-volumes-efs">Data Volumes (EFS)</h2>
<ul>
<li><p>Mount EFS file systems onto ECS tasks</p>
</li>
<li><p>Work for both EC2 and Fargate launch types</p>
</li>
<li><p>Tasks running in any AZ will share the same data in the EFS file system</p>
</li>
<li><p>Fargate + EFS = Serverless</p>
</li>
<li><p>Use cases: persistent multi-AZ shared storage for containers</p>
</li>
</ul>
<h2 id="heading-ecs-service-auto-scaling">ECS Service Auto Scaling</h2>
<ul>
<li><p>Automatically increase/decrease the desired number of ECS tasks</p>
</li>
<li><p>ECS Auto Scaling uses AWS Application Auto Scaling</p>
<ul>
<li><p>ECS Service Average CPU Utilization</p>
</li>
<li><p>ECS Service Average RAM</p>
</li>
<li><p>ALB request Count per Target - metric from ALB</p>
</li>
</ul>
</li>
<li><p>Target Tracking - scale based on target value for a specific CloudWatch metric</p>
</li>
<li><p>Step Scaling - scale based on a specified CloudWatch Alarm</p>
</li>
<li><p>Schedule Scaling</p>
</li>
<li><p>ECS Service Auto Scaling (<strong>task level</strong>) ≠ EC2 Auto Scaling (<strong>instance level</strong>)</p>
</li>
</ul>
<h1 id="heading-amazon-eks">Amazon EKS</h1>
<ul>
<li><p>It’s an alternative to ECS, with a similar goal but a different API</p>
</li>
<li><p>EKS supports <strong>EC2</strong> if you want to deploy worker nodes or <strong>Fargate</strong> to deploy serverless containers</p>
</li>
<li><p>Use case: if your company is already using K8S on-premises or in another cloud, and wants to migrate to AWS using K8S</p>
</li>
</ul>
<h2 id="heading-node-types">Node Types</h2>
<h3 id="heading-managed-node-groups">Managed Node Groups</h3>
<ul>
<li><p>Create and manage Nodes (EC2) for you</p>
</li>
<li><p>Nodes are part of an ASG managed by EKS</p>
</li>
<li><p>Supports On-Demand or Spot Instances</p>
</li>
</ul>
<h3 id="heading-self-managed-nodes">Self-Managed Nodes</h3>
<ul>
<li><p>Nodes are created by you and registered to the EKS cluster and managed by an ASG</p>
</li>
<li><p>You can use pre-built AMI</p>
</li>
<li><p>Support On-Demand or Spot Instances</p>
</li>
</ul>
<h3 id="heading-aws-fargate">AWS Fargate</h3>
<ul>
<li>No need to manage nodes</li>
</ul>
<h2 id="heading-data-volumes">Data Volumes</h2>
<ul>
<li><p>Need to specify <strong>StorageClass</strong> manifest on EKS Cluster</p>
</li>
<li><p>Leverages a <strong>Container Storage Interface</strong> compliant driver</p>
</li>
<li><p>Support for: <strong>EBS</strong>, <strong>EFS (work with Fargate)</strong>, <strong>FSx for Lustre</strong>, <strong>FSx for NetApp ONTAP</strong></p>
</li>
</ul>
<h1 id="heading-aws-app-runner">AWS App Runner</h1>
<ul>
<li><p>No infra experience is required</p>
</li>
<li><p>Start with your source code or container image</p>
</li>
<li><p>Automatically builds and deploys the web app</p>
</li>
<li><p>Automatic scaling, HA, load balancer, encryption</p>
</li>
<li><p>VPC access support</p>
</li>
<li><p>Connect to database, cache, and message queue services</p>
</li>
<li><p>Use cases: web apps, APIs, microservices, rapid production deployments</p>
</li>
</ul>
<h1 id="heading-aws-app2container">AWS App2Container</h1>
<ul>
<li><p>CLI Tool for migrating and modernizing Java and DotNET web apps into Docker Containers</p>
</li>
<li><p>Lift-and-shift apps running in on-premises bare metal, virtual machines, or in any Cloud to AWS</p>
</li>
<li><p>Generates CloudFormation templates</p>
</li>
<li><p>Register generated Docker containers to ECR</p>
</li>
<li><p>Deploy to ECS, EKS, or App Runner</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[The new features in .NET 9 (C# 13)]]></title><description><![CDATA[Index Method
foreach ((int index, Product product) in ProductList.Products.Index())
{
    Console.WriteLine($"Index = {index}, Name = {product.Title}");
}

SearchValues (This feature was introduced in .NET 8)
In .NET 8, the SearchValues type is limit...]]></description><link>https://blog.tuando.app/the-new-features-in-net-9-c-13</link><guid isPermaLink="true">https://blog.tuando.app/the-new-features-in-net-9-c-13</guid><category><![CDATA[.NET]]></category><category><![CDATA[C#]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Thu, 21 Nov 2024 02:05:34 GMT</pubDate><content:encoded><![CDATA[<h3 id="heading-index-method">Index Method</h3>
<pre><code class="lang-csharp"><span class="hljs-keyword">foreach</span> ((<span class="hljs-keyword">int</span> index, Product product) <span class="hljs-keyword">in</span> ProductList.Products.Index())
{
    Console.WriteLine(<span class="hljs-string">$"Index = <span class="hljs-subst">{index}</span>, Name = <span class="hljs-subst">{product.Title}</span>"</span>);
}
</code></pre>
<h3 id="heading-searchvalues-this-feature-was-introduced-in-net-8">SearchValues (This feature was introduced in .NET 8)</h3>
<p>In .NET 8, the SearchValues type is limited to searching by characters. However, in .NET 9, it is possible to search by multiple strings.</p>
<pre><code class="lang-csharp">ReadOnlySpan&lt;<span class="hljs-keyword">string</span>&gt; searchWords = [<span class="hljs-string">"dummy"</span>, <span class="hljs-string">"text"</span>, <span class="hljs-string">"and"</span>];
SearchValues&lt;<span class="hljs-keyword">string</span>&gt; searchValues =
    SearchValues.Create(searchWords, StringComparison.OrdinalIgnoreCase);

<span class="hljs-keyword">var</span> searchString =
    <span class="hljs-string">""</span><span class="hljs-string">"
    Lorem Ipsum is simply dummy text of
    the printing and typesetting industry.
    "</span><span class="hljs-string">""</span>;

<span class="hljs-keyword">var</span> index = searchString
    .AsSpan()
    .IndexOfAny(searchValues);
</code></pre>
<pre><code class="lang-csharp"><span class="hljs-keyword">string</span>[] productTitles = ProductList.Products.Select(x =&gt; x.Title).ToArray();

SearchValues&lt;<span class="hljs-keyword">string</span>&gt; svProducts = SearchValues.Create(productTitles, StringComparison.OrdinalIgnoreCase);

IEnumerable&lt;Product&gt; found = ProductList.Products
    .Where(x =&gt; svProducts.Contains(x.Title));
</code></pre>
<p>The downside is you can not use the type Product, only the string.</p>
]]></content:encoded></item><item><title><![CDATA[SAA - C03 Certification: SQS, SNS, Kinesis]]></title><description><![CDATA[Amazon SQS
Standard Queue
Attributes

Unlimited throughput, unlimited number of messages in queue

Default retention of messages: 4 days, maximum of 14 days

Low latency (< 10 ms on publish and receive)

Limitation of 256 KB per message sent


Can ha...]]></description><link>https://blog.tuando.app/ssa-c03-certification-sqs-sns-kinesis</link><guid isPermaLink="true">https://blog.tuando.app/ssa-c03-certification-sqs-sns-kinesis</guid><category><![CDATA[AWS]]></category><dc:creator><![CDATA[Tuan Do]]></dc:creator><pubDate>Wed, 20 Nov 2024 09:51:51 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-amazon-sqs">Amazon SQS</h2>
<h3 id="heading-standard-queue">Standard Queue</h3>
<h4 id="heading-attributes">Attributes</h4>
<ul>
<li><p><strong>Unlimited throughput</strong>, <strong>unlimited number of messages in queue</strong></p>
</li>
<li><p>Default retention of messages: 4 days, maximum of 14 days</p>
</li>
<li><p>Low latency (<strong>&lt; 10 ms</strong> on publish and receive)</p>
</li>
<li><p>Limitation of 256 KB per message sent</p>
</li>
</ul>
<p>Can <strong>have duplicate messages</strong> (at least once delivery)<br />Can <strong>have out-of-order messages</strong></p>
<h4 id="heading-producing-messages">Producing Messages</h4>
<ul>
<li><p>Produced to SQS using the SDK (<strong>SendMessage</strong> API)</p>
</li>
<li><p>The message persists in SQS until a consumer deletes it</p>
</li>
<li><p>Message retention: default 4 days, up to 14 days</p>
</li>
</ul>
<h4 id="heading-consuming-messages">Consuming Messages</h4>
<ul>
<li><p>Consumers (EC2, Lambda, Servers,…)</p>
</li>
<li><p>Poll SQS for messages (receive up to 10 messages at a time)</p>
</li>
<li><p>Delete the messages using the <strong>DeleteMessage</strong> API</p>
</li>
</ul>
<h4 id="heading-securities">Securities</h4>
<ul>
<li><p><strong>Encryption</strong></p>
<ul>
<li><p>In-flight encryption using HTTPS API</p>
</li>
<li><p>At-rest encryption using KMS keys</p>
</li>
<li><p>Supporting client-side encryption</p>
</li>
</ul>
</li>
<li><p><strong>Access Controls</strong>: IAM Policies</p>
</li>
<li><p><strong>SQS Access Policies</strong> (similar to S3 bucket policies)</p>
<ul>
<li><p>Useful for cross-account access to SQS</p>
</li>
<li><p>Useful for allowing other services (SNS, S3,…) to write to an SQS</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-long-polling">Long Polling</h4>
<p>Where a consumer requests messages from the queue, it can optionally “wait” for messages to arrive if there are none in the queue =&gt; <strong>This is called Long Polling</strong></p>
<p>Long Polling <strong>decreases the number of API calls</strong> made to SQS while increasing the <strong>efficiency and reducing</strong> latency for application</p>
<p>The wait time can be between 1 sec to 20 sec</p>
<p>Long Polling is preferable to Short Polling</p>
<p>It can be enabled at the queue level or the API level (<strong>WaitTimeSeconds</strong> API)</p>
<h3 id="heading-fifo-queue">FIFO Queue</h3>
<ul>
<li><p>Limit throughput: 300 msg/s without batching, 3000 msg/s with batching</p>
</li>
<li><p>Exactly-once-send capability (by removing duplicates)</p>
</li>
<li><p>Messages are processed in order by the consumers</p>
</li>
</ul>
<h2 id="heading-amazon-sns">Amazon SNS</h2>
<ul>
<li><p>Up to 12,500,000 subscriptions per topic</p>
</li>
<li><p>100,000 topics limit</p>
</li>
</ul>
<p>Many services send data directly to SNS for notifications such as:<br />CloudWatch, AWS Budgets, Lambda, Auto Scaling Group, S3, DynamoDB, CloudFormation, AWS DMS, RDS Events,…</p>
<h3 id="heading-sns-sqs-fan-out">SNS + SQS: Fan out</h3>
<ul>
<li><p>Push once in SNS, receive in all SQS queues</p>
</li>
<li><p>Fully decoupled, no data loss</p>
</li>
<li><p>SQS allows for data persistence, delayed processing, and retries of work</p>
</li>
<li><p>Ability to add more SQS subscribers over time</p>
</li>
<li><p>Make sure the SQS queue access policy allows for SNS to write</p>
</li>
<li><p>Cross-Region Delivery: works with SQS in other regions</p>
</li>
</ul>
<h3 id="heading-sns-fifo-topic">SNS - FIFO Topic</h3>
<ul>
<li><p>Similar features as SQS FIFO:</p>
<ul>
<li><p>Ordering by Message Group ID</p>
</li>
<li><p>Deduplication using a Deduplication ID or Content-Based Deduplication</p>
</li>
</ul>
</li>
<li><p>Can have SQS Standard or SQS FIFO as subscribers</p>
</li>
<li><p>Limit throughput: 300 msg/s without batching, 3000 msg/s with batching</p>
</li>
</ul>
<h3 id="heading-sns-message-filtering">SNS - Message Filtering</h3>
<ul>
<li><p>JSON policy used to filter messages sent to SNS topic’s subscriptions</p>
</li>
<li><p>If a subscription does not have a filter policy, it receives every message</p>
</li>
</ul>
<h2 id="heading-kinesis">Kinesis</h2>
<h3 id="heading-overview">Overview</h3>
<ul>
<li><p>Make it easy to collect, process, and analyze streaming data in real-time</p>
</li>
<li><p>Ingest real-time data such as Application Logs, Metrics, Website, clickstreams, IoT telemetry data,…</p>
</li>
<li><p>Kinesis Data Streams: capture, process, and store data streams</p>
</li>
<li><p>Kinesis Data Firehose: load data streams into AWS data stores</p>
</li>
<li><p>Kinesis Data Analytics: analyze data streams with SQL or Apache Flink</p>
</li>
<li><p>Kinesis Video Streams: capture process and store video streams</p>
</li>
</ul>
<h3 id="heading-kinesis-data-streams">Kinesis Data Streams</h3>
<ul>
<li><p>Retention between 1 day to 365 days</p>
</li>
<li><p>Once data is inserted in Kinesis, it can not be deleted</p>
</li>
<li><p>Ability to reprocess data</p>
</li>
<li><p>Data that share the same partition go to the same shard</p>
</li>
</ul>
<h4 id="heading-capacity-modes">Capacity Modes</h4>
<ul>
<li><p><strong>Provisioned</strong> mode:</p>
<ul>
<li><p>You choose the number of shards provisioned, Salce manually or using API</p>
</li>
<li><p>Each shard gets 1MB/s in (or 1000 records per second)</p>
</li>
<li><p>Each shard gets 2MB/s out</p>
</li>
<li><p>You pay per shard provisioned per hour</p>
</li>
</ul>
</li>
<li><p><strong>On-demand</strong> mode:</p>
<ul>
<li><p>No need to provision or manage the capacity</p>
</li>
<li><p>Default capacity provisioned (4MB/s or 4000 records per second)</p>
</li>
<li><p>Scales automatically based on observed throughput peaks during the last 30 days</p>
</li>
<li><p>Pay per stream per hour &amp; data in/out per GB</p>
</li>
</ul>
</li>
</ul>
<h4 id="heading-security">Security</h4>
<ul>
<li><p>Control access/authorization using IAM policies</p>
</li>
<li><p>Encryption in flight using HTTPS</p>
</li>
<li><p>Encryption at rest using KMS</p>
</li>
<li><p>Supporting encrypt/decrypt at the client side</p>
</li>
<li><p>VPC endpoints for Kinesis to access in VPC</p>
</li>
<li><p>Monitor API calls using CloudTrail</p>
</li>
</ul>
<h3 id="heading-kinesis-data-firehose">Kinesis Data Firehose</h3>
<ul>
<li><p>Fully managed service, automatic scaling, serverless</p>
<ul>
<li><p>AWS: Redshift, S3, OpenSearch,…</p>
</li>
<li><p>3rd party: MongoDB, DataDog,…</p>
</li>
<li><p>Custom: send to any HTTP endpoint</p>
</li>
</ul>
</li>
<li><p>Pay for data going through Firehose</p>
</li>
<li><p>Near real-time</p>
<ul>
<li><p>Buffer interval: 0 seconds to 900 seconds</p>
</li>
<li><p>Buffer size: minimum 1MB</p>
</li>
</ul>
</li>
<li><p>Supports many data formats, conversions, transformations, compression</p>
</li>
<li><p>Support custom data transformations using Lambda</p>
</li>
<li><p>Can send failed or all data to a backup S3 bucket</p>
</li>
</ul>
<p>The comparison table between <strong>Data Stream</strong> and <strong>Firehose</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Data Streams</strong></td><td><strong>FireHose</strong></td></tr>
</thead>
<tbody>
<tr>
<td>Real-time (~200ms)</td><td>Near real-time</td></tr>
<tr>
<td>Manage scaling</td><td>Automatic scaling</td></tr>
<tr>
<td>Data storage for 1 to 365 days</td><td>No data storage</td></tr>
<tr>
<td>Supports replay capability</td><td>It does not support replay capability</td></tr>
<tr>
<td>Write custom code (producer/consumer)</td><td>Fully managed</td></tr>
</tbody>
</table>
</div>]]></content:encoded></item></channel></rss>