<?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 Suraj Kumar on Medium]]></title>
        <description><![CDATA[Stories by Suraj Kumar on Medium]]></description>
        <link>https://medium.com/@suraj_207?source=rss-735cc5787ebb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*3OAXwPoNn2tzG0oQM7rVbw.jpeg</url>
            <title>Stories by Suraj Kumar on Medium</title>
            <link>https://medium.com/@suraj_207?source=rss-735cc5787ebb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:13:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suraj_207/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[Kubernetes: Cluster Autoscaler]]></title>
            <link>https://medium.com/@suraj_207/kubernetes-cluster-autoscaler-7b99f39c58b2?source=rss-735cc5787ebb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b99f39c58b2</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Suraj Kumar]]></dc:creator>
            <pubDate>Tue, 02 Aug 2022 10:07:41 GMT</pubDate>
            <atom:updated>2022-08-02T10:07:41.549Z</atom:updated>
            <content:encoded><![CDATA[<p>In my last blog I discussed about how the Horizantal Pod Autoscaler works. But what if we reach the max node size and there is no place left for the pods to scale-out. In this case the cluster autoscaler comes into picture. The cluster autoscaler typically scales-out your node and let the pods in the pending state to run in those nodes. However there are a lot of other things that comes into picture. First I will discuss the working of cluster-autoscaler with the help of a demo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*k4sBRDFgCzU3_dGwYHUKng.png" /></figure><p>Requirements:</p><ol><li>AWS account</li><li>An IAM user</li><li>AWS CLI installed on your machine</li><li>VS CODE or any other editor.</li><li>Install kubectl and eksctl in your machine</li></ol><p>At first it is necessary to configure the AWS CLI on your machine, for this download the CLI from <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html</a> and install it on your machine</p><p>Now run the following command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*moqP9ZDH8T6lVqnc.png" /><figcaption>Configure AWS CLI and the necessary details.</figcaption></figure><p>You can select any region of your choice. The region selected here would be used for the deployment.</p><p>Now create a cluster with the following command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*Y4iLJdxz5VqMfnV-yOnKGA.png" /></figure><p>This command will also create two node-group of m5.large type by default.</p><p>The instance m5.large has 2vCPU. This will be required as the yaml file is also accordingly adjusted.</p><p>Next, apply the cluster autoscaler deployment file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*YbeQNFNdWROCI5PeAcpBTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*zyD9ieTb9_OY628RFUBb4A.png" /><figcaption>Result when download is successful</figcaption></figure><p>Patch the deployment to add the cluster-autoscaler.kubernetes.io/safe-to-evict annotation to the Cluster Autoscaler pods with the following command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*YXLKO1YmTSPi7jBx5HXa-A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*vN6_JBEHIN-yK4q4NPpbGw.png" /><figcaption>Output of the above command</figcaption></figure><p>Now edit the file as per the documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*AJiKESzlCP6NwfpxnLbkoQ.png" /></figure><p>Edit the cluster-autoscaler container command to add the following options. --balance-similar-node-groups ensures that there is enough available compute across all availability zones. --skip-nodes-with-system-pods=false ensures that there are no problems with scaling to zero.</p><ul><li>--balance-similar-node-groups</li><li>--skip-nodes-with-system-pods=false</li></ul><p>Set the Cluster Autoscaler image tag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*M5020YiIgCn0QoF4CZi0uA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*FbYRNT0SDsnoSj0f0QOFuA.png" /><figcaption>If you see this, the command was successful</figcaption></figure><p>Now the cluster autoscaler is set up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*u2m4uhNO1BL5gHxxVHSCow.png" /></figure><p>Now we need to change the AutoScaling configuration to make the max-size to 4. By default it is set to 2.</p><p>After this apply the below yaml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*F76F_zn93UDHO0qZDR5CXQ.png" /><figcaption>cluster-autoscaler-deployment.yaml</figcaption></figure><p>This YAML file is requesting 500m and number of replicas is 20. So total cpu requested would be 500 x 20 = 10000 m . So vCPU required = 10000/1000 i.e. 10vCPU.</p><p>In this way our one node which has 2vCPU(m5.large type) can accomodate 4 pods. For other pods we will require more nodes. The other node would accomodate other 4 pods but than the cluster autoscaler will kick-in.</p><p>Also, if we see carefully we don’t have any traffic here. There is no CPU utilization increase or decrease. The cluster autoscaler totally works on the <strong>requested CPU</strong> and not the actual <strong>CPU utlization</strong>. To summarize:</p><p>HPA scales pod in a node whereas the Cluster Autoscaler scales node in a cluster.</p><p>Apply by the command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*kEfR2KPZF8YCJ111YqygQQ.png" /></figure><p>After few seconds you can see more node spins up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*i1AT0ifk00qu9D5uaDh7Jg.png" /><figcaption>2 more nodes added</figcaption></figure><p>Now downscale the nodes by deleting the deployment file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*fpLukkPnGINl6Ulv1Hpk-Q.png" /><figcaption>The nodes will be terminated once the deployment file is deleted.</figcaption></figure><p><strong>Explanation —</strong></p><p><strong>Why exactly Cluster Autoscaler?</strong></p><p>The HPA is used when we have traffic. But suppose a business use case where the pods are themselve an application which is used by a single user. This kind of deployment are done using Helm Charts where a pod with a proper cpu and memory usage is provided to the user. In such case according to business use case we can have cluster autoscaler set-up.</p><p><strong>Challenges-</strong></p><p>CA is great and it works extremely well but suppose a node is exhausted and then a pod is in pending state and searching for a node to be deployed on.</p><p>Now the scheduling can be delayed based on multiple factors. By default, pod’s CPU is scrapped by kubelet every 10 seconds.</p><p>Every minute, the Metrics Server will aggregate those metrics and expose them to the rest of the Kubernetes API.</p><p>By default , HPA checks pod’s metrics every 15 seconds.</p><p>In worst case, HPA can take 1 minute and half to trigger the autoscaling.</p><p>Now, it is standard for a new compute resource to be provisioned between 3 to 5 minutes.</p><p>Lastly, the Pod has to be created by the container runtime.</p><p>Launching a container shouldn’t take more than few milliseconds, but <strong>downloading the container image could take several seconds.</strong></p><p>So total provisioning time in the worst case could be around 6 minutes.</p><p>No one can wait for this time if it is a production environment.</p><p>One can try two things:</p><ol><li><strong>Avoid creating new nodes,</strong> if possible.</li><li><strong>Creating nodes proactively</strong> so that they are already provisioned when you need them as the maximum time is taken by provisioning of node.</li></ol><p>We can create nodes proactively by overprovisioning a node. This has a complex set up and will discuss about overprovisioning of node in detail in my next blog.</p><p>Thanks for your time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b99f39c58b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes: Horizantal Pod Autoscaler]]></title>
            <link>https://medium.com/@suraj_207/kubernetes-horizantal-pod-autoscaler-66e3b45a3ecb?source=rss-735cc5787ebb------2</link>
            <guid isPermaLink="false">https://medium.com/p/66e3b45a3ecb</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Suraj Kumar]]></dc:creator>
            <pubDate>Sun, 31 Jul 2022 11:06:13 GMT</pubDate>
            <atom:updated>2022-07-31T11:06:13.516Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/495/1*k4sBRDFgCzU3_dGwYHUKng.png" /></figure><p>Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation. It has a large, rapidly growing ecosystem.</p><p>We will now compare the AWS Auto Scaling Grouup with that of Kubernetes Autoscaler.</p><p>In AWS ASG we have an EC2 instance and based on the CPU utilization or some other metric we can decide the scale-in or scale-out policy where a new EC2 is provisioned if any policy is hit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*JlCw6ewPy6SSHOtjyWZzZQ.png" /><figcaption><strong>AWS ASG</strong></figcaption></figure><p>In Kubernetes, a <em>HorizontalPodAutoscaler</em> automatically updates a workload resource (such as a <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/">Deployment</a> or <a href="https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/">StatefulSet</a>), with the aim of automatically scaling the workload to match demand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*R81PxR-y7ZF1AIAo-QPVhA.png" /><figcaption><strong>HPA</strong></figcaption></figure><p>A pod is a group of one or more containers which contains with shared storage and network resources. Here, one node (an EC2 instance) may have multiple pods. In HPA we don’t spin up a node rather than multiple pods are deployed in a single node based on the CPU metric of that pod.</p><p>We will now see a quick demo of how the Horizantal Pod Autoscaler works.</p><p>Requirements:</p><ol><li>AWS account</li><li>An IAM user</li><li>AWS CLI installed on your machine</li><li>VS CODE or any other editor.</li><li>Install kubectl and eksctl in your machine</li></ol><p>At first it is necessary to configure the AWS CLI on your machine, for this download the CLI from <a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html</a> and install it on your machine</p><p>Now run the following command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/1*OeZVhn47vbsn9B8yLC5nhA.png" /><figcaption><strong>Configure AWS CLI and type the necessary details</strong></figcaption></figure><p>You can select any region of your choice. The region selected here would be used for the deployment.</p><p>Now let’s create a cluster in EKS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*FEUsr-aSWAFdzItpWlpPsg.png" /><figcaption><strong>Creates an EKS cluster with version 1.22 and node of type t3.xlarge</strong></figcaption></figure><p>This command actually creates a cloudformation stack, which you can see in the Cloudformation console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*SSRYbSnwwI_9o9n04owABQ.png" /><figcaption><strong>Cloudformation stack</strong></figcaption></figure><p>This stack creates an EKS cluster as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*21iszHpPOzU87KBG9Pqw1A.png" /><figcaption>EKS console</figcaption></figure><p>After a while you can see such message in the terminal which says that your cluster creation step is complete. Generally it takes around 15–18 minutes to complete the whole process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*TbRK-OU8uqQjZJm2CupnUA.png" /><figcaption><strong>Message if cluster test-eks is created</strong></figcaption></figure><p>After this we need to install the metrics server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*lBx_HR-VuuplbnPn8C46Zg.png" /><figcaption><strong>Command for installing the metrics server</strong></figcaption></figure><p>Now we will deploy an yaml file which will create deployment, service and hpa for us. Apply the below yaml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*RlG-CoVeLVH1m-HhQI_oVA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*ig1-G6AYsvVTDvsFrVv3YQ.png" /></figure><p>Name this file as hpa-php-apache.yaml</p><p>targetCPUUtilizationPercentage says that create a replica of pod if pod CPU &gt;50% of requested CPU i.e. if pod CPU &gt; 250m.</p><p>Now apply this file by the following command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*mLlGDKL8eeQbF2OzREN2FQ.png" /></figure><p>If you see this message than the command was successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*TfgNohG1-5SCpt2cxyTrYg.png" /></figure><p>Now we need to increase the load. In production the load would be in the form of user traffic. But here we will use a pod to increase the load.</p><p><em>kubectl run -i — tty load-generator — rm — image=busybox:1.28 — restart=Never — /bin/sh -c “while sleep 0.01; do wget -q -O- http://php-apache; done”</em></p><p>Your terminal will now be looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*hbwhk31xNCA04MNPaJ7k1w.png" /><figcaption><strong>Load generation using a pod</strong></figcaption></figure><p>Now don’t exit this terminal. Launch a new terminal and fire the below command continuously for some time</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/252/1*KpfVzNdiOg_V26iNjA4wCw.png" /></figure><p>Your output will be like this after some time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*CuTTuiRhnUeW9OtZfJuVdw.png" /><figcaption><strong>Three replicas are created due to the increased load.</strong></figcaption></figure><p>Now exit the previous terminal and you will see that replicas will scale down automatically. But it will take time to scale-down.</p><p>After a while:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*ZSW6PKZwoPx2lV17fLsvHQ.png" /><figcaption><strong>Scaling down</strong></figcaption></figure><p>The default check performed by HPA for scaling up the pods is 30 seconds. But that for scaling-down is 5 mins. When the load decreases, the HPA intentionally waits a certain amount of time before scaling the app down. This is known as the cooldown delay and helps that the app is scaled up and down too frequently.</p><p>But what if whole node is utilized? What if there is no more space to spin up a pod? In this case the cluster autoscaler comes into picture. The cluster autoscaler provisions a new node and than the pod can be deployed there. I will discuss in detail about the cluster autoscaler in the next blog.</p><p>Thanks for your time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66e3b45a3ecb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Amazon S3: Features and Storage Classes]]></title>
            <link>https://medium.com/@suraj_207/amazon-s3-features-and-storage-classes-1503c4256a43?source=rss-735cc5787ebb------2</link>
            <guid isPermaLink="false">https://medium.com/p/1503c4256a43</guid>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws-s3]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Suraj Kumar]]></dc:creator>
            <pubDate>Sun, 16 Jan 2022 18:45:09 GMT</pubDate>
            <atom:updated>2022-01-16T18:45:09.780Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is AWS S3?</h3><p>Amazon Simple Storage Service (Amazon S3) is an object storage service offering industry-leading scalability, data availability, security, and performance. Customers of all sizes and industries can store and protect any amount of data for virtually any use case, such as cloud-native applications, and mobile applications. While designed for developers for easier web-scale computing, it provides 99.999999999 percent durability and 99.99 percent availability of objects. It can also store files up to 5 terabytes in size. It is an object storage unlike block storage(EBS).</p><h3>S3 Buckets</h3><p>Amazon S3 allows people to store objects in “buckets”. Buckets have a globally unique name and are defined at the regional level.</p><p>S3 bucket has a flat hierarchy which means that one bucket can only contain objects and not another bucket.</p><p>Steps for creating a bucket-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7T5ymPRTQAVTWovuDVKNPQ.png" /><figcaption>Tap on create bucket under s3 console.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*BkVjiTtSjofCM8mixPNqVg.png" /><figcaption>Select an unique bucket name.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*hBAdBNu8FSXFA3h6w4VNDQ.png" /><figcaption>Enable ACLs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*AYikpnMAndyx19TTNjfQEw.png" /><figcaption>Untick Block all public access if you want your bucket to be publicly accessible.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*yPTN03hAsL_YDp-ZAoAg7w.png" /><figcaption>Enable versioning if you want to retrieve and restore every version of object.</figcaption></figure><p>Set other parameters as default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*LXbkWcCMVeoTN1epuTFebw.png" /><figcaption>Tap on create bucket.</figcaption></figure><p>Now to upload files and folders in S3 we can go to our bucket and upload them as follows-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5vKIRC3P7kCSQ2EPx9FErg.png" /><figcaption>Tap on bucket name.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFjgS8rzm-i4VjinOVaXqg.png" /><figcaption>Tap on upload</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*UJMe7kt0wLw-QbZHZkP3-g.png" /><figcaption>Browse directory and add a file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*s7lNE6NZmjVNDFPG_bGkJQ.png" /><figcaption>Tap on upload for final upload.</figcaption></figure><p>Now if you want to share this file to friends than you can do so by making it public via ACL under actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qRxft8z56RDlwV1sShM-6A.png" /></figure><p>Now after this step tap on object you have uploaded and than copy the object URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1yoIfV0ZxVtLrnxi3DpbQ.png" /></figure><p>Paste the URL to see the file and you can also share it with your friends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfi856wsfN4htX6dko-DYA.png" /></figure><h3>S3 Versioning</h3><p>Now, what if there are multiple files in your bucket but due to certain reasons they are not available or by mistake someone has deleted it. We must have a concept of backup, but S3 does not have any such option. However there is an option of S3 versioning which is similar to that. It is used to rollback to a specific version. A particular use case could be following-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JN5W9HTWlK9WSss7-1IxZQ.png" /><figcaption>Delete the file we just uploaded.</figcaption></figure><p>Tap on show version to see all history that you have performed with a particular file, you will see a delete marker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wVnKjmvXXeSBgsVqCpsE9w.png" /><figcaption>Select delete marker and tap on delete.</figcaption></figure><p>Now on deleting the delete marker, we get the object back. It can be seen in our bucket. But what exactly happened?</p><p>When we deleted the object, S3 created a Delete marker for us. On deleting this Delete marker we got our object back, all this was possible as we had enabled versioning when we had first set up our bucket.</p><h3>S3 Replication</h3><p>If you want to have a backup of data or want to replicate the bucket across AWS accounts then it can be done with the help of S3 CRR/SRR(Cross-region and same-region replication). Let us see an example using SRR.</p><p>Select Management -&gt; Replication rule</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*Cw9MYvbnQQc2sBv0Yl9h5Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sLDjo949ju9iuLeaNuesFA.png" /><figcaption>Tap Create replication rule</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/1*zwszU8CtvOEjF7nqhlm_Cg.png" /><figcaption>Create a replication rule name.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*xDfVtSEjrfmhdvRAfYds6Q.png" /><figcaption>Source bucket settings</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*8tCXrY6V7sTwI3f3SztnXw.png" /><figcaption>Select choose bucket in the same account and tap on Browse S3</figcaption></figure><p>I created another bucket “surajbucketformedium2”, so I will select this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*c2rXAzLgY6EdrUYYeERu0w.png" /></figure><p>Now select an IAM role, if not available choose create new role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*MHNWKy2uuMlGzGQdL26KHA.png" /></figure><p>Leave other settings to default and save the replication rule.</p><p>Now we will upload a file in “surajbucketformedium” and see it replicate in “surajbucketformedium2”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNG1o0TOnXfvg3h6a9uJLQ.png" /><figcaption>Source bucket</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZ5-1rgzgccD-SZYYOWLAg.png" /><figcaption>Destination bucket</figcaption></figure><p>But wait a minute…did you notice something? Only the file which we uploaded after creating the replication rule was replicated. Therefore we can say that only newer files are replicated. Also there is only one way replication i.e. source to destination and not vice-versa.</p><p>If suppose we have case where a client already has S3 Bucket, but in recent years the company became famous and now they want us to replicate the past as well as future data. How could we achieve this?</p><p>This could be done with the help of aws sync command. The steps are listed below-</p><ol><li>Create an IAM user and provide Programmatic and console access.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tU0gvvhMPCWuseTyZzZWHg.png" /></figure><p>2. Provide S3FullAccess to the user</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UEPybhpS1UUWDCJAPhWDwA.png" /></figure><p>3. Download the .csv file and keep it safe.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbKeTiL9HYle2l1Zje4NDg.png" /></figure><p>4. Open cmd or terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*jcHWy8Mcv4Kc2BawihkE5A.png" /></figure><p>5. Write the aws s3 sync command to sync the two buckets</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*yXHH9GDUghHAfpVxx_vbIw.png" /></figure><p>Now open the replication bucket and you will see the previous object also replicated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NpdADmaAsTl3x-RENf17XQ.png" /><figcaption>The past objects are also replicated.</figcaption></figure><p>In this way we could replicate the buckets and have a backup for all of our objects which is very useful.</p><h3>S3 requester pays</h3><p>In general, bucket owners pay for all Amazon S3 storage and data transfer costs associated with their bucket. With Requester Pays buckets, the requester instead of the bucket owner pays the cost of the request and the data downloaded from the bucket. It is helpful when you want to share large datasets with other AWS accounts.</p><p>The requester must be authenticated in AWS(cannot be anonymous).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*9rNxHQvggeKqWaJI4Gp6xA.png" /></figure><h3>S3 transfer acceleration</h3><p>Amazon S3 Transfer Acceleration can speed up content transfers to and from Amazon S3 by as much as 50–500% for long-distance transfer of larger objects. Customers who have either web or mobile applications with widespread users or applications hosted far away from their S3 bucket can experience long and variable upload and download speeds over the Internet. S3 Transfer Acceleration (S3TA) reduces the variability in Internet routing, congestion and speeds that can affect transfers</p><p>To enable it we can go to Properties and enable it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hiJQiI-pDffvBTe4Vo3mgg.png" /><figcaption>Tap on edit and enable it</figcaption></figure><h3>S3 Access Logs</h3><p>It may be used for audit purpose. Any request made to s3 from any account, authorized or denied would be logged to another s3 bucket. That data could be analyzed in future. Don’t select your logging bucket to be the monitored bucket or else it will create a logging loop and the size of the bucket would grow exponentially.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*OZWpCZl9CfwoP4FYt_Iimg.png" /></figure><h3>S3 Storage Classes</h3><ul><li>Amazon S3 Standard — General Purpose</li><li>Amazon S3 Standard-Infrequent Access (IA)</li><li>Amazon S3 One Zone-Infrequent Access</li><li>Amazon Glacier</li><li>Amazon Glacier Deep Archive</li><li>Amazon S3 Intelligent Tiering</li></ul><h4>Amazon S3 Standard — General Purpose</h4><p>It has high durability (99.999999999%) of objects across multiple AZ. It can sustain 2 concurrent facility failures.</p><h4>Amazon S3 Standard — Infrequent Access(IA)</h4><p>Suitable for data that is less frequently accessed, but requires rapid access when needed. It has low cost compared to S3 Standard. It can also sustain 2 concurrent facility failures. It has low storage cost but bit high retrieval cost compared to S3 Standard.</p><h4>Amazon S3 One Zone-Infrequent Access</h4><p>Same as IA but data is stored in a single AZ. Low cost compared to IA (by 20%)</p><h4>Amazon Glacier</h4><p>Low cost object storage meant for archiving / backup. Here data is retained for longer term(10s of years). Minimum storage duration is 90 days.</p><h4>Amazon Glacier Deep Archive</h4><p>It is for long term storage and cheaper than Amazon Glacier. It has a minimum storage duration of 180 days.</p><h4>Amazon S3 Intelligent Tiering</h4><p>Same performance as S3 Standard and low latency. But it charges small monthly monitoring and auto-tiering fee. It automatically moves objects between two access tiers based on changing across patterns.</p><p>One can set up storage class while uploading a file under properties section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*qkdIp6hqDzmgrL69f6kreg.png" /></figure><p>Thank you for reading till the end!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1503c4256a43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git and GitHub commands — Developers must-have skill]]></title>
            <link>https://medium.com/@suraj_207/git-and-github-commands-developers-must-have-skill-980e39de8c6b?source=rss-735cc5787ebb------2</link>
            <guid isPermaLink="false">https://medium.com/p/980e39de8c6b</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Suraj Kumar]]></dc:creator>
            <pubDate>Sun, 27 Sep 2020 18:31:00 GMT</pubDate>
            <atom:updated>2020-09-27T18:31:00.203Z</atom:updated>
            <content:encoded><![CDATA[<h3>Git and GitHub commands — Developers must-have skill</h3><p>If you have worked with codes then you must have come across words like Git and GitHub. Here is a small description of both.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mtsk3fQ_BRemFidhkel3dA.png" /></figure><p><strong>Git</strong> is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files whether you are a programmer or write articles or just don’t want to lose your files on your Disk.</p><p>So, what makes GitHub so special? Git is a command-line tool, but the center around which all things involving Git revolve is <strong>GitHub</strong>— where developers store their projects and network with like-minded people.</p><p><strong>GitHub</strong> is a cloud-based hosting service that lets you manage Git repositories. If you have open-source projects that use Git, then GitHub is designed to help you better manage them. It may be possible that you code and make changes that are devastating and you just want to revert back, this is where GitHub comes to the rescue. Both Git and GitHub give programmers valuable version-control functionality so that they can build ongoing coding projects without being afraid of messing everything up</p><p>Here are some of the must-have commands -</p><ol><li><strong>git init</strong></li></ol><p>This command turns a directory into an empty Git repository. This is the first step in creating a repository-</p><p><strong>2. git add</strong></p><p>Adds files in the to the staging area for Git. Before a file is available to commit to a repository, the file needs to be added to the Git staging area.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*eRxc1krTNQ8YjSwLrHHRRQ.jpeg" /></figure><p><strong>3. git commit</strong></p><p>Record the changes made to the files to a local repository. For easy reference, each commit has a unique ID. It’s best practice to include a message with each commit explaining the changes made in a commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*sBT73VkxIokxfUfKWXMaDQ.jpeg" /></figure><p><strong>4.git status</strong></p><p>This command returns the current state of the repository and helps us find which files are committed and which are not.</p><p><strong>5.git push</strong></p><p>Sends local commits to the remote repository. <em>git push</em> requires two parameters: the remote repository and the branch that the push is for-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*RVZ7p8BMLzPoM1f8o3ZxSQ.jpeg" /></figure><p><strong>6.git branch</strong></p><p>To determine what branch the local repository is on, add a new branch, or delete a branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*NA3zOhJsHSzF-QKx0Km9sQ.jpeg" /></figure><p><strong>7.git checkout</strong></p><p>It is used to switch branches so the user is able to work on a different branch and doesn&#39;t affect the existing branch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/1*-gMsVoVUCu8AjNda-s1Sqg.jpeg" /></figure><p>If you want to contribute to open-source projects or just want to manage your code well so you don&#39;t get messed up, both git and GitHub are there to help you. Dive deep and know more….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=980e39de8c6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>