<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ari Sukarno on Medium]]></title>
        <description><![CDATA[Stories by Ari Sukarno on Medium]]></description>
        <link>https://medium.com/@arisukarno?source=rss-47d8e330ac92------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*v8PaNNvWGlb1VzjiMPsF9g.jpeg</url>
            <title>Stories by Ari Sukarno on Medium</title>
            <link>https://medium.com/@arisukarno?source=rss-47d8e330ac92------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 15:18:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arisukarno/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Perform a Canary Rollout in Openshift Cluster 4 During Upgrade or Maintenance Window]]></title>
            <link>https://arisukarno.medium.com/perform-a-canary-rollout-in-openshift-cluster-4-10-during-upgrade-or-maintenance-window-e7231aa9360f?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7231aa9360f</guid>
            <category><![CDATA[openshift]]></category>
            <category><![CDATA[canary-deployments]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Fri, 05 Jul 2024 07:49:28 GMT</pubDate>
            <atom:updated>2024-07-05T07:53:24.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FsrTeVNKtJYyubKEjXpZPg.png" /></figure><p><strong>How is the canary rollout working in Openshift 4?</strong></p><p>Depending on your organization’s requirements, might be you want to update on the particular node in your Openshift Cluster, monitor the cluster and workload health over a period, and then proceed with updating the remaining nodes. This approach is often known as a canary update.</p><p>Using this approach we have the capability to control on which node we’ll update first before going to another node. For example, if we have a cluster with 100 nodes and have limit maintenance windows time, by leveraging this canary rollout we can achieve our goal.</p><p>Let’s make a simple simulation with 100 node, we can divide 4 Machine Config Pool (MCP), again it’s depend with the requirement.</p><ul><li><em>workerpool-canary-1 → Node 1–25 (Day 1 Maintenance Window)</em></li><li><em>workerpool-canary-2 → Node 26–50 (Day 2 Maintenance Window)</em></li><li><em>workerpool-canary-3 → Node 51–75 (Day 3 Maintenance Window)</em></li><li><em>workerpool-canary-4 → Node 76–100 (Day 4 Maintenance Window)</em></li></ul><p>We can update in particular worker node per each Day by pause and unpause the MCP based on the appropriate time. Now, maybe you have thinking <strong>why we need this canary</strong> rollout by creating MCP!? Good :) Basically, all the worker node will be added in the default MCP called “worker”, so every update in the node will be implement based on the MCP and the node will be take randomly. Let’s say if your application is having High Availability (HA) by separate cluster in the worker node. So, you can’t control the HA during upgrade and it will lead a downtime in your application.</p><p><strong>What is Machine Config Pool (MCP) ?</strong></p><p>OpenShift Container Platform 4 is designed with an operators. On Red Hat CoreOS, the Machine Config Operator (MCO) is responsible for the operating system, overseeing OS updates and configuration changes. The MCO ensures the operating system is managed and keeps the cluster updated and properly configured. With MCO, we can configure and update components such as systemd, cri-o/kubelet, kernel, and NetworkManager on the nodes. To do that, the MCO creates a statically rendered MachineConfig file which includes the MachineConfigs for each node. It then applies that configuration to each node.</p><p>The Machine Config Pool (MCO) is similarly to the Rolebinding object, which links roles to users. The Machine Config Pool connects nodes with Machine Configs, mapping between them. It has two selectors, each of which matches machine configs to nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*HD4c_IuiaarX6NMuaReZow.png" /><figcaption>machine config pool (mcp)</figcaption></figure><p><strong>Hands-on to implement Canary Rollout</strong></p><p>This gonna be simple story but I hope it will help your journey.</p><p>Don’t forget to take your coffee before started :)</p><ol><li>Observe current worker node and cluster version</li></ol><pre>$ oc get node<br>$ oc get clusterversion</pre><p>2. Get current Machine Config Pool (MCP)</p><pre>$ oc get mcp<br>$ oc get node | grep wrk | awk &#39;{print $1}&#39;</pre><p>3. Create custom MCP</p><p>Define the custom mcp based on the role in the below yaml file.</p><p>Here, we defined the using role named <strong>worker-canary, </strong>so we every worker node which has the label <strong>worker-canary </strong>will be added to this custom mcp.</p><pre>$ $ vi worker-canary.yaml <br><br>apiVersion: machineconfiguration.openshift.io/v1<br>kind: MachineConfigPool<br>metadata:<br>  name: worker-canary<br>spec:<br>  machineConfigSelector:<br>    matchExpressions: <br>      - {<br>         key: machineconfiguration.openshift.io/role,<br>         operator: In,<br>         values: [worker,worker-canary]<br>        }<br>  nodeSelector:<br>    matchLabels:<br>      node-role.kubernetes.io/worker-canary: &quot;&quot; <br>  maxUnavailable: 1  <br>  paused: true<br><br><br>$ oc create -f worker-canary.yaml  </pre><p>4. Add the worker node to the custom MCP</p><p>Now, we can add our worker node to the custom MCP by adding the role label to the respective node as our needed.</p><pre>oc label node &lt;node-name&gt; node-role.kubernetes.io/worker-canary=<br>oc label node &lt;node-name&gt; node-role.kubernetes.io/worker-canary=<br>oc label node &lt;node-name&gt; node-role.kubernetes.io/worker-canary=<br>oc label node &lt;node-name&gt; node-role.kubernetes.io/worker-canary=</pre><p>Once we add the node it automatically added to the mcp.</p><pre>oc get node<br>NAME                 STATUS   ROLES                  AGE   VERSION<br>&lt;master-node-name&gt;   Ready    master                 12d   v1.25.16+054f0ba<br>&lt;master-node-name&gt;   Ready    master                 12d   v1.25.16+054f0ba<br>&lt;master-node-name&gt;   Ready    master                 12d   v1.25.16+054f0ba<br>&lt;worker-node-name1&gt;  Ready    worker                 12d   v1.25.16+054f0ba<br>&lt;worker-node-name2&gt;  Ready    worker                 12d   v1.25.16+054f0ba<br>&lt;worker-node-name3&gt;  Ready    worker,worker-canary   12d   v1.25.16+054f0ba<br></pre><p>As you can see, the last worker node already has new role name with worker-canary. Let’s verify the current MCP.</p><pre>$ oc get mcp <br>NAME              CONFIG                                                          UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE<br>master            rendered-master-31c428c571eb3asdfvdf1c1e3746e64a119             True      False      False      3              3                   3                     0                      559d<br>worker            rendered-worker-b074bbadd7da8f8wewqaew4821c3c3a07809            True      False      False      2              2                   2                     0                      480d<br>worker-canary     rendered-worker-canary-b074bbadd7da8f82ad482sdadslk83a07809     True      False      False      1              0                   0                     0                      559d</pre><p>If we see from the MCP, the READYMACHINECOUNT in our new MCP is still zero, because we paused the update in the yaml file. Hence, the node isn’t automatically sync with the new MCP. We can continue unpause our custom MCP but <strong>make sure </strong>there is no update in the cluster so it won’t take any other update in the node except syncing only.</p><pre>$ oc patch --type=merge --patch=&#39;{&quot;spec&quot;:{&quot;paused&quot;:false}}&#39; machineconfigpool/worker-canary<br><br>&lt;wait a few minutes to sync&gt;</pre><p>Once it’s done, better to pause the mcp to avoid any auto update in the node. So we have our capability to handle the worker node update.</p><pre>$ oc patch --type=merge --patch=&#39;{&quot;spec&quot;:{&quot;paused&quot;:true}}&#39; machineconfigpool/worker-canary</pre><p>5. Verify the MCP</p><p>If we see all the node already updated and <strong>make sure</strong> there is no DEGRADE in the node list, so whenever we continue to update in our worker node it won’t be update automatically.</p><pre>$ oc get mcp <br>NAME              CONFIG                                                          UPDATED   UPDATING   DEGRADED   MACHINECOUNT   READYMACHINECOUNT   UPDATEDMACHINECOUNT   DEGRADEDMACHINECOUNT   AGE<br>master            rendered-master-31c428c571eb3asdfvdf1c1e3746e64a119             True      False      False      3              3                   3                     0                      559d<br>worker            rendered-worker-b074bbadd7da8f8wewqaew4821c3c3a07809            True      False      False      2              2                   2                     0                      480d<br>worker-canary     rendered-worker-canary-b074bbadd7da8f82ad482sdadslk83a07809     True      False      False      1              1                   1                     0                      559d</pre><p>You can continue to create another MCP based on your requirement.</p><p>Thank you :)</p><p>References:</p><p><a href="https://docs.openshift.com/container-platform/4.10/updating/update-using-custom-machine-config-pools.html">https://docs.openshift.com/container-platform/4.10/updating/update-using-custom-machine-config-pools.html</a></p><p><a href="https://www.redhat.com/en/blog/openshift-container-platform-4-how-does-machine-config-pool-work">https://www.redhat.com/en/blog/openshift-container-platform-4-how-does-machine-config-pool-work</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7231aa9360f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extend Physical Volume Claim (PVC) Size Without Data Loss in OpenShift 4]]></title>
            <link>https://arisukarno.medium.com/extend-physical-volume-claim-pvc-size-without-data-loss-in-openshift-4-565088216109?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/565088216109</guid>
            <category><![CDATA[kubernetes-volume]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[openshift]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Mon, 20 May 2024 02:26:50 GMT</pubDate>
            <atom:updated>2024-05-20T02:44:55.659Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BMpV6A9CZijJ-fHWp55YLA.png" /></figure><p>In some cases we need to extend our Physical Volume Claim (PVC) due to the insufficient storage pvc in our Openshift/Kubernetes applications. Extending PVC can be challenging because it could result in data loss. Here I’ll share how to extend our PVC, in this case will extend PVC in cluster monitoring Openshift.</p><p>Depending on your application and cluster, this step may likely differ. Please utilize the steps below if you want to extend in the same way as me. I hope this will be interesting for your, so don’t forgot to prepare your coffee :)</p><p><strong>Disable Cluster Monitoring</strong></p><ol><li>Create yaml file to disable cluster monitoring since prometheus is running under this operator.</li></ol><pre>$ cat &lt;&lt;EOF &gt; disable-monitoring.yaml<br>- op: add<br>  path: /spec/overrides<br>  value:<br>  - kind: Deployment<br>    group: apps<br>    name: cluster-monitoring-operator<br>    namespace: openshift-monitoring<br>    unmanaged: true<br>  - kind: Deployment<br>    group: apps<br>    name: prometheus-operator<br>    namespace: openshift-monitoring<br>    unmanaged: true<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*aS4RT472-4iKf44nUpXoug.png" /></figure><p>2. Patch CVO (Cluster Version Operator)</p><pre>$ oc patch clusterversion version --type json -p &quot;$(cat disable-monitoring.yaml)&quot;<br>clusterversion.config.openshift.io/version patched &lt;-- output</pre><p>3. Scale Down Deployments</p><pre>$ oc get deployment -n openshift-monitoring|grep -v NAME| awk {&#39;print $1&#39;}<br>-- output<br>cluster-monitoring-operator<br>grafana<br>kube-state-metrics<br>openshift-state-metrics<br>prometheus-adapter<br>prometheus-operator<br>telemeter-client<br>thanos-querier<br><br>$ deployments=$(oc get deployment -n openshift-monitoring|grep -v NAME| awk {&#39;print $1&#39;}); for i in $deployments;do oc scale deployment/$i --replicas=0 -n openshift-monitoring; done<br>--output<br>deployment.apps/cluster-monitoring-operator scaled<br>deployment.apps/grafana scaled<br>deployment.apps/kube-state-metrics scaled<br>deployment.apps/openshift-state-metrics scaled<br>deployment.apps/prometheus-adapter scaled<br>deployment.apps/prometheus-operator scaled<br>deployment.apps/telemeter-client scaled<br>deployment.apps/thanos-querier scaled</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*mrS2apGq3z9n2ndQyIEDXQ.png" /><figcaption>Before scale down deployment openshift-monitoring</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*cAUVmjelg6x6NqsoJUeDSA.png" /><figcaption>After scale down deployment openshift-monitoring</figcaption></figure><p>4. Scale Down Statefullsets</p><pre>$ oc get statefulsets -n openshift-monitoring|grep -v NAME|awk {&#39;print $1&#39;}<br>--output<br>alertmanager-main<br>prometheus-k8s<br><br>$ statefulsets=$(oc get statefulsets -n openshift-monitoring|grep -v NAME|awk {&#39;print $1&#39;}); for i in $statefulsets; do oc scale statefulset/$i --replicas=0 -n openshift-monitoring; done<br>--output <br>statefulset.apps/alertmanager-main scaled<br>statefulset.apps/prometheus-k8s scaled</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*TIqQEgG60prhg2Bxoyo0mw.png" /><figcaption>After scale down statefullset</figcaption></figure><p>It’s only remaining pod of node-exporter, so all pod under openshift-monitoring <strong>will be down</strong> during the extension.</p><p><strong>Migrate PVC Data Manually</strong></p><ol><li>Switch to the openshift-monitoring project</li></ol><pre>$ oc project openshift-monitoring</pre><p>2. Scale down the prometheus-k8s Statefulset</p><pre>$ oc scale --replicas=0 sts/prometheus-k8s</pre><p>3. Start a new deployment</p><p>We are deploying dump pod using redhat image to mount the old and new pvc.</p><pre>$ oc create deployment sleep --image=registry.access.redhat.com/rhel7/rhel-tools -- tail -f /dev/null<br>deployment.apps/sleep created<br><br>$ oc get pod <br>NAME                     READY   STATUS    RESTARTS<br>sleep-659d44b8c7-m5szk   1/1     Running   0</pre><p>4. Mount old PVC</p><p>The current PVC (size 510Gi)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbFhh-_ze3RzZYF42Ve_ng.png" /><figcaption>PVC before extend</figcaption></figure><p>We’ll extend pvc <em>prometheus-k8s-db-prometheus-k8s-0 </em>from 510Gi to 1Tb.</p><pre>$ oc set volume deployment/sleep --add -t pvc --name=old-claim --claim-name=prometheus-k8s-db-prometheus-k8s-0 --mount-path=/old-claim<br>deployment.apps/sleep volume updated<br><br>$ oc get pod <br>sleep-55cc7d449d-djkbd   0/1     ContainerCreating   0          9s<br>sleep-659d44b8c7-m5szk   1/1     Running             0          8m53s<br><br>The pod will be auto re-deploy to mount the old pvc<br><br>$ oc get pod sleep-55cc7d449d-djkbd -o yaml  | grep volumeMounts -A2<br>    volumeMounts:<br>    - mountPath: /old-claim<br>      name: old-claim<br><br>$ oc get pod sleep-55cc7d449d-djkbd -o yaml  | grep volumes -A2<br>  volumes:<br>  - name: old-claim<br>    persistentVolumeClaim:<br>      claimName: prometheus-k8s-db-prometheus-k8s-0</pre><p>From that command, we’ll attach the old/current pvc with name <em>old-claim </em>from the pvc<em> prometheus-k8s-db-prometheus-k8s-0</em> and mounting using <em>/old-claim</em> in the pod level from deployment sleep.</p><p>Once pod is up, it will shown in the <em>volumes </em>and <em>volumesMount </em>inside of the pod configuration and we can verify by ssh to the pod.</p><pre>$ oc rsh sleep-55cc7d449d-djkbd<br>sh-4.2$ ls -l /old-claim<br>total 20<br>drwxrws---.  2 root       1000420000 16384 Jan 26 14:45 lost+found<br>drwxrwsr-x. 26 1000420000 1000420000  4096 May 13 13:31 prometheus-db<br>sh-4.2$ ls -l /old-claim/prometheus-db/<br>total 116<br>drwxrwsr-x. 3      65534 1000420000  4096 Apr 29 23:00 01HWP1CWAXQ9WVVEB2A7FSHX0T<br>drwxrwsr-x. 3      65534 1000420000  4096 Apr 30 17:00 01HWQZ6N92JTH2C9HBDSM3NFZ4<br>drwxrwsr-x. 3      65534 1000420000  4096 May  1 11:00 01HWSWZZCHN71G9JTA4YSVVSQ7<br>....<br>....</pre><p>5. Create and mount new PV/PVC (make the new size as same with the old/current pvc size or 510Gi which needed to sync before migrating)</p><pre>$ oc set volume deployment/sleep --add -t pvc --name=new-claim --claim-name=new-claim --mount-path=/new-claim --claim-mode=ReadWriteOnce --claim-size=510Gi --claim-class=sc-xx-prometheus-k8s-ds01<br>deployment.apps/sleep volume updated<br><br>$ oc get pvc<br>NAME                                 STATUS    VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS                    AGE<br>new-claim                            Pending                                                                        sc-xx-prometheus-k8s-ds01       15s<br><br>-&gt; wait till the status is Bound, it will take much time depend on the size<br>-&gt; Openshift will request to Vcenter through API to provision new PVC</pre><p>Why we are creating the new PVC with the same size? because it’s a best practice of rsync process to avoid any issues during syncing. Before run the command make sure the backing storage has enough space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*soGuIRB2W9mXw7yI0-lZXA.png" /><figcaption>Free storage in Datastore Vcenter</figcaption></figure><p>The process behind is Openshift will request to vcenter to provision new virtual disk, hence we need to wait till the VPC is available and bound to the pod.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WSgl4XMsAeg4MSVv3vFjJg.png" /><figcaption>Virtual disk creation in Vcenter</figcaption></figure><p>Once the new PVC with the same size already created, it will shown as Bound.</p><pre>NAME                                 STATUS   VOLUME                                     CAPACITY   ACCESS MODES <br>new-claim                            Bound    pvc-e3a2f0c8-4fd7-48b5-82fb-a7f1b2ae3998   510Gi      RWO          <br>prometheus-k8s-db-prometheus-k8s-0   Bound    pvc-5f48ba54-6d7e-4814-abb0-e07f17513f11   510Gi      RWO<br><br>$ oc get pod sleep-6d446bc5cb-t22dz -o yaml | grep volumes -A6<br>  volumes:<br>  - name: old-claim<br>    persistentVolumeClaim:<br>      claimName: prometheus-k8s-db-prometheus-k8s-0<br>  - name: new-claim<br>    persistentVolumeClaim:<br>      claimName: new-claim<br><br>$ oc get pod sleep-6d446bc5cb-t22dz -o yaml | grep volumeMount -A4<br>    volumeMounts:<br>    - mountPath: /old-claim<br>      name: old-claim<br>    - mountPath: /new-claim<br>      name: new-claim</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*kRDQrHtoU69rXY1VpkA0dQ.png" /><figcaption>Pod has two mount PVC with different path</figcaption></figure><p>6. Connect to the pod and migrate the data</p><pre>$ oc rsh sleep-X-XXXXX<br><br>sh-4.2$ ls -l | grep claim<br>drwxrwsr-x.   3 root 1000420000 4096 May 13 15:17 new-claim<br>drwxrwsr-x.   4 root 1000420000 4096 Jan 26 14:46 old-claim<br>sh-4.2$<br><br>sh-4.2$ rsync -avxHAX --progress /old-claim/* /new-claim<br>sending incremental file list<br>rsync: failed to set times on &quot;/new-claim/lost+found&quot;: Operation not permitted (1)<br>lost+found/<br>prometheus-db/<br>prometheus-db/queries.active<br>         20,001 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=161/164)<br>prometheus-db/01HWP1CWAXQ9WVVEB2A7FSHX0T/<br>...<br>...<br>sent 13,341,548,468 bytes  received 2,676 bytes  45,612,140.66 bytes/sec<br>total size is 13,338,281,889  speedup is 1.00<br>rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]<br>sh-4.2$<br><br>It is okey we can ignored due to the lost+found file<br><br>sh-4.2$ du -sh /old-claim/prometheus-db<br>13G     /old-claim/prometheus-db<br>sh-4.2$ du -sh /new-claim/prometheus-db<br>13G     /new-claim/prometheus-db<br>sh-4.2$</pre><p>7. Scale down the sleep deployment</p><pre>$ oc scale --replicas=0 deployment/sleep<br>deployment.apps/sleep scaled<br><br>sleep-6d446bc5cb-t22dz   1/1     Terminating<br><br>wait until pod is gone</pre><p>8. Delete the PVC <em>prometheus-k8s-db-prometheus-k8s-0</em> as the data is now copied to new pvc <em>new-claim</em>.</p><pre>$ oc delete pvc prometheus-k8s-db-prometheus-k8s-0<br><br>$ oc get pvc<br>NAME                                 STATUS   VOLUME                                     CAPACITY   ACCESS MODES   <br>new-claim                            Bound    pvc-e3a2f0c8-4fd7-48b5-82fb-a7f1b2ae3998   510Gi      RWO            <br>prometheus-k8s-db-prometheus-k8s-1   Bound    pvc-04b34ca3-534b-48f3-9795-1c9a8b55a964   476838Mi   RWO</pre><p>9. Mount the new-claim PVC to /old-claim path</p><p>Because the data already move and old pvc was deleted, we can mount the temporary <em>new-claim</em> path to the <em>old-claim</em> path (/old-claim).. Below is the illustration:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*yADes1EZdEVhLiTYKmbWkw.png" /><figcaption>Old pvc already deleted</figcaption></figure><pre>$ oc set volume deployment/sleep --add -t pvc --name=old-claim --claim-name=new-claim --mount-path=/old-claim  --overwrite</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*v2X1icLIDmWI-u4fnNRoGA.png" /><figcaption>new-claim already moved to the old path</figcaption></figure><p>If we see from the deployment configuration, we could see the new pvc new-claim is mounted to the old-claim as well.</p><pre>$ oc get deploy sleep -o yaml | grep volumeMounts -A4<br>        volumeMounts:<br>        - mountPath: /new-claim<br>          name: new-claim<br>        - mountPath: /old-claim<br>          name: old-claim<br>$ oc get deploy sleep -o yaml | grep volumes -A6<br>      volumes:<br>      - name: new-claim<br>        persistentVolumeClaim:<br>          claimName: new-claim<br>      - name: old-claim<br>        persistentVolumeClaim:<br>          claimName: new-claim</pre><p>10. Create PVC <em>prometheus-k8s-db-prometheus-k8s-0 </em>and mount it under <em>/new-claim</em></p><p>Right now the /new-claim is mounted to the temporary new-claim but it’s already mount to the /old-claim as well, hence we can overwrite that new-claim with the pvc which has higher size.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*be4cYE5XlAC2cZGF5959kg.png" /></figure><pre>$ oc set volume deployment/sleep --add -t pvc --name=new-claim --claim-name=prometheus-k8s-db-prometheus-k8s-0 --mount-path=/new-claim --claim-mode=ReadWriteOnce --claim-size=953675Mi --claim-class=sc-xx-prometheus-k8s-ds01 --overwrite</pre><p>Again, it will take much time depend on the size.</p><p>Once the PVC already created, now the mount deployment of the pod will become as the below:</p><pre>.....<br>.....        <br>        volumeMounts:<br>        - mountPath: /old-claim<br>          name: old-claim<br>        - mountPath: /new-claim<br>          name: new-claim<br>.....<br>.....<br>      volumes:<br>      - name: old-claim<br>        persistentVolumeClaim:<br>          claimName: new-claim<br>      - name: new-claim<br>        persistentVolumeClaim:<br>          claimName: prometheus-k8s-db-prometheus-k8s-0<br><br>$ oc get pvc <br>NAME                                 STATUS   VOLUME                                     CAPACITY  <br>new-claim                            Bound    pvc-e3a2f0c8-4fd7-48b5-82fb-a7f1b2ae3998   510Gi     <br>prometheus-k8s-db-prometheus-k8s-0   Bound    pvc-0d314eb5-2fce-4f3c-9866-552b3a737915   953675Mi  <br>prometheus-k8s-db-prometheus-k8s-1   Bound    pvc-04b34ca3-534b-48f3-9795-1c9a8b55a964   476838Mi</pre><p>11. Scale up the deployment sleep</p><pre>$ oc scale --replicas=1 deploy/sleep</pre><p>12. Take rsh into the container and migrate data to the new storage</p><pre>$ oc rsh sleep-X-XXXXX<br>sh-4.2$ ls -l new-claim/<br>total 16<br>drwxrws---. 2 root 1000420000 16384 May 19 14:21 lost+found<br>sh-4.2$ ls -l old-claim/<br>total 20<br>drwxrws---.  2 root       1000420000 16384 May 13 15:17 lost+found<br>drwxrwsr-x. 26 1000420000 1000420000  4096 May 13 13:31 prometheus-db<br>sh-4.2$ ls -l old-claim/prometheus-db/<br>total 116<br>drwxrwsr-x. 3 1000420000 1000420000  4096 Apr 29 23:00 01HWP1CWAXQ9WVVEB2A7FSHX0T<br>drwxrwsr-x. 3 1000420000 1000420000  4096 Apr 30 17:00 01HWQZ6N92JTH2C9HBDSM3NFZ4<br>....<br>...<br>sh-4.2$ rsync -avxHAX --progress /old-claim/* /new-claim<br>....<br>....<br>prometheus-db/wal/checkpoint.00004293/00000000<br>     24,903,680 100%   42.64MB/s    0:00:00 (xfr#115, to-chk=0/164)<br><br>sent 13,341,548,615 bytes  received 2,676 bytes  43,106,789.31 bytes/sec<br>total size is 13,338,281,889  speedup is 1.00<br>rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]<br>sh-4.2$ </pre><p>13. Delete the sleep deployment and PVC of temporaray new-claim</p><pre>$ oc delete deploy/sleep<br>$ oc delete pvc new-claim</pre><p>14. Scale prometheus-k8s pod statefulset back</p><pre>$ oc scale --replicas=2 sts/prometheus-k8s<br><br>wait till pod is ready<br><br>$ oc get pod | grep k8s <br>prometheus-k8s-0      6/6     Running   0          2m40s<br>prometheus-k8s-1      6/6     Running   0          2m40s</pre><p><strong>Enable Back Cluster Monitoring</strong></p><ol><li>Create the enable-monitoring.yaml file</li></ol><pre>$ cat &lt;&lt;EOF &gt; enable-monitoring.yaml<br> <br>- op: remove<br>  path: /spec/overrides<br>  value:<br>  - kind: Deployment<br>    group: apps<br>    name: cluster-monitoring-operator<br>    namespace: openshift-monitoring<br>    unmanaged: true<br>  - kind: Deployment<br>    group: apps<br>    name: prometheus-operator<br>    namespace: openshift-monitoring<br>    unmanaged: true<br>EOF</pre><p>2. Patch CVO</p><pre>$ oc patch clusterversion version --type json -p &quot;$(cat enable-monitoring.yaml)&quot;</pre><p>Wait till all deployment are in READY condition.</p><pre>$ oc get deploy<br>NAME                          READY   UP-TO-DATE   AVAILABLE   AGE<br>cluster-monitoring-operator   1/1     1            1           213d<br>grafana                       1/1     1            1           213d<br>kube-state-metrics            1/1     1            1           213d<br>openshift-state-metrics       1/1     1            1           213d<br>prometheus-adapter            2/2     2            2           213d<br>prometheus-operator           1/1     1            1           213d<br>telemeter-client              1/1     1            1           213d<br>thanos-querier                2/2     2            2           213d</pre><p><strong>Verify Prometheus Data</strong></p><p>Connect to the current pod and see the data (we see all data already back to the current pod)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*yD7YIvBMja8bmnOE2ehmJw.png" /></figure><p>That’s the journey, hopefully this will be helpful. Thanks a million for reading my journey :)</p><p>References:</p><p><a href="https://access.redhat.com/documentation/en-us/openshift_container_platform/4.10/html/storage/expanding-persistent-volumes">https://access.redhat.com/documentation/en-us/openshift_container_platform/4.10/html/storage/expanding-persistent-volumes</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=565088216109" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Replace Unhealthy ETCD Member in OpenShift 4.10]]></title>
            <link>https://arisukarno.medium.com/replace-unhealthy-etcd-member-in-openshift-4-10-8a067c8acaa9?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a067c8acaa9</guid>
            <category><![CDATA[openshift]]></category>
            <category><![CDATA[etcd]]></category>
            <category><![CDATA[etcd-unhealthy]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Thu, 08 Feb 2024 15:31:46 GMT</pubDate>
            <atom:updated>2024-02-10T06:21:01.167Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWWtOn5CrFqOvuuvTapxfg.png" /><figcaption>Openshift Architecture</figcaption></figure><p><strong>etcd</strong> (pronounced et-see-dee) is an open source, distributed, consistent key-value store for shared configuration, service discovery, and scheduler coordination of distributed systems or clusters of machines. etcd helps to facilitate safer automatic updates, coordinates work being scheduled to hosts, and assists in the set up of overlay networking for containers.</p><p>If all member of etcd are lost/unhealthy we won’t be able to make changes to the Kubernetes current state. No new pods will be scheduled, among many other problems. So, it’s important to keep our etcd are in healthy state.</p><p>Then, how to deal with our member etcd if become unhealthy due to some issues? We have to <strong>replace the unhealthy etcd member </strong>to resolve that issue before it bring more complex problem. As per Redhat, below there are some reaoson which make etcd become unhealthy state [1]:</p><ul><li>The machine is not running or the node is not ready</li><li>The etcd pod is crashlooping</li></ul><p>How to solve the issue is depend of the reason and it has different way to solve the issue. In my case, etcd are become unhealthy due to etcd pod is crash because the master are in Ready state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*spPcjKSsKAUXFBbrSgFRLQ.png" /><figcaption>Master Node State</figcaption></figure><p>And the etcd pod isn’t running properly</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*DwG8ivovPXbI4duwSYpxCA.png" /><figcaption>etcd-quorum pod</figcaption></figure><p>If we check the logs, it said that pod is unhealthy and probe was failed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*aatOwIdJlO-Tc5O2LEV6kA.png" /><figcaption>etcd-quorum logs</figcaption></figure><p>Tried to observe list of the etcd members</p><pre># oc rsh -n openshift-etcd problematic-pod<br># etcdctl endpoint health -w table</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*BRAj2kVCPsjdDil4ml8wHQ.png" /><figcaption>etcd-member state</figcaption></figure><p>It shown that one of the etcd member are in false state, hence we need to resolve by replacing the problematic etcd member.</p><p>Pre-requisites:</p><ul><li>Verify the pod is crashing/not running properly</li><li>User has access as Cluster-Admin</li><li>Take etcd-backup</li></ul><p>Let’s do it ! don’t forget to take your coffee :)</p><ol><li>Stop the crashing etcd pod by moving the <strong>/var/lib/etcd/ </strong>file</li></ol><pre># oc debug node/node-master-problematic<br># chroot /host<br># mkdir /var/lib/etcd-backup<br># mv /etc/kubernetes/manifests/etcd-pod.yaml /var/lib/etcd-backup/<br># mv /var/lib/etcd/ /tmp</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*aBG59CsCKoKA1pfTAYvifA.png" /><figcaption>stop the pod by moving the etcd file</figcaption></figure><p>2. Remove the unhealthy member</p><p>Connect to the etcd pod crashing and remove the unhealthy member</p><pre># oc rsh -n openshift-etcd pod-name<br># etcdctl member list -w table<br># etcdctl member remove etcd-member-id</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*f24PpPPBrIscqITdMma24w.png" /><figcaption>remove unhealthy etcd member</figcaption></figure><p>3. Turn of the quorum guard by running below command</p><pre># oc patch etcd/cluster --type=merge -p &#39;{&quot;spec&quot;: {&quot;unsupportedConfigOverrides&quot;: {&quot;useUnsupportedUnsafeNonHANonProductionUnstableEtcd&quot;: true}}}&#39;</pre><p>This command ensure that we can re-create secret and rollout the new pod later</p><p>4. Remove the old secrets for the unhealthy etcd member that was removed</p><pre># oc get secrets -n openshift-etcd | grep master-node</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*rJzWHyR5VZTdzq-olx0yOA.png" /><figcaption>Node Secrets</figcaption></figure><p>Remove all of those secret using below command</p><pre>; delete etcd-peer secret <br># oc delete secret -n openshift-etcd etcd-peer-node-name<br><br>; delete etcd-serving<br># oc delete secret -n openshift-etcd etcd-serving-node-name<br><br>; delete etcd-serving-metric<br># oc delete secret -n openshift-etcd etcd-serving-metrics-node-name</pre><p>5. Force etcd redeployment</p><p>By running below command, the secret and etcd pod will be redeploy</p><pre># oc patch etcd cluster -p=&#39;{&quot;spec&quot;: {&quot;forceRedeploymentReason&quot;: &quot;single-master-recovery-&#39;&quot;$( date --rfc-3339=ns )&quot;&#39;&quot;}}&#39; --type=merge </pre><p>6. Turn back the quorum guard back</p><pre># oc patch etcd/cluster --type=merge -p &#39;{&quot;spec&quot;: {&quot;unsupportedConfigOverrides&quot;: null}}&#39;</pre><p>We can verify if <em>unsupportedConfigOverrides</em> was removed from etcd</p><pre># oc get etcd/cluster -oyaml</pre><p>7. Verify the etcd pod</p><p>Wait for a few minutes because all the etcd will be redeployed.</p><pre># oc get pod -n openshift-etcd</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*L3k3oTq9sO-GUDO9EyoRBA.png" /><figcaption>quorum pod</figcaption></figure><p>Login to the pod and verify that all etcd member are in healthy state</p><pre># etcdctl endpoint health</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*t-HuJJWorL40s-QdCdMUjQ.png" /><figcaption>etcd member already healthy</figcaption></figure><p>We can verify from the cluster operator status as well, it supposed to be not in degrade state. In this case, all the etcd member back to in healthy state and we are in safe condition with our ETCD. Remember, every condition will has different way, make sure you are in the same condition if want to replace using above step :D… Thank you</p><p>Reference:</p><p>[1] <a href="https://docs.openshift.com/container-platform/4.10/backup_and_restore/control_plane_backup_and_restore/replacing-unhealthy-etcd-member.html#restore-replace-crashlooping-etcd-member_replacing-unhealthy-etcd-member">https://docs.openshift.com/container-platform/4.10/backup_and_restore/control_plane_backup_and_restore/replacing-unhealthy-etcd-member.html#restore-replace-crashlooping-etcd-member_replacing-unhealthy-etcd-member</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a067c8acaa9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 3: Schedule Report Logs to Google Cloud Storage Using BigQuery — Audit VM and Cloud…]]></title>
            <link>https://arisukarno.medium.com/part-3-schedule-report-logs-to-google-cloud-storage-using-bigquery-audit-vm-and-cloud-66fce2b95216?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/66fce2b95216</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[monitoring]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Thu, 22 Sep 2022 04:25:09 GMT</pubDate>
            <atom:updated>2022-09-22T04:28:50.651Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 3: Schedule Report Logs to Google Cloud Storage Using BigQuery — Audit VM and Cloud PostgreSQL on Google Cloud Platform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aur5iTu6LDvE5DpyBeuUnw.png" /></figure><p>After we create an alert and notify by email, in some cases we need to store the logs. Actually, we can directly store the logs into Google Cloud Storage (GCS) by sinking from Cloud Logging to GCS. But in this case, the auditor wants to get the <strong>weekly report</strong> so the report that will be stored just happened once a week.</p><p>In this case, there are some ways that we can use. But at this time, we’ll try to <strong>run the weekly report via BigQuery</strong> because it supports running a scheduled query. Let’s try…</p><ol><li><strong>Sink the Logs to BigQuery</strong></li></ol><p>Before we start to make a sink, we need to prepare the query first and make sure the query running properly with the result we want. After that, we can create a sink.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uNm56FZ80FU539uouXFtKA.png" /></figure><p>Then specify the name of the sink and choose the destination as BigQuery datasets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*SIBTXS3S9Cs2e38kWz-Y6w.png" /></figure><p>We can create a new dataset or use the existing datasets or use another dataset in a different project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*39vfD8An-91MBTsEI3-32A.png" /></figure><p>fill in the dataset id and the location where you would like to store the data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*spcpjrmMYumxd3kaZ-hUTQ.png" /></figure><p>After that, we can save and let the other as default and <strong>“create sink”</strong>.</p><p><strong>2. Prepare a Bucket in Google Cloud Storage</strong></p><p>Create a bucket and folder in Google Cloud Storage, how to create a bucket you can see in the official documentation. For now, we already create the bucket:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Q50f9AQYcTYYMgZJy0Cqw.png" /></figure><p>This bucket will be used to store our logs.</p><p><strong>3. Create a Schedule Running Query in BigQuery</strong></p><p>Go to the BigQuery dashboard and we can see that our dataset to store the logs already exists. Then we need to create a temporary dataset to store the logs. I’ll explain to you later why we need this temporary dataset, for now we can create the dataset on our project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxYhBwtmZdsI4ViUlagSJw.png" /></figure><p>As in the previous step, we can specify the name, location then we need to set up the table expiration. Because this dataset was just stored temporarily for 1 week, after that “create dataset”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3KTBGpTIathFSK-MGmrG0A.png" /></figure><p>So, for now we have two dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kR2gK7TYk6bAUC_xb0a31g.png" /></figure><p>Why we need 2 datasets? Because in our scenario, the logs just to report every one week. When we are sinking the logs from Cloud Logging to BigQuery, every time that the query is suitable it will be store directly to BigQuery since it’s a <strong>realtime system</strong>. But we need a temporary dataset to store the logs after one week, after that it will be send to the GCS and the temporary dataset will be deleted after 1 week and continue to other logs in next week. The flow is figured in picture below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fxX5ydLw0y1UYkJMvrdMKg.png" /></figure><p>So we’ll create two schedules:</p><ul><li><strong>Store the sink datasets to temp datasets with temp 7 days</strong></li></ul><p>Try to run the query and see the logs, then create a schedule query:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TaXZ1Qzh4y0377kf5JYQhQ.png" /></figure><p>We can specify our schedule as our need:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*0Szl61suc1zid9fEFzWxOA.png" /></figure><p>Then check the destination tables and choose the dataset name, fill the table id and your write preference. Also you can add notification channel if the job failed in the future. After that Save our schedule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*6G1PiFlvnEdTViXbirH54g.png" /></figure><p>After the schedule was run, we can see in the history:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s0EUXnyG6JAMJ85rsDzrug.png" /></figure><p>Let’s check in the temporary datasets:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UrlwHLC06frR-YtFCn4lbg.png" /></figure><ul><li><strong>Send the temp datasets to GCS</strong></li></ul><p>After that we can make a new schedule to send the logs into GCS [1]:</p><pre>EXPORT DATA OPTIONS(<br>  uri=CONCAT(&#39;gs://your-bucket-path/New_User_Created_&#39;, FORMAT_DATETIME(&quot;%G%m%d&quot;, CURRENT_DATETIME()), &#39;-*.json&#39;),<br>  format=&#39;json&#39;,<br>  overwrite=true) AS<br>SELECT * FROM `your-project.temporary_db_user_created.temporary_db_user_created`<br>WHERE REGEXP_CONTAINS(protopayload_auditlog.requestJson, &quot;CREATE ROLE&quot;) OR REGEXP_CONTAINS(protopayload_auditlog.requestJson, &quot;CREATE ROLE&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VurTxdZ-fNFM9cvvuvfySg.png" /></figure><p>After that specify the name, and schedule time <strong><em>(make sure it running after the temporary schedule was run). </em></strong>Make to other as default and save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyCfaiOEwY9Z3AsOfhqJlw.png" /></figure><p><em>*remember that the CURRENT_DATETIME will follow the time that you running in BigQuery, you can change the query location such below:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nMQsMKBFprSycmhRSpBXrw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9epVO89fjat3Btgx30976A.png" /></figure><p><em>*the query running location must be the same as the dataset location.</em></p><p>Now the schedule was run succesfully:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NxpBaXhZTZwlP27Io3fnzw.png" /></figure><p>And let’s see in the bucket:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nh6Pm93pk8j4ozVr1qF9cw.png" /></figure><p><em>*take note that the report is in JSON format as follows from Cloud Logging if you need the other format for the report you need another solution. Cloud Function or others.</em></p><p>Finally, we’ve done for our audit report, I think there is another way to make this report. If you have another solution, let’s discuss it in the comment!</p><p>Thanks, hope this help for you!</p><p><strong>References:</strong></p><p>[1] <a href="https://cloud.google.com/bigquery/docs/exporting-data">https://cloud.google.com/bigquery/docs/exporting-data</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66fce2b95216" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Configure Logging and Alerting on Google Cloud Logging— Audit VM and Cloud PostgreSQL on…]]></title>
            <link>https://arisukarno.medium.com/part-2-configure-logging-and-alerting-on-google-cloud-logging-audit-vm-and-cloud-postgresql-on-fbe02f0bc3ef?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbe02f0bc3ef</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[alerting]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[cloud-sql]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Wed, 21 Sep 2022 09:26:29 GMT</pubDate>
            <atom:updated>2022-09-21T09:30:24.830Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 2: Configure Logging and Alerting on Google Cloud Logging— Audit VM and Cloud PostgreSQL on Google Cloud Platform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aur5iTu6LDvE5DpyBeuUnw.png" /></figure><p>Let’s continue <strong>Part 2</strong> for our Audit :)</p><p>After we succeed to install and enable the DB extension, we will continue to configure the Ops Agent, view the logs, and configure the alert in Google Cloud Logging.</p><ol><li><strong>Configure Ops Agent for VM Logs</strong></li></ol><p>At the VM level, we can send whatever log inside of VM to Google Cloud Logging. It’s possible to create custom configure on <strong>/etc/google-cloud-ops-agent/config.yaml [1]. </strong>The format configuration consists of three main sections:</p><p><strong>a. receivers:</strong> this element describes the data collected from log files</p><p><strong>b. processor:</strong> this optional element describes how the agent can modify the collected information.</p><p><strong>c. service:</strong> this element links receivers and processors together to create data flows, called <em>pipelines</em>. The service element contains a pipelines element, which can include multiple pipeline definitions.</p><p>As our audit that we would like to implement in Part 1, we are defining the Ops Agent configuration as below:</p><pre>logging:<br>  receivers:<br>    # User list receivers<br>    OS_User_List:<br>      type: files<br>      include_paths: [/etc/passwd]<br>    # OS User logs receivers<br>    OS_User_Activity:<br>      type: files<br>      include_paths: [/var/log/cmdline]<br>  service:<br>    pipelines:<br>      # Auth logs pipelines<br>      user_list_pipeline:<br>        receivers: [OS_User_List]<br>      # OS user logs pipelines<br>      OS_User_Activity_Pipeline:<br>        receivers: [OS_User_Activity]</pre><p>As you can see we’ll read the logs from <strong>cmdline</strong> for tracking the user activity. By using the <strong>cmdline</strong> audit, we can achieve all of our audits using it. Before jumping to the next step please enable the <strong>cmdline </strong>logs by following this article: <a href="https://confluence.atlassian.com/confkb/how-to-enable-command-line-audit-logging-in-linux-956166545.html">https://confluence.atlassian.com/confkb/how-to-enable-command-line-audit-logging-in-linux-956166545.html</a></p><p><em>*make sure the logs were produced in /var/log/cmdline, you can check by running the command </em><strong><em>“cat /var/log/cmdline”</em></strong></p><p>We can customize as we need, and the receivers can read such as files, syslogs, windows_event_logs, etc as GCP mentioned in their official documentation [2]. Edit the configuration:</p><pre>sudo vim /etc/google-cloud-ops-agent/config.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XkY6rpTjAmwKCXp4cibkHw.png" /></figure><p>Save using <strong>ESC + :wq</strong> if you are using vim.</p><p>After we edit the configuration, it’s required to restart the Ops Agent.</p><pre>sudo service google-cloud-ops-agent restart</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tUc634sIie_yIkd1Jikx7w.png" /></figure><p>After we configure the Ops Agent we can see the logs in Cloud Logging for the VM as well as for Cloud Postgresql. Actually, for Cloud SQL <strong>after enabling the extension the logs will be sent to the Cloud Logging</strong>.</p><p><strong>2. View the Logs in Cloud Logging</strong></p><p>Go to the Google Cloud Logging by searching <strong>“Logging”</strong> in the search bar on the GCP console and all of the receiver’s names on the Ops Agent will be reflected on the log name:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZHRIY7TBrbwI9Oo-CZd5hg.png" /></figure><p><strong>a. VM logs</strong></p><p>We can see the log by typing a query directly or by clicking the resource. Below we demonstrate to see the VM logs as this picture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e6Ej4MAuKLZwu6m-2Bylkw.png" /></figure><p>Then select the Log Name:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wk7lyZWVgRB1wHAedcXrvA.png" /></figure><p>We are trying to do some commands in the VM and it should be produced in the Cloud Logging:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PYPM1m7LnK5P9Zzu8I4Sg.png" /></figure><p>So we are successful to send the VM logs into Google Cloud Logging.</p><p><strong>b. Cloud PostgreSQL Logs</strong></p><p>As in the previous step, we can see the Cloud PostgreSQL by defining the resource name and choose the cloud sql name accordingly.</p><p>For this operation, I try to run command <strong>“CREATE USER usertest” </strong>inside of the Cloud PostgreSQL and we’ll se the log in the <strong>protoPayload.request </strong>section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jxez3-aRon0I1-mQOsMKHw.png" /></figure><p>We also success to get the Cloud PostgreSQL logs in the Cloud Logging. Then we can continue to implement the alerting.</p><p><strong>3. Configure Alerting</strong></p><p>As our audit, also we need to alert when the activity has happened and inform by email. Actually, what we have to do is we can <strong>create the query in which the condition is the same as the activity</strong>. For example, USER CREATED, so we need to run the query in which the result is all activity of the USER CREATED. I have created the query as the audit needs:</p><p><strong>a. OS Logs</strong></p><ul><li>New User Created</li></ul><pre>resource.type=&quot;gce_instance&quot; <br>resource.labels.instance_id=&quot;your-instance-id&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>logName=&quot;projects/your-project-id/logs/OS_User_Activity&quot; <br>&quot;useradd&quot; OR &quot;adduser&quot;</pre><ul><li>User Updated</li></ul><pre>resource.type=&quot;gce_instance&quot; <br>resource.labels.instance_id=&quot;your-instance-id&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>logName=&quot;projects/your-project-id/logs/OS_User_Activity&quot; <br>&quot;usermod&quot;</pre><ul><li>User Deleted</li></ul><pre>resource.type=&quot;gce_instance&quot; <br>resource.labels.instance_id=&quot;your-instance-id&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>logName=&quot;projects/your-project-id/logs/OS_User_Activity&quot; <br>&quot;userdel&quot; OR &quot;deluser&quot;</pre><p><strong>b. Cloud PostgreSQL Logs</strong></p><ul><li>New User Created</li></ul><pre>resource.type=&quot;cloudsql_database&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>resource.labels.database_id=&quot;your-project-id:your-cloud-sql-name&quot; <br>protoPayload.request.command=&quot;CREATE ROLE&quot;</pre><ul><li>User Updated</li></ul><pre>resource.type=&quot;cloudsql_database&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>resource.labels.database_id=&quot;your-project-id:your-cloud-sql-name&quot; <br>protoPayload.request.command=&quot;ALTER ROLE&quot;</pre><ul><li>User Deleted</li></ul><pre>resource.type=&quot;cloudsql_database&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>resource.labels.database_id=&quot;your-project-id:your-cloud-sql-name&quot; <br>protoPayload.request.command=&quot;DROP ROLE&quot;</pre><ul><li>Delete Row</li></ul><pre>resource.type=&quot;cloudsql_database&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>resource.labels.database_id=&quot;your-project-id:your-cloud-sql-name&quot; <br>protoPayload.request.command=&quot;DELETE&quot;</pre><ul><li>Insert Tables</li></ul><pre>resource.type=&quot;cloudsql_database&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>resource.labels.database_id=&quot;your-project-id:your-cloud-sql-name&quot; <br>protoPayload.request.command=&quot;INSERT&quot;</pre><ul><li>Drop Tables</li></ul><pre>resource.type=&quot;cloudsql_database&quot; <br>resource.labels.project_id=&quot;your-project-id&quot; <br>resource.labels.database_id=&quot;your-project-id:your-cloud-sql-name&quot; <br>protoPayload.request.command=&quot;DROP TABLE&quot;</pre><p>As you can see, what’s the different for each query is just a little bit on the real activity what happened in the VM or Cloud PostgreSQL. For example in VM logs we just add the string of the activity (eg. adduser) and Cloud PostgreSQL it produced on the protoPayload then we can defined the activity. If we run the query for example CREATE USER so the result of the query is as we need:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LKSwYm6sTSWrtvsJUd0M2A.png" /></figure><p><strong>c. Alerting using Cloud Monitoring</strong></p><p>After we’ve defined the query, we can create the alert from the query by clicking the “create alert” on the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vu2Y6NTiGHF2YP28N_34Zg.png" /></figure><p>Specify the name, query (based on what we create), alert frequency, notification channel (email, you can create to other platforms such as slack, SMS, webhook, etc) then Save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ulI5Cu-MAlMrb8PbbJNBNQ.png" /></figure><p>To see the Alert policy, we can go to the Monitoring -&gt; Alerting -&gt; View Alert:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aurA7l89mHEg_jhprLuqdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5weq1LDkdcmcRSi4WMHKnA.png" /></figure><p>We can create the other Alert policy on the VM or DB level by specifying the query then create alert and so on.</p><p><strong>d. Testing Alert</strong></p><p>We’ll try to create new user in DB level again and see what happened:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*h3TKVkGlpTI7XVDoT5KZTg.png" /><figcaption>Create new user on Cloud PostgreSQL</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jSzbgdRsSi6lHGL7rA-t3A.png" /><figcaption>Alerting in Email</figcaption></figure><p>As you can see, the activity the user created was alerted in the emails and you can read more of the activity by clicking the “View Incident”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZcGDKq0Y0F53IfnGftQ6Wg.png" /></figure><p>With this audit scenario, the auditor or security team can easily identify if a sensitive event happened on their system either VM or Database. Yeah, finally we’ve done creating logs and making the alerting system to email.</p><p>Let’s continue to <strong>Part 3</strong> to make the report… :)</p><p><strong>References:</strong></p><p>[1] <a href="https://cloud.google.com/logging/docs/agent/ops-agent/configuration">https://cloud.google.com/logging/docs/agent/ops-agent/configuration</a></p><p>[2] <a href="https://cloud.google.com/logging/docs/agent/ops-agent/configuration#logging-receivers">https://cloud.google.com/logging/docs/agent/ops-agent/configuration#logging-receivers</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbe02f0bc3ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 1: Install Ops Agent and DB Extention — Audit VM and Cloud PostgreSQL on Google Cloud Platform]]></title>
            <link>https://arisukarno.medium.com/part-1-install-ops-agent-and-db-extention-audit-vm-and-cloud-postgresql-on-google-cloud-platform-3d53c0391723?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d53c0391723</guid>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[audit]]></category>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Tue, 20 Sep 2022 09:31:49 GMT</pubDate>
            <atom:updated>2022-09-20T09:35:52.955Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 1: Install Ops Agent and DB Extention — Audit VM and Cloud PostgreSQL on Google Cloud Platform</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aur5iTu6LDvE5DpyBeuUnw.png" /></figure><p><strong>What is an Audit?</strong></p><p>An audit especially in IT is the examination and evaluation of an organization’s information technology <strong>infrastructure</strong>, applications, data use and management, policies, procedures and operational processes against recognized standards or established policies. Audits evaluate if the controls to protect information technology assets ensure integrity and are aligned with organizational goals and objectives [1].</p><p><strong>Why Audit is important?</strong></p><p>One of the most important IT audits is to ensure that our system is secure and properly tracked. It’s also helping an organization understand the potential risks it faces, IT audit gives an organization a clear strategy on how to action those risks, whether they can be eliminated, mitigated, or tempered by the use of proper controls.</p><p><strong>What is the Audit that will be Implemented?</strong></p><p><strong>a. OS Logs</strong></p><ul><li>New User Created</li><li>User Updated</li><li>User Deleted</li></ul><p>We’ll use a <strong>cmdline </strong>audit logs to achieve all of that (you’ll find it in <strong>Part 2</strong>)</p><p><strong>b. DB Logs</strong></p><ul><li>New User Created</li><li>User Updated</li><li>User Deleted</li><li>Delete Row</li><li>Insert Tables</li><li>Drop Tables</li></ul><p>All of the DB logs can be achieved using <strong>pg_audit</strong> extension that we’ll enable later in the next section.</p><p>We can add more audit items based on our requirements, but for this time we’ll only implement the items listed above.</p><p><strong>How to Implement Audit in GCP?</strong></p><p>In this <strong>Part 1</strong>, we’ll start with installing the Agent namely Ops Agent and an Extention need to install in Postgresql.</p><p>Pre-requisites:</p><p>— Compute Engine / Virtual Machine in GCP</p><p>— Cloud SQL (PostgreSQL)</p><ol><li><strong>Install Ops Agent</strong></li></ol><p>For the details to install the Ops Agent on an individual VM you can read in the official documentation[2].</p><p>Run this command to install Ops Agent:</p><pre>curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh<br>sudo bash add-google-cloud-ops-agent-repo.sh --also-install </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RvocoFSSSkyIRAi7we7Fw.png" /></figure><p>Check the status Ops Agent</p><pre>sudo systemctl status google-cloud-ops-agent&quot;*&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NnY393kV7Y-H4VNcjlm7YA.png" /></figure><p>This Agent consists of 3 services:</p><ul><li>Google Ops Agent</li><li>Google Ops Agent — Metric Agent</li><li>Google Ops Agent — Logging Agent</li></ul><p>After we have installed the Ops Agent, we can see in the Monitoring dashboard for the instance that already install the Agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uGsH0zz5KMfyurqFls7qXA.png" /></figure><p><strong>2. Install or Enable DB Extensions</strong></p><p>The extension in PostgreSQL that can be used is <strong>pg_audit</strong>. The goal of PostgreSQL Audit is to provide the tools needed to produce audit logs required to pass certain government, financial, or ISO certification audits [3]. There are two ways to install or enable the pg_audit extension from the <strong>GCP console or via terminal using Cloud Shell</strong> [4], below are the details:</p><p><strong>a. GCP Console</strong></p><ul><li>Go to your Cloud SQL (Postgres) and edit the configuration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kb2tiNBN8LFEjB-Q6_GfeQ.png" /></figure><ul><li>Enabling the cloudsql.enable_pgaudit flag in Cloud SQL.</li></ul><p>go to the Flags section -&gt; add flag -&gt; fill the flag name “<strong>cloudsql.enable_pgaudit</strong>” and set the value <strong>“on” -&gt; </strong>Done -&gt; Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*YOGO2zpNJ7PqVnGQEsvE3w.png" /></figure><p><em>*required </em><strong><em>downtime/restart </em></strong><em>after adding the flag:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y8YweBk-X2GIqUepO-3eTg.png" /></figure><ul><li>Running a command to create the <strong>pgAudit</strong> extension inside of Postgresql</li></ul><p>Connect with Cloud SQL first by running this command in CloudShel</p><pre>gcloud sql connect instance-name --user=postgres<br>CREATE EXTENSION pgaudit;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKeC2GiPn6dJkcnf8mC95w.png" /></figure><ul><li>Setting values for the pgaudit.log flag.</li></ul><p>go to your cloud sql instance and edit the configuration as the previous step then add the new flag <strong>“pgaudit.log” + </strong>set the value as <strong>“all” </strong>and save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*d9X0ptB0uHWHyVzVZHEqQg.png" /></figure><p><em>*required </em><strong><em>downtime/restart </em></strong><em>after adding the flag</em></p><p><strong>b. Cloud Shell</strong></p><p>Using Cloud Shell it more easy to implement, here you go:</p><ul><li>Enabling the cloudsql.enable_pgaudit flag in Cloud SQL.</li></ul><pre>gcloud sql instances patch [INSTANCE_NAME] --database-flags cloudsql.enable_pgaudit=on</pre><ul><li>Running a command to create the pgAudit extension (login to the postgresql first)</li></ul><pre>CREATE EXTENSION pgaudit;</pre><ul><li>Setting values for the pgaudit.log flag.</li></ul><pre>$ gcloud sql instances patch [INSTANCE_NAME] --database-flags \<br>  cloudsql.enable_pgaudit=on,pgaudit.log=all</pre><p>After we enable the flag, it’s also reflected in the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k8gJzqI7gN8zotcyTbzOpA.png" /></figure><p>Until this step, we have done installing the Ops Agent and pg_audit extension and we’ll continue configuring the logs and alerts. See you in <strong>Part 2</strong>….</p><p><strong>References:</strong></p><p>[1] <a href="https://rmas.fad.harvard.edu/">https://rmas.fad.harvard.edu/</a></p><p>[2] <a href="https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/installation">https://cloud.google.com/stackdriver/docs/solutions/agents/ops-agent/installation</a></p><p>[3] <a href="https://www.pgaudit.org/#:~:text=The%20PostgreSQL%20Audit%20Extension%20(or,financial%2C%20or%20ISO%20certification%20audits.">https://www.pgaudit.org/#:~:text=The%20PostgreSQL%20Audit%20Extension%20(or,financial%2C%20or%20ISO%20certification%20audits.</a></p><p>[4] <a href="https://cloud.google.com/sql/docs/postgres/pg-audit#:~:text=Initial%20flag%20to%20enable%20auditing&amp;text=You%20can%20change%20the%20value,enable_pgaudit%20flag%20restarts%20the%20instance">https://cloud.google.com/sql/docs/postgres/pg-audit#:~:text=Initial%20flag%20to%20enable%20auditing&amp;text=You%20can%20change%20the%20value,enable_pgaudit%20flag%20restarts%20the%20instance</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d53c0391723" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect AWS Network to On-Premise Using Redundant IPSec VPN Tunnel with BGP Routing]]></title>
            <link>https://arisukarno.medium.com/connect-aws-to-on-premise-using-redundant-ipsec-vpn-tunnel-with-bgp-routing-f9ae123eb8a9?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9ae123eb8a9</guid>
            <category><![CDATA[ipsec]]></category>
            <category><![CDATA[aws-vpn]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Fri, 12 Aug 2022 03:24:18 GMT</pubDate>
            <atom:updated>2023-01-01T02:29:09.767Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2R1DGRYiqIOR5-aDMtt_Sg.png" /><figcaption>Design Architecure</figcaption></figure><p><strong>What is IPSec VPN Tunnel on AWS?</strong></p><p>AWS Site-to-Site VPN is a <strong>fully-managed</strong> service that creates a secure connection between your data center or branch office and your AWS resources using IP Security (IPSec) tunnels. By default, instances that you launch into an Amazon VPC can’t communicate with your own (remote) network. You can enable access to your remote network from your VPC by creating an <strong>AWS Site-to-Site VPN </strong>(Site-to-Site VPN) connection, and configuring routing to pass traffic through the connection.</p><p><strong>Why Redundant VPN and use BGP (Border Gateway Protocol)?</strong></p><p>To protect against a loss of connectivity in case your customer gateway device becomes unavailable, you can set up a second Site-to-Site VPN connection to your VPC and virtual private gateway or <strong>transit gateway</strong> by using a second customer gateway device. By using redundant Site-to-Site VPN connections and customer gateway devices, you can perform maintenance on one of your devices while traffic continues to <strong><em>failover</em></strong> the second customer gateway’s Site-to-Site VPN connection. <strong>But why BGP?</strong> by using BGP it’s possible to exchange routing information between your customer gateways via more than 1 Tunnel. <em>Then it’s possible to use static routing? </em><strong>No, it’s not possible </strong>based on<strong> </strong>my research there is not possible to implement failover since when 1 tunnel is down it can’t failover to another tunnel, so you have to use BGP routing for full high available connections.</p><p><strong>How is the Scenario?</strong></p><p>We are trying to connect the<strong> AWS cloud</strong> to <strong>On-Prem</strong> (simulate with <strong>GCP</strong>). As you can see in the architecture system, we’ll build a redundant/high available VPN tunnel with 4 IPSec Tunnel and 2 Customer Gateway. We’ll test for <strong>connectivity </strong>and <strong>failover </strong>between AWS and GCP as a final result.</p><ul><li>AWS</li></ul><p>Here will be used Customer Gateway represents a connection to on-premise, then AWS <strong>site-to-site VPN</strong> as the IPSec tunnel. To create the redundant connection on AWS will be used <strong>Transit Gateway/TGW </strong>(you can use Virtual Private Gateway which is a VPN connector on AWS of the site-to-site VPN connection). Why use TGW is it <strong>more flexible</strong> to create connections with many network connections such as VPC or on-premise networks.</p><ul><li>On-Premise</li></ul><p>GCP support for creating a <strong>High Available VPN Gateway</strong> connection, so it will become the solution to simulate an on-premise network for redundant purposes. HA VPN Gateway will provide 2 interfaces as a gateway for the on-premise networks.</p><p><strong>Pre-requisite:</strong></p><ul><li>VPC in AWS environment (with the subnet, route table, internet gateway, etc) and instance inside of the VPC.</li><li>VPC in Google Cloud Platform and virtual machine.</li></ul><p><strong>Step by Step:</strong></p><p>This will be very nice hands-on for you, so don’t forget to prepare your <strong>coffee :) Here we go!!</strong></p><ol><li><strong>Create VPN Gateway on GCP as a Customer Gateway (On-Premise)</strong></li></ol><ul><li>In GCP we can create 2 Customer GW as On-Prem Gateway to make it High Available</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*Rcqsciig10fcRYoH2WuwVQ.png" /></figure><ul><li>Fill the parameters such as Name, Network and Region</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/0*jkHLyX2IQ5i7dp3b" /></figure><ul><li>After creating the VPN Gateway, GCP will give 2interfacese and will simulate as Customer Gateway On-Premise and will be configured in AWS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*y_kFVYTcK6x_LGk5u5LlQQ.png" /></figure><p>2. <strong>Create Customer Gateway, Site-to-Site VPN and Transit Gateway on AWS</strong></p><ul><li>All the things above can be easily configure directly by create <strong>TGW Attachment</strong>, before that we have to create TGW first</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*9zi3fF95Hjpngv_RXTC_Fg.png" /></figure><p>Make another set as default, but the important this is we have to <strong>enable the ECMP</strong> for supporting the failover VPN. Please take a note that you can specify your TGW ASN by yourself with the range <strong>64512–65534</strong> or <strong>4200000000–4294967294</strong> but by default is <strong>64512 (don’t specify ASN to make it default), </strong>it will be used for Peering BGP session on On-Premise. Here is the TGW that was created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*jjcB6pKwC2KI3Tvr2Wpp_w.png" /></figure><ul><li>Then create TGW Attachment for faster configuration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuXn6qNMOnSAe6rZ9k_e9Q.png" /></figure><ul><li>Configure the VPN Attachment, fill the <strong>IP Address</strong> (interface 0) as an interface that created by GCP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*aV6z2b9tNLZOJNjm8G3iDQ.png" /></figure><p>Please take a note of the <strong>BGP ASN on TGW</strong>, it will be used for configuring <strong>BGP Session</strong> on On-Premise.</p><ul><li>Configure the tunnel option, we can make it handle by AWS or by ourselves. Make it default if we want AWS to handle it. Then <strong>Create</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LBDhGf8cylpOQ0XA" /></figure><ul><li>It will create a Customer Gateway, Site-to-Site VPN and TGW Attachment. <strong>Repeat</strong> again the process for creating TGW Attachment with the IP Address using <strong>Interface 1</strong> that is provided by GCP. Wait a few minutes until all is in an <strong>available </strong>state.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_Ly7hVNuX0DuxAuEl-2s8A.png" /><figcaption>Customer Gateway Status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e8hKx9qxK80ZjAGHfJx2nA.png" /><figcaption>Site-to-Site VPN Status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jLYvQ_FqANkrh5fUv84PSA.png" /><figcaption>Transit Gateway Status</figcaption></figure><p>3. <strong>Add VPN Tunnel on GCP</strong></p><ul><li>The status VPN Tunnel before configure on on-premise (<strong>DOWN)</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KfTgOduRbLd7LiRyKhlxHA.png" /></figure><ul><li>Then <strong>add </strong>VPN Tunnel on GCP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YmM7yJKKmjm8308rD9iRQg.png" /></figure><p>4. <strong>Add Peer GW (fill with IP Outside IPSec Tunnel on VPN AWS)</strong></p><ul><li>Create Peer VPN GW</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*2dRHFN38aG4Ihd9Pbbckow.png" /></figure><ul><li>Then create Peer VPN GW</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*meNEEpSOF60GoeESKA_8sw.png" /></figure><p>Provide the name and interface of the VPN Tunnel that want to create, because we want to create a High Available tunnel with 2 VPN Tunnel with each having 2 Tunnel so we choose <strong>four interfaces</strong> and fill it with the IP Tunnel on AWS Side. Here is the IP Tunnel that should be added in Peer VPN GW, add all IPSec Tunnel on the interface Peer VPN Gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*U5CqgovShPyJde5qBSQc2w.png" /></figure><p>5. <strong>Create router on-prem (cloud Router on GCP)</strong></p><ul><li>Create new router, it’s like router on on-premise</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/0*g3FvJ5MBDgixMn8m" /></figure><ul><li>Specify the configuration and take a note that <strong>Google ASN has to be the same </strong>with <strong>Customer Gateway </strong>(in here is <strong>65000</strong>, you can see in Customer GW detail on AWS)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*1N7IGmkzeJJQw7itLXJ8QQ.png" /></figure><p><strong>NOTE: </strong>it should be same ASN on <strong>Router on-prem </strong>with <strong>ASN at CGW AWS</strong></p><p>6. <strong>Configure VPN Tunnel</strong></p><ul><li>Below the list of VPN Tunnel have to configure especially for BGP session</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/0*7hwjzPIhj7FmU-Rd" /></figure><p>7. <strong>Create BGP Session</strong></p><ul><li>Tunnel Configuration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*Njz7B9iPksttdir0eFG0rQ.png" /></figure><p>Fill the <strong>Peer ASN (it should be the same as ASN on TGW AWS) </strong>It is recommended to make it manually option for creating Cloud Router BGP and BGP Peer also specified the <strong>Multi-Exit Discriminator</strong> (MED<strong>) </strong>for Failover Tunnel (value is <strong>0</strong> to <strong>4,294,967,295</strong>). Here we specify (tunnel 1 : 10, tunnel 2 : 20, tunnel 3 : 30 and tunnel 4 : 40). The path with the <em>lowest MED value is preferred</em>. Fill with the configuration download from AWS <strong>(Inside IP on VPN Tunnel).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*OcHeWzLJ65Ff4z7AicqUVg.png" /></figure><p><strong>Note:</strong></p><p>— CGW as a Cloud Router BGP</p><p>— VPGW as a BGP Peer</p><p><strong><em>Continue with each CGW and VPG on IPSec..</em></strong></p><p>8. <strong>Wait until status Tunnel and BGP is OK</strong></p><ul><li>Check the tunnel and BGP status on GCP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ornIGgnE13Tp1a6HJ6VNSg.png" /><figcaption>BGP Status</figcaption></figure><ul><li>Also check on AWS VPN is UP for two VPN Tunnel <strong>(need around 5–10 minutes to UP)</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w32w24UNsLWyXcrfzapoUQ.png" /></figure><ul><li>Then the TGW automatically propagated the TGW Routable</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*jIv-iOCknk_wjQbGSPuOQg.png" /></figure><p>9. <strong>Test Connectivity via Private IP</strong></p><ul><li><strong>Before that, </strong>we have to create TGW Attachment for VPC Connection using TGW</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*DSiwEYmzGbMtV9c66tX7uA.png" /></figure><ul><li>Check on Propagation and Association it should added for the VPC</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*6onKTKpFNXoRphIdiwaMzg.png" /></figure><ul><li>Route table automatically configure</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H51tsTHgnXDcW9C9FuemxQ.png" /></figure><p>As you can see the subnet for VPC on AW and On-Premise (GCP) is automatically added to TGW route table.</p><ul><li><strong>Then, </strong>for testing connectivity we need to create an instance on AWS and GCP also added the routing table on AWS to subnet in GCP also allow connectivity on GCP via Firewall. Here is the route table on AWS:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*NZjCObKAFaWb7pw2T4N9rw.png" /></figure><ul><li>Also allow in inbound traffic on GCP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*vogAPvyO3EFuiO8nzfnFjg.png" /></figure><ul><li>Test <strong>Ping </strong>from AWS to On-Prem GCP via private IP</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/805/0*WTJVgK_koj3ckks4" /></figure><p>10. <strong>Test Failover VPN Tunnel</strong></p><ul><li><strong>Tunnel 1 </strong>should be <strong>preferred</strong></li></ul><p>Since the lowest MED is tunnel 1 so, it should tunnel 2, 3, 4 not received the test ping from AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pMMj_okUEJco9ZAJ" /><figcaption>Tunnel 1 Traffic</figcaption></figure><p>And the other tunnel should not receive packet</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UZ6IEAnMHFmhpQsp" /><figcaption>Tunnel 2 Traffic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/0*ZQ_Bsnbi8x_dPzb3" /><figcaption>Tunnel 3 Traffic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*_tdH5zI2Y3qoIUaa" /><figcaption>Tunnel 4 Traffic</figcaption></figure><ul><li>Test to <strong>make Tunnel 1 Down</strong></li></ul><p>Make the tunnel 1 is Down with <strong>disabling the BGP Peer</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*afcAgyMg9TwRfIpszryw5w.png" /></figure><p>Current status BGP on-Prem (<strong>waiting for peer</strong>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*fGwx6fV59Ut6UxSvx4eZIA.png" /></figure><p>Tunnel 1 on AWS is <strong>down</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*KJ1BCX3g50mDDlr-G9F6QA.png" /></figure><p><strong>Note: </strong>It should traffic <strong>failover</strong> to Tunnel 2 and <strong>Ping test not stopped, </strong>let’s see <strong>for the failover it should Tunnel 2 now receive the packet</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TgbvrunXA1-XMNqu" /><figcaption>Tunnel 2 Started Failover by Received Packet</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rERnFJmdPdmQsy64" /><figcaption>Tunnel 1 Drop Traffic</figcaption></figure><p>Other Tunnel (3,4) not received the packet cause the <strong>Tunnel 2 have lowest MED.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/0*Q2HzK93OOrd3jtkG" /><figcaption>Tunnel 3 Still not Received Traffic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*otV6u706VjNZQ6In" /><figcaption>Tunnel 4 Still not Received Traffic</figcaption></figure><p>Test <strong>Ping still running </strong>and not stopped</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/0*UArJdUURQAHuOf-J" /></figure><p><strong>Important:</strong> BGP is used to failover between VPN, not the tunnel level, after following the step you must try to make VPN 1 (tunnel 1 and 2) down and it will failover to VPN 2 (tunnel 3 and 4).</p><p>Done, we success for connecting AWS Cloud to On-Premise Using Redundant VPN Tunnel. Hope this helps you! don’t forget to comment if any doubt and follow me for the further article <strong>:”)</strong></p><p><strong>References:</strong></p><p><a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html">https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html</a></p><p><a href="https://docs.aws.amazon.com/vpn/latest/s2svpn/vpn-redundant-connection.html">https://docs.aws.amazon.com/vpn/latest/s2svpn/vpn-redundant-connection.html</a></p><p><a href="https://cloud.google.com/architecture/build-ha-vpn-connections-google-cloud-aws">https://cloud.google.com/architecture/build-ha-vpn-connections-google-cloud-aws</a></p><p><a href="https://aws.amazon.com/premiumsupport/knowledge-center/backup-vpn-connection/">https://aws.amazon.com/premiumsupport/knowledge-center/backup-vpn-connection/</a></p><p><a href="https://aws.amazon.com/premiumsupport/knowledge-center/vpn-configure-tunnel-preference/">https://aws.amazon.com/premiumsupport/knowledge-center/vpn-configure-tunnel-preference/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9ae123eb8a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connect AWS Environment to On Premise Network via Transit Gateway]]></title>
            <link>https://arisukarno.medium.com/connect-aws-environment-to-on-premise-network-via-tranist-gateway-81b4b16a236b?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/81b4b16a236b</guid>
            <category><![CDATA[transit-gateway]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[on-premise]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Mon, 09 May 2022 08:53:29 GMT</pubDate>
            <atom:updated>2022-05-10T07:56:49.896Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*TjbGWDQK3PzecvukuroWgQ.png" /><figcaption>Design Architecture</figcaption></figure><p><strong>How is the Scenario?</strong></p><p>In this lab we will connect <strong>AWS environment </strong>to <strong>On Premise </strong>(here using Google Cloud Platform for simulation).</p><ul><li>AWS Environment</li></ul><p>Will be used <strong>Transit Gateway (TGW)</strong> for connecting to the On-Premise, the advantage using TGW is you can connecting many of VPC to other network such as On-Prem or other VPC.</p><ul><li>On Premise</li></ul><p>In this lab, we will demonstrate the on-premise using Google Cloud Platform environment by using <strong>Cloud VPN Gateway</strong>. In real case it should our on-prem router/firewall etc.</p><p><strong>Pre-requisites:</strong></p><ul><li>VPC in AWS environmet (with the subnet, route table, internet gateway etc) and instance inside of the VPC.</li><li>VPC in Google Cloud Platform and virtual machine.</li></ul><p><strong>Step by Step:</strong></p><p>This will be nice hands-on for you, so don’t forget to prepare your <strong>coffee :)</strong></p><p><em>Note: </em>in this lab many of image that I’m not provide full interface on the console especially on TGW. If you are not familiar I suggest you to try this labs:</p><p><a href="https://medium.com/@arisukarno/create-connection-between-vpc-one-region-using-aws-transit-gateway-bad650dafd3e">https://medium.com/@arisukarno/create-connection-between-vpc-one-region-using-aws-transit-gateway-bad650dafd3e</a></p><p><em>Let Go to the lab…!!</em></p><ol><li><strong>Create Customer Gateway</strong></li></ol><ul><li>We use GCP as a customer gateway, you can jump to the <strong><em>Hybrid Connectivity, </em></strong>create Classic VPN Gateway.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*fVPo2XWMhHuXDTbKQNYi6A.png" /></figure><ul><li>Configure the Customer Gateway, at the IP you can reserve fitrst then choose the result of your reservation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/1*qZqSccdNAfzRyyLCX_G8NA.png" /></figure><p><strong>2. Create <em>TGW Attachment</em> with VPN type on AWS</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*UVsKz7JixEf4-rCfwiPoZg.png" /></figure><ul><li>Configure the attachment, the IP is come from customer gateway in GCP then make other default and <strong>Create.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*E6NMQYex77qkbCyBdL_H5Q.png" /></figure><ul><li>In the meantime for waiting TGW, we can create new instance as on-prem machine in GCP you can create in any region cause in GCP side the VPC is global which is different with AWS.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwu0_3EtsD8NVmHotzyMYA.png" /></figure><p><em>Note: for testing make sure the ICMP is open to the instance</em></p><ul><li>Check the VPN on AWS side, note the Outside IP and used it for make tunneling on the on-premise or you can download the configuration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rDdOktGtxh3bEhq-ESttBg.png" /></figure><p><em>Note:</em><strong> <em>Down status </em></strong>indicate that the tunnel is not configure on the on-premise side, so don’t worry we will solve in the next step.</p><ul><li>From the download, search the 2 <strong><em>secret </em>and paste on the GCP tunnel.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HlPIQz6V-fxQzJ2lRVpUjA.png" /><figcaption>Secret Tunnel 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeopoJzErgTS_l9HlVZ5EA.png" /><figcaption>Secret Tunnel 2</figcaption></figure><p><strong>3. <em>Back</em> to the GCP Console for Configure the Customer GW</strong></p><ul><li>Copy the Key / Secret (make sure it copy <strong>accordingly</strong> based on the IP) and create <strong>routing option</strong> (here we specify the IP that we want to connect to VPC of instance).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*YW6kAHXzdHuEq0V100gk2Q.png" /><figcaption>Tunnel 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*4_YQcm03YyDu0AlsENcIbg.png" /><figcaption>Tunnel 2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*eiXWmCRD9o9yCz9LwuXeyw.png" /><figcaption>Tunnel 2 (Next)</figcaption></figure><ul><li>Re-check again and <strong>Create, </strong>after finish check the status of Tunnel</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zu-DZ_8hfQHqF1m8zPBIMA.png" /><figcaption>Customer GW</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*xb6DKE0zpMJrsbeN9f6P7w.png" /><figcaption>Tunnel 1 Status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*X1AfM05OvQGDsgbrJidkWQ.png" /><figcaption>Tunnel 2 Status</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*X1AfM05OvQGDsgbrJidkWQ.png" /><figcaption>Tunnel 1 Status</figcaption></figure><p><strong>4. <em>Back </em>to the AWS console to check the tunnel and update the Route Table</strong></p><ul><li>Check the tunnel status on AWS it should be running now</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CqE4eLMS5KCg6O9PDyHGBA.png" /></figure><p><em>Note:</em> until this step, the AWS and On-Prem(GCP) is already configure, now just to configure the <strong>Route Table.</strong></p><ul><li>Check the instance on the on-premise</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CSNs8mYhNNOLO-tO3ksXaA.png" /></figure><p>The instance is on the Singapore, so in GCP the VPC is global and subnet is regional so we need to configure it. First find the subnet on Singapore of GCP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KoAw74sbAM1X_yaDGgYNww.png" /></figure><ul><li>Edit the route table on the VPC AWS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LEXPXW-g0qPn9CZxr5ADSQ.png" /></figure><ul><li>If you test ping to the instance on-premise, it should not work. <strong>Why?</strong> because the traffic is sent via the TGW also, so we have to create route table on the TGW itself although if you check on the <strong>route </strong>of on-prem it already routed to the Instance AWS but again it sent via TGW.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*olVhiilf74aOTsfH_9banw.png" /></figure><ul><li>Create new Route Table TGW and attach the association (basicly just think what the TGW that will be used, in this case in <strong>On-Prem</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*r-suR9ttaqK5fcOJU-0KbA.png" /></figure><ul><li>For propagation, in this case we just want to propagated the On-Prem to VPC B so we have to propagated with the TGW B.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*Rj3LoVCETtPz7WgoB7FaHg.png" /></figure><ul><li>Then check the route table of TGW, it should be route to the VPC B.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RBdzSP7PP6tgv4H0vV4jww.png" /></figure><ul><li>We also have to update the Route Table TGW B to know the traffic from/to On-Prem</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9YgZUjT6uQsFoMHBdLRlw.png" /><figcaption>Create Static Route</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*4ZZEImz6dSDnyNsVaYE-cA.png" /><figcaption>Static Route (TGW and subnet come from on-prem)</figcaption></figure><p><strong>5. Test Connectivity</strong></p><ul><li>Test ping from AWS to On-Prem</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*T_ch2XbzJzouiaFXw1FfbA.png" /></figure><ul><li>Test ping from On-Prem to AWS (make sure to open the ICMP come from the subnet on on-prem)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aC-7Ut_QjrCqgODu-AkSUQ.png" /><figcaption>Update the security group</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*zzd10StWBofK3x2gSE_xAQ.png" /><figcaption>Ping from onprem to AWS</figcaption></figure><p><strong>Nice!</strong> now you can connect your AWS environment to On-Premise.</p><p><strong>Source:</strong></p><p><a href="https://docs.aws.amazon.com/vpc/latest/tgw/tgw-transit-gateways.html">https://docs.aws.amazon.com/vpc/latest/tgw/tgw-transit-gateways.html</a></p><p><a href="https://cloud.google.com/network-connectivity/docs/concepts">https://cloud.google.com/network-connectivity/docs/concepts</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81b4b16a236b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Power of Multi-AZ Amazon Aurora]]></title>
            <link>https://arisukarno.medium.com/the-power-of-multi-az-amazon-aurora-ebf12faeae06?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebf12faeae06</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[rds]]></category>
            <category><![CDATA[aurora]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Sun, 08 May 2022 04:37:19 GMT</pubDate>
            <atom:updated>2022-05-08T04:37:28.938Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*5_NLjkerGs8itY20.png" /><figcaption>Aurora DB Cluster (source: AWS)</figcaption></figure><p><strong>What is Amazon Aurora?</strong></p><p>Amazon Aurora (Aurora) is a fully managed relational database engine that’s compatible with MySQL and PostgreSQL. You already know how MySQL and PostgreSQL combine the speed and reliability of high-end commercial databases with the simplicity and cost-effectiveness of open-source databases.</p><p><strong>How about Multi-AZ Aurora?</strong></p><p>Multi-AZ deployments can have one standby or two standby DB instances. When the deployment has one standby DB instance, it’s called a <em>Multi-AZ DB instance deployment</em>. A Multi-AZ DB instance deployment has one standby DB instance that provides failover support, but doesn’t serve read traffic. When the deployment has two standby DB instances, it’s called a <em>Multi-AZ DB cluster deployment</em>. A Multi-AZ DB cluster deployment has standby DB instances that provide failover support and can also serve read traffic.</p><p><strong>Setting up Amazon Aurora</strong></p><ol><li><strong>Creating Amazon Aurora Cluster</strong></li></ol><p><strong><em>Note</em></strong><em>: in this step I’ll just show you the important things that I setup for this lab, for the details step creating you can read the documentation or other source.</em></p><ul><li>Choose the Amazon Aurora option and you can specify the compatible edition that Aurora support which is MySQL or PostgreSQL</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZ1S3cLxdiwY9CCmIJe2AA.png" /><figcaption>Engine Option</figcaption></figure><ul><li>If you need for setup the engine to span the database in multi-region you can specify by using the filter.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xWj18J3oVZMyEe18p84fvg.png" /></figure><ul><li><em>Important things, </em>you have to enable the Multi-AZ deployment. This is best practice for making <strong>High Availability (HA)</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8ZaGfQnIG9fKx7buZTWoA.png" /></figure><ul><li>Setup the network connectivity, the best practice is don’t make the connectivity is <em>not public </em>and just open the connectivity with specific source, you can leverage using the <strong><em>security group</em></strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3FJbQJcspoozOS16onAmYg.png" /></figure><ul><li>Specify the connectivity via the security group.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0wQq_rAbpa4RkI_lcueSWQ.png" /></figure><ul><li>Then <strong>create database</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LMWCkTfbD9L6lWSZ4UNctw.png" /></figure><p><em>As you can see that the database already create with </em><strong><em>Multi-AZ</em></strong><em> (ap-shouteast-1b and ap-shouteast-1a)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PWCrtpZdMBiJgcx-DKnJ_A.png" /><figcaption>Endpoints of Aurora</figcaption></figure><p>Basicly in Auora have two endpoint: <em>first </em>is Writer Enpoints that used by user to connect with the <strong>master </strong>and <em>second </em>is Reader Endpoints that used to connect with <strong>standby</strong>. How it work for connect to many of Reader? cause in the Auora the replication can be setup up to 15 reader. Yup, the Reader Endpoints will take action like <strong>Load Balancing </strong>to the reader instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*kIwXlh4_8Leso5YwpbF7tQ.png" /></figure><p><strong>2. Testing the Failover</strong></p><ul><li>We can manually enforce the failover process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TAGuqCy0MjKuPxkLppLgeQ.png" /></figure><ul><li>Wait a few second and see the change of the role writer is moved</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBJ6UUscWlD8qqjLeNhhXA.png" /></figure><p><strong>So what it’s that mean? </strong>it mean that if your application have a problem regarding to the master/writer instance it automatically move to the standby and it happened just a few second. You can see the details process on event:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gKtbRvcjRLw8WPyV6wtHqA.png" /></figure><p><em>— as you can see that it just need &lt; 30 second to failover</em></p><p><strong>3. Add New Instance Reader</strong></p><ul><li>Very easy to add new instance reader, just<strong> Add Reader</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WbmgmFaMVnmt7gjXm0uWQg.png" /></figure><ul><li>Specify the source replica and the database identfier and <strong>Create</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hLTXs-tnq8w3N6uMLlJZjw.png" /></figure><ul><li>Wait until the new reader already created, so by default Auora will create new instance on <strong>3 AZ.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Us9PKMLl6V3rfS4PUHaKbA.png" /></figure><ul><li>If you want to delete the instance, just choose the instance that you want and delete</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aoNIB-7bhFW2hWHOIFxnmw.png" /></figure><p><strong>Note:</strong></p><ul><li><em>You can’t delete the cluster if have existing replication, so you have to delete one by one.</em></li><li>If you want to add instance in the new region, first you have to make the engine is support for the <strong>Span Region </strong>when you create the Aurora, see in previous step.</li></ul><p><em>source: </em><a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.MultiAZ.html">https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.MultiAZ.html</a></p><p><a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html">https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.CreateInstance.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebf12faeae06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Multi-tier Architecture on AWS from Scratch (Wordpress Apps)]]></title>
            <link>https://arisukarno.medium.com/build-multi-tier-architecture-on-aws-from-scratch-wordpress-apps-93d2087244c?source=rss-47d8e330ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/93d2087244c</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-architect]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[Ari Sukarno]]></dc:creator>
            <pubDate>Tue, 22 Feb 2022 03:28:39 GMT</pubDate>
            <atom:updated>2022-03-08T02:03:34.669Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is Multi-tier Apps?</strong></p><p><strong>A multi-tier application</strong> is any application developed and distributed among more than one layer. It logically separates the different application-specific, operational layers. The <strong><em>number of layers varies</em></strong> by business and application requirements, but three-tier is the most commonly used architecture. A multi-tier application is used to divide an enterprise application into two or more components that may be separately developed and executed. In general, the tiers in a multi-tier application include the following:</p><p>a. Presentation Tier: User interface and application access services.</p><p>b. Application Processing Tier: Core business or application logic.</p><p>c. Data Tier: Holds and manages data that is at rest, this allows each component/tier to be separately developed, tested, executed and reused.</p><p><strong>Architecture System</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6PCFcAglrSSL4m8p5H2oFw.png" /></figure><p>It will be a long step for you, but so interesting.. i suggest you to prepare your coffee and enjoy this Lab :)</p><p><strong>Step by step:</strong></p><ol><li>Create VPC with the subnet, internet gateway etc</li></ol><ul><li>Create VPC with the IP 10.10.0.0/16</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_clp6fzpwztQ_qUES-CjFQ.png" /></figure><ul><li>Internet gateway (one VPC just can attach one IGW)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pE2RLG1IbNi8ywV9g8Y4lA.png" /></figure><ul><li>Create NAT Gateway</li></ul><p>NAT is used for connecting the private subnet to the internet and it will be attach to the <strong>Public Subnet</strong>. Usually NAT attach with a elastic IP also.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AeAaz41pNzUxYsyIgSeN_g.png" /></figure><ul><li>Route Table, private via NAT and public via Internet Gateway.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xhRps2G9HoZux_w_03rG6Q.png" /></figure><ul><li>Four Subnet Public and Private with the route table: private via NAT and public via Internet Gateway.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMlj85HOJW2Oeh-KUCn3mw.png" /></figure><p>2. Create Instance with User Data (install httpd, wget and php)</p><ul><li>VPC Configuration</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qol-gmmOif8tpucmv7HVzQ.png" /></figure><ul><li>User data</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/1*wlBweEzGcMARIHzijDOvXg.png" /></figure><p>3. Create IAM Role for access instance to the RDS and S3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYAgK7HpXp80cap2czheJw.png" /></figure><p>4. Attach IAM Role to the EC2 instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0TwFqhLbhvx5rUGgk_3kSg.png" /></figure><p>5. Create SNS Topic and Subscription</p><ul><li>SNS Topic</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/1*Yhkr_CGx7zmTw0p7Y5gjZg.png" /></figure><ul><li>Subscription</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BAf5OjPrzfncSEVsmBr6xQ.png" /></figure><p>6. Create RDS Instance</p><ul><li>Choose the DB engine as Mysql with version 5.x.x (cause above of that the RDS cannot be access via EC2 Instance)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*2t2PeOV2qCTf7atV-wL6YQ.png" /></figure><ul><li>Setup the username and password</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*13N9_8S0LSknCnLlLigHrg.png" /></figure><ul><li>Choose the VPC and security group (you have to create first, for open the port 3306 and allow the source just from secgroup EC2 instance)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*PmaXLkHptCJAwTjXf2UqVw.png" /></figure><p>7. Install Wordpress</p><ul><li>Connect to the EC2 instance and run this command</li></ul><pre>sudo cd /var/www/html</pre><pre>sudo wget <a href="https://wordpress.org/latest.tar.gz">https://wordpress.org/latest.tar.gz</a></pre><pre>sudo tar -xzvf latest.tar.gx</pre><ul><li>-x : indicate to extract</li><li>-z : for extracting (gzi, ungzip, gunzip)</li><li>-v : will show the result of extract</li><li>-f : use archive file</li></ul><pre>cd wordpress</pre><pre>sudo mv * /var/www/html</pre><pre>sudo nano /etc/httpd/conf/httpd.conf</pre><p><em>change the </em><strong><em>AllowOverride None </em></strong><em>to </em><strong><em>All</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*atNxGlkSGKf1-l8UfSYdpA.png" /></figure><pre>sudo chown -R apache:apache /var/www</pre><pre>sudo restart httpd</pre><p>Try to acces your public ip address of the EC2 instance, it should open the wordpress configuration.</p><p><strong>TIPS: </strong>if you have problem with <strong><em>PHP version</em></strong>? run this command below:</p><pre>sudo amazon-linux-extras | grep php</pre><pre>sudo amazon-linux-extras enable php7.4</pre><pre>sudo yum clean metadata</pre><pre>sudo yum install php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}</pre><p>8. Setup the database on RDS</p><ul><li>Connect to the RDS and Create empety new database</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*dpIgP1ubTFAcrgRt-iW1pQ.png" /></figure><ul><li>Open the IP Public of the Instance and it will be configure the wordpress instalation</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*0dPXi_TOwof6_-2o3SGMeg.png" /></figure><ul><li>Fill the database name, username, password as you create in RDS. Then for database host you can fill the RDS Endpoint. After that click <strong>submit </strong>and then <strong>Run Instalations</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*kp9c64xrEhcrPNzV4lhRTQ.png" /></figure><ul><li>Finish instalation</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*ReiCp8pHmUv-NLkVFcsJMA.png" /></figure><ul><li>Login to Wordpress</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*VqrAbh6RpOtL0cA5h3rN9A.png" /></figure><ul><li>Wordpress is ready!</li></ul><p>9. Configure the Route53</p><ul><li>Setup Nameserver, copy the value of NS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RtLZGDxchpdeDK1BTIdBEg.png" /></figure><ul><li>Paste the NS to the NS on DNS Management(in here I use <em>domainesia</em>) see the notice that you have to wait for long time for DNS propagation(<strong>be patient</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*T5TiGeiQyPSrV9zwHwCDYw.png" /></figure><ul><li>This is the full configuration of Route53 until this step</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1m9JcoBn6dVGJ2B6IthLZg.png" /></figure><ul><li>Check the DNS record from command line on EC2</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*o7u_p5MXhiSn9H9DW4RSOQ.png" /></figure><ul><li>Wordpress is already access with Route53!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jXlsTk10sYTsfThVmNZhOQ.png" /></figure><p>Until this step the apps already receieve the traffic from user, but in our architecture we will create <strong>Auto Scaling Group (ASG) </strong>so it automatically scaling-out and scaling-in based on the traffic. For creating the ASG follow the next step.</p><p>10. Create AMI from the instance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1VRP1IA1uDg0TTm7xgHJng.png" /></figure><p>11. Create the certificate SSL using AWS Certificate Manager, so the wordpress will be access securely.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1vwdMUoyR6dlAQDavFgPg.png" /></figure><p>12. Setup the Elastic Load Balancer (ELB), in here using Classic Load Balancer (it can be direct to the EC2 classic and TLS Certificate)</p><ul><li>Setup the VPC</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Rl8fvle8azZ7omOw.png" /></figure><ul><li>Add the public subnet</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Xd4pNqCzrQfP-ax1.png" /></figure><ul><li>Configure the Security Group (open port 80)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*spD2q5pw9LneHtbw.png" /></figure><ul><li>Configure the Health Check (open the TCP port 80)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/0*mgj3ZLyb23EyOGVO.png" /></figure><ul><li>Add the instances would like be running on ELB and <strong>Create.</strong></li></ul><p>13. Create the launch configuration</p><ul><li>Configure the AMI, IAM Role and Secgroup</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8KAVRNl_JD4-xJPWiCvs0Q.png" /><figcaption>setup AMI and Instance Type</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U0-GQ3HV8dsfGfZbQB9wxA.png" /><figcaption>IAM Role</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IEAZthmRs2fw3Ih3jKuvNw.png" /><figcaption>Security Group<strong> <em>(choose from the secgroup of the instance)</em></strong></figcaption></figure><p>14. Create ELB from the Launch Configuration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hsBhrIxmMw_MEm_Lq8ZW4A.png" /></figure><ul><li>Setup the ELB</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*S4IsVB6K_DYCAx2DSbuIJA.png" /><figcaption>instance launch template</figcaption></figure><ul><li>Attach the ELB</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*ueJi8UuouJioLsQ-a8rbnQ.png" /></figure><ul><li>Configure the group size and scaling policies</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*beWqmDA1bx6Mec7cLv_8mA.png" /><figcaption>group size instance</figcaption></figure><ul><li>You can add the policie of the instance scaling</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*Pw3-IMp7lsBGrmxDzAJ4IA.png" /><figcaption>scaling policies</figcaption></figure><ul><li>Create Notification and <strong>Create</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*de-1kH5SCH-y2SbNTPM4kA.png" /></figure><ul><li>You can see the resul of the Auto Scaling Group (<strong>2 Instance</strong>)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EXSkvjEYGy3q9e5uq4n9eg.png" /><figcaption>Status ASG</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTFD5EIOZ9D2DOvftle7Jg.png" /><figcaption>ELB Instances</figcaption></figure><p><strong>NOTE:</strong> As you can see that the List Instance in ELB is InService, if thereis an <strong>OutOfService </strong>you can troubleshoot with 3 things:</p><ul><li>Check the instance is already running or not</li><li>Check the security group of the instance (open to port 80 or not, it based on the port of healt check configuration in ELB)</li><li>Check the service of http using command <em>service httpd status </em>, you can ssh the instance directly or JumpServer(create the privateKey, change permission by 400, and ssh with private key)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*0QZ4NvR5kQPsK699AxGx2g.png" /><figcaption>SSH using JumpServer</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GcdQ6tIBcBg8ZfHPvJdamg.png" /><figcaption>Instance</figcaption></figure><ul><li>Now you can acces you site using the DNS of the ELB</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNpUbH6O6HAgYqj-CvR0Ig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkBuqx5c2qDpcuRYd9A4UA.png" /></figure><p>15. Testing for the ASG</p><ul><li>Delete one of the instance</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHZvtMV_c92wZSwxpZg-Pw.png" /></figure><ul><li>It will be create new instance and send the notif to email</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*39vw9A7EJcTbhyb2REObzA.png" /><figcaption>New Instance</figcaption></figure><ul><li>You can see the notification in Email</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HOorTyW3gDIP1qFhuUzN7Q.png" /><figcaption>Notification Termination and Launch</figcaption></figure><p>16. Setup the DNS route directly to the ELB Endpoint</p><ul><li>Configure the DNS</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cZClQZ3Zw3eIWBMDYf-Lpw.png" /></figure><p><strong><em>Note:</em></strong> now the domain arisukarno.xyz will be direct to the ELB Endpoint.</p><p>17. Custom monitoring using Cloud Watch, some you have instance maybe running independently or it not cover by ELB configuration for monitoring.</p><ul><li>Create Rule for the Cloud Watch</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mVqM7ce-j1S8HToIcrRv4Q.png" /></figure><ul><li>Stop the independenly instance</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVZq_tdW0hMhvUdpnuAW0Q.png" /></figure><ul><li>You will get the notifications</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCa5BAz3K6RxT5hRfntwJg.png" /></figure><p>18. <strong>Next is concern on <em>Security</em></strong>, by default the instance that will be created without public IP and this is the best practice to increase the security.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O_NSZWyXsdwspEQ_PCsXAA.png" /></figure><p><strong>Note:</strong> Connect to the instance using VPN Server, I have already making article about this topic see in <a href="https://medium.com/@arisukarno/connect-ec2-instances-through-vpn-d69de6f35e6d">https://medium.com/@arisukarno/connect-ec2-instances-through-vpn-d69de6f35e6d</a></p><p>19. Configure the security group</p><ul><li>Secgroup of the Instance, SSH just source from secgroup VPN server (in here not configure) and HTTP just from the secgroup ELB.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSQhBBZS3G9uPnJuSmUQuA.png" /><figcaption>Secgroup of the ELB Instance</figcaption></figure><ul><li>Secgroup of the RDS just open from secgroup web server</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JGaNj1qQ7ySGw8IIp1turg.png" /></figure><p>20. Configure HTTPS of the instance ELB (you have to create certificate SSL first by your own or from AWS Certificate Manager)</p><ul><li>Goto the listener, change the protocol to HTTPS and change the SSL Certificate</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9zoWO9btWtMJqRqOLdDBtw.png" /></figure><ul><li>Choose from the ACM (in here, my certificate is not ready or pending), if you have the certificate you can choose you certificate. (<strong>don’t forget</strong> for change the secgroup of the instance it’s self for open the port 443).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*KNQSWXEPlHsizOSBwqS0tQ.png" /></figure><p><strong>Okey</strong>, until this step the wordpress Apps only will be direct to the port 443 or with SSL certificate so our site is secure.</p><p>Hufftt!… long step yeachh, cause we create from scratch <strong>:)</strong> Hope this useful for you, have a good day!</p><p><strong><em>Source:</em></strong></p><ul><li><a href="https://www.techopedia.com/definition/23599/multi-tier-application">https://www.techopedia.com/definition/23599/multi-tier-application</a></li><li><a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/introduction.html">https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/introduction.html</a></li><li><a href="https://techviewleo.com/install-php-7-on-amazon-linux/">https://techviewleo.com/install-php-7-on-amazon-linux/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93d2087244c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>