<?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 Nirmalya Saha on Medium]]></title>
        <description><![CDATA[Stories by Nirmalya Saha on Medium]]></description>
        <link>https://medium.com/@nirmalyasaha?source=rss-7fdacb31882a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*zKQStPnzMlD203Z5</url>
            <title>Stories by Nirmalya Saha on Medium</title>
            <link>https://medium.com/@nirmalyasaha?source=rss-7fdacb31882a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:20:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nirmalyasaha/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[Mastering AWS Deployment: A Step-by-Step Guide to VPCs, ECS, Load Balancers, ECR and CI/CD…]]></title>
            <link>https://nirmalyasaha.medium.com/mastering-aws-deployment-a-step-by-step-guide-to-vpcs-ecs-load-balancers-ecr-and-ci-cd-f02a7e962cf8?source=rss-7fdacb31882a------2</link>
            <guid isPermaLink="false">https://medium.com/p/f02a7e962cf8</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ecs-fargate]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Nirmalya Saha]]></dc:creator>
            <pubDate>Sat, 01 Jun 2024 15:44:23 GMT</pubDate>
            <atom:updated>2024-06-01T15:44:23.208Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mastering AWS Deployment: A Step-by-Step Guide to VPCs, ECS, Load Balancers, ECR and CI/CD Pipelines</h3><p><em>AWS Fargate stands out as a powerful solution for running containerized workloads without the need to manage underlying infrastructure. By leveraging Fargate in conjunction with AWS services like Elastic Container Registry (ECR), Elastic Container Service (ECS), and Load Balancer, teams can achieve a streamlined DevOps workflow that accelerates development cycles and enhances application resilience.</em></p><h3>Introduction</h3><p>Welcome to the exciting world of AWS DevOps management! If you’re a beginner AWS software engineer eager to take your first steps in the DevOps world you’re in the right place.</p><p>This comprehensive guide will walk you through mastering AWS deployment, from setting up your own Virtual Private Cloud (VPC) and configuring NAT gateways and subnets to deploying applications using Elastic Container Service (ECS) and automating the entire process with CodePipeline and CodeBuild.</p><p>By the end of this guide, you’ll have a solid understanding of how to create a robust, scalable, and automated deployment pipeline on AWS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*-AYr7-e-NKYC0epK9obyyw.png" /><figcaption>Architecture</figcaption></figure><h3>Why These Services?</h3><p>Before we dive into deployment, let’s understand why I’ve chosen these particular AWS services.</p><ol><li><strong>AWS ECR</strong> (Elastic Container Registry): Securely store, manage, and deploy Docker container images.</li><li><strong>AWS ECS</strong> (Elastic Container Service): Orchestrate and manage Docker containers at scale.</li><li><strong>AWS LOAD BALANCER</strong> that will manage and route traffic to our ECS Service Tasks.</li><li><strong>AWS Fargate</strong>: Run containerized applications without managing servers.</li><li><strong>AWS VPC</strong>: Provides a secure and isolated environment to run your applications in the AWS cloud.</li><li><strong>CodePipeline</strong>: Automates your release process, enabling fast and reliable delivery of your applications and updates.</li><li><strong>CodeBuild</strong>: Compiles your source code, runs tests, and produces artifacts that are ready for deployment, streamlining your build process.</li></ol><h3>Assumptions</h3><ul><li>A node.js server project hosted in a git repository on a service such as Bitbucket or GitHub.</li><li>AWS account, docker and node.js with npm installed in your system.</li></ul><h3>Step 1: Configuring your VPC and Network Interfaces</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mI7_d1-0KCdHF7-g1V_ydQ.jpeg" /><figcaption>VCP Configuration</figcaption></figure><ul><li><strong>Create VPC</strong>: Select “<em>VPC and more</em>” and enter the name tag (e.g., “project”) with an IPv4 CIDR block (e.g., 10.0.0.0/16).</li><li><strong>Configure Subnets</strong>: Choose the number of availability zones (e.g., 2), set the number of public subnets (e.g., 2), and the number of private subnets (e.g., 2).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*52eXXEobX_npKLBfmDMn3w.jpeg" /><figcaption>VPC Configuration</figcaption></figure><ul><li><strong>Set Up NAT Gateways</strong>: Choose to create NAT gateways in one availability zone.</li><li><strong>Configure VPC Endpoints</strong>: Select the “S3 Gateway” option for VPC endpoints.</li><li><strong>Preview Configuration</strong>: Review the VPC settings, subnets, route tables, and network connections in the preview pane.</li></ul><h3>Step 2: Containerize Your Application In AWS ECR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyiXUttfXX9h67IVmXlSWQ.jpeg" /><figcaption>ECR General Settings</figcaption></figure><ol><li>Go to AWS ECR console and click “<em>Create repository</em>”.</li><li>Select private repository.</li><li>Enter the repository name of your choice and click create.</li><li>Set encryption settings to KMS.</li><li><strong>Dockerise your application</strong>: In order to make a docker image of your application we need to have a Dockerfile inside it. Create one according to your application environment.</li><li>From console click “Push commands”.</li><li>Run all the push commands you will get your server’s dockerised image pushed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mIbSBwPXM5lA3gliuZHBgA.jpeg" /><figcaption>ECR Encryption Settings</figcaption></figure><h3>Step 3: Create Your ECS Cluster</h3><p>Now lets jump into setting up the ECS. ECS has four major components as shown in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*LQpkDQ7Mb45q2maCCYN7VQ.png" /><figcaption>ECS Architecture</figcaption></figure><ol><li><strong>Container Definition</strong>: In this, we specify the image to be used. The one we pushed into the ECR.</li><li><strong>Task Definition</strong>: Task is nothing but a running instance of your container. In its definition, we specify the memory and number of CPUs to allocate to the task.</li><li><strong>Service</strong>: It serves as the environment for your tasks e.g vpc, subnets, security groups.</li><li><strong>Cluster:</strong> It’s a container for your ECS services, one cluster can have multiple services.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXddTwy6uTKqaVB6Hs7HVg.jpeg" /><figcaption>ECS Cluster Configuration</figcaption></figure><ol><li>From AWS ECS cluster console click “<em>Create</em>”.</li><li>Provide your cluster name and select infrastructure as AWS Fargate.</li><li>Provide your cluster name.</li></ol><h3>Step 4: Create our Task Definition</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npkdka4tL_lLjJd2ytpKYw.jpeg" /><figcaption>ECS Task Defination Configuration</figcaption></figure><ul><li>Go to the Task Definitions tab and click on “<em>Create”</em>.</li><li>Provide your task definition family name and infrastructure as “<em>AWS Fargate”</em>.</li><li>Select launch type as AWS Fargate.</li><li>Choose your desired operating system and system requirements.</li><li>You can provide your application permissions via Task role.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RGid_hIYNgbHV-ELGxE8VQ.jpeg" /><figcaption>ECS Task Definition Container Configuration</figcaption></figure><ul><li>Provide your containerized image deployed in AWS ECR, the name and image uri.</li><li>Provide your server port mappings and system requirements</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*khIMyrmmufg0NdiTFEJX-Q.jpeg" /><figcaption>ECS Task Definition Docker Configuration</figcaption></figure><p><em>You can set all your docker configuration in this stage with any environment variable used in your application.</em></p><h3>Step: 5 Create Your Cluster Service</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KUivGe7uqykGrnSI5C_19Q.jpeg" /><figcaption>ECS Service</figcaption></figure><ul><li>Go to the clusters tab and select your newly created cluster and under the Services sub-tab, click on “<em>Create”</em>.</li><li>Select environment as “<em>Launch type</em>” and rest as default.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZM8U6No7e-KMDbeJIe4baA.jpeg" /><figcaption>ECS Service Deployment Configuration</figcaption></figure><ul><li>Select application type as Service.</li><li>Select the task definition that you created earlier from the dropdown.</li><li>Provide a name to your service and the number of tasks you want to be running at all times. In our case, I have given the value 1.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*VOp7EZ4w7mshqeTz4CK0cw.jpeg" /><figcaption>ECS Service Networking Configuration</figcaption></figure><ul><li>Select the VPC you just created from the dropdown.</li><li>Select all the public subnets for internet gateway access to your application.</li><li>Choose a “<em>new security group</em>”, providing inbound access to your application from internet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztbt7v5rB_5Zs_bhCsZd5Q.jpeg" /><figcaption>ECS Service Load Balancer Configuration</figcaption></figure><ul><li>Select Application Load Balancer from the dropdown.</li><li>Select your container with your application port from the dropdown.</li><li>Choose “<em>Create a new load balancer</em>”, and provide your load balancer name.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*6nJRecGUebZaC-RHUyJnCg.jpeg" /><figcaption>ECS Service Load Balancer Configuration</figcaption></figure><ul><li>Create a new listener at your application port.</li><li>Create a new target group and provide your health check route.</li></ul><blockquote>Optionally you can also set auto scaling. Provide your minimum and maximum task number you want to run. Select your policy type and scaling threshold and click on Create.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*1Q4r2I-KnC5Iawrd-K7tww.jpeg" /><figcaption>Target group</figcaption></figure><blockquote>Note: if your application port is not 80 then your load balancer health check might fail for that just update your target group’s health check port.</blockquote><h3>AWS ECS Automated Deployment with AWS CodePipeline and CodeBuild</h3><p><em>In the rapidly evolving world of cloud computing, automating your deployment processes is crucial to maintaining agility and ensuring your applications are always up-to-date. Amazon Web Services (AWS) provides powerful tools like Elastic Container Service (ECS), CodePipeline, and CodeBuild to streamline and automate the deployment of your containerized applications.</em></p><h4>Step 1: Add a Build Specification File to Your Source Repository</h4><ol><li><strong>Pre-build stage</strong>:</li></ol><ul><li>Log in to Amazon ECR.</li><li>Set the repository URI to your ECR image and add an image tag with the first seven characters of the Git commit ID of the source.</li></ul><p>2. <strong>Build stage</strong>:</p><ul><li>Build the Docker image and tag the image both as latest and with the Git commit ID.</li></ul><p>3. <strong>Post-build stage</strong>:</p><ul><li>Push the image to your ECR repository with both tags.</li><li>Write a file called imagedefinitions.json in the build root that has your Amazon ECS service&#39;s container name and the image and tag. The deployment stage of your CD pipeline uses this information to create a new revision of your service&#39;s task definition, and then it updates the service to use the new task definition.</li></ul><pre>version: 0.2<br><br>phases:<br>  pre_build:<br>    commands:<br>      - echo Logging in to Amazon ECR...<br>      - aws --version<br>      - aws ecr &lt;ecr-login-command&gt;<br>      - REPOSITORY_URI=&lt;repository-uri&gt;<br>      - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)<br>      - IMAGE_TAG=${COMMIT_HASH:=latest}<br>  build:<br>    commands:<br>      - echo Build started on `date`<br>      - echo Building the Docker image...<br>      - docker build -t $REPOSITORY_URI:latest .<br>      - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG<br>  post_build:<br>    commands:<br>      - echo Build completed on `date`<br>      - echo Pushing the Docker images...<br>      - docker push $REPOSITORY_URI:latest<br>      - docker push $REPOSITORY_URI:$IMAGE_TAG<br>      - echo Writing image definitions file...<br>      - printf &#39;[{&quot;name&quot;:&quot;&lt;ecr_container_name&gt;&quot;,&quot;imageUri&quot;:&quot;%s&quot;}]&#39; $REPOSITORY_URI:$IMAGE_TAG &gt; imagedefinitions.json<br>artifacts:<br>    files: imagedefinitions.json</pre><blockquote>Paste this sample text to create your buildspec.yml file, and replace <em>ecr-login-command, repository-uri, ecr-container-name.</em></blockquote><h4>Step 2: Creating Your Continuous Deployment Pipeline</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gOWA1o18v_e3zXZlloHjZg.jpeg" /><figcaption>CodePipeline Create</figcaption></figure><ol><li>Open the “<em>CodePipeline </em>”console and click “<em>Create”</em></li><li>On the <strong>Step 1: Name</strong> page, for <strong>Pipeline name</strong>, type the name for your pipeline.</li><li>In <strong>Pipeline type</strong>, choose <strong>V2</strong> and choose <strong>Next</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O95WI1Re-inV0sJHKHRnJQ.jpeg" /><figcaption>CodePipeline Source</figcaption></figure><ol><li>On the <strong>Step 2: Add source stage</strong> page, for <strong>Source provider</strong>, choose your source provider, here I am choosing <strong>Bitbucket</strong>.</li><li>For <strong>Repository name</strong>, choose the name of your repository to use as the source location for your pipeline.</li><li>For <strong>Branch name</strong>, choose the branch to use and choose <strong>Next</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4iWRTeTpYoy6UBwNvd2_A.jpeg" /><figcaption>CodePipeline Stage Trigger</figcaption></figure><blockquote>Optionally you can set your source triggers on push or pull against a branch or tag.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tYqFmHk3r9K-Kn2XFj4TeA.jpeg" /><figcaption>CodePipeline Build Stage</figcaption></figure><p>On the <strong>Step 3: Add build stage</strong> page, for <strong>Build provider</strong> choose <strong>AWS CodeBuild</strong>, and then choose <strong>Create project</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pDgkN_KBGS6P0M4doIAgjg.jpeg" /><figcaption>CodeBuild Create</figcaption></figure><ol><li>For <strong>Project name</strong>, choose a unique name for your build project. For this tutorial, the project name is <strong>hello-world</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*yqh-DWzzPKwk3mYbb4n_Lg.jpeg" /><figcaption>CodeBuild Environment</figcaption></figure><ol><li>For <strong>Environment image</strong>, choose <strong>Managed image</strong>.</li><li>For <strong>Operating system</strong>, choose <strong>Amazon Linux</strong>.</li><li>For <strong>Runtime(s)</strong>, choose <strong>Standard</strong>.</li><li>For <strong>Image</strong>, choose the latest, <strong>Image version</strong> and <strong>Environment type</strong>, use the default values.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*sOGY5z6DzOsuggLCHq39Fw.jpeg" /><figcaption>CodeBuild Configuration</figcaption></figure><blockquote>Select Enable this flag if you want to build Docker images or want your builds to get elevated privileges.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*QbwjUMJoAR8NxX-2NX3Kkg.jpeg" /><figcaption>CodeBuild Buildspec</figcaption></figure><blockquote>Provide your buildspec.yam file location/name in your root project directory. Choose <strong>Continue to CodePipeline</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EQp9GREg7jLq0T-VNCJzwQ.jpeg" /><figcaption>CodePipeline Deploy Stage</figcaption></figure><ol><li>On the <strong>Step 4: Add deploy stage</strong> page, for <strong>Deployment provider</strong>, choose <strong>Amazon ECS</strong>.</li><li>For <strong>Cluster name</strong>, choose the Amazon ECS cluster in which your service is running.</li><li>For <strong>Service name</strong>, choose the service to update and provide your <em>imagedefination.json</em> file name and choose <strong>Next</strong>.</li><li>On the <strong>Step 5: Review</strong> page, review your pipeline configuration and choose <strong>Create pipeline</strong> to create the pipeline.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AqNA01PreYxuDmKgUUF1Vw.jpeg" /><figcaption>CodeBuild Service Role</figcaption></figure><p>The CodePipeline wizard created an IAM role for the CodeBuild build project, called <strong>codebuild-</strong><strong><em>build-project-name</em>-service-role</strong>.</p><p>Because the buildspec.yml file makes calls to Amazon ECR API operations, the role must have a policy that allows permissions to make these Amazon ECR calls.</p><p>Attach the following policies to your code build iam service role.</p><p><em>Your pipeline should have everything for running an end-to-end native AWS continuous deployment. Now, test its functionality by pushing a code change to your source repository. We are all set your app should be running fine now. Hit the DNS name of your load balancer in the browser and your app should be working fine.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f02a7e962cf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering AWS DevOps with AWS Fargate Architecture: Leveraging ECR, ECS, and Load Balancer]]></title>
            <link>https://nirmalyasaha.medium.com/mastering-aws-devops-with-aws-fargate-architecture-leveraging-ecr-ecs-and-load-balancer-a27d8d782dbc?source=rss-7fdacb31882a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a27d8d782dbc</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-ecs]]></category>
            <category><![CDATA[fargate]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Nirmalya Saha]]></dc:creator>
            <pubDate>Sun, 12 May 2024 12:33:14 GMT</pubDate>
            <atom:updated>2024-05-12T12:33:14.245Z</atom:updated>
            <content:encoded><![CDATA[<p><em>AWS Fargate stands out as a powerful solution for running containerized workloads without the need to manage underlying infrastructure. By leveraging Fargate in conjunction with AWS services like Elastic Container Registry (ECR), Elastic Container Service (ECS), and Load Balancer, teams can achieve a streamlined DevOps workflow that accelerates development cycles and enhances application resilience.</em></p><h3>Introduction</h3><p>Welcome to the exciting world of AWS DevOps management! If you’re a beginner AWS software engineer eager to take your first steps in the DevOps world you’re in the right place.</p><p>In this step-by-step guide, we’ll navigate the AWS services to containerize a node.js server in AWS ECR and deploy the containerized image in AWS ECS with serverless Fargate architecture auto scaled using a Load Balancer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7UdeslTrbN-sy18yE_j2g.jpeg" /><figcaption>FARGATE ARCHITECTURE</figcaption></figure><h3>Why These Services?</h3><p>Before we dive into deployment, let’s understand why I’ve chosen these particular AWS services.</p><ol><li><strong>AWS ECR</strong> (Elastic Container Registry): Securely store, manage, and deploy Docker container images.</li><li><strong>AWS ECS</strong> (Elastic Container Service): Orchestrate and manage Docker containers at scale.</li><li><strong>AWS LOAD BALANCER</strong> that will manage and route traffic to our ECS Service Tasks.</li><li><strong>AWS Fargate</strong>: Run containerized applications without managing servers.</li></ol><h3>Assumptions</h3><ul><li>A node.js server project hosted in a git repository on a service such as Bitbucket or GitHub.</li><li>AWS account, docker and node.js with npm installed in your system.</li></ul><h3>Containerize your application in AWS ECR</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iq4yztZlIj-08oym6TeNWw.jpeg" /><figcaption>Create repository</figcaption></figure><ol><li>Go to AWS ECR console and click “Create repository”.</li><li>Select private repository.</li><li>Enter the repository name of your choice and click create.</li><li><strong>Dockerise your application</strong>: In order to make a docker image of your application we need to have a dockerfile inside it. Create one according to your application environment.</li><li>From console click “Push commands”.</li><li>Run all the push commands you will get your server’s dockerised image pushed.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QXu-V3Jk7rM7idi-uXEaWQ.jpeg" /><figcaption>AWS ECR image</figcaption></figure><h3>Create your ECS cluster</h3><p>Now lets jump into setting up the ECS. ECS has four major components as shown in the picture below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/1*M_ZG2fxRUmUYA3b2yLKvNA.jpeg" /><figcaption>ECS architecture</figcaption></figure><ol><li><strong>Container Definition</strong>: In this, we specify the image to be used. The one we pushed into the ECR.</li><li><strong>Task Definition</strong>: Task is nothing but a running instance of your container. In its definition, we specify the memory and number of CPUs to allocate to the task.</li><li><strong>Service</strong>: It serves as the environment for your tasks e.g vpc, subnets, security groups.</li><li><strong>Cluster:</strong> It’s a container for your ECS services, one cluster can have multiple services.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rBueeBdHRHcit5MfLqcB9A.jpeg" /><figcaption>Create ECS cluster</figcaption></figure><ol><li>From AWS ECS cluster console click “Create”.</li><li>Provide your cluster name and select infrastructure as AWS Fargate.</li></ol><h3>Create your Task Definition</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jN2ZZvnzcpgXWVW93ltu3w.jpeg" /><figcaption>Create Task Definition</figcaption></figure><ol><li>Go to the Task Definitions tab and click on Create.</li><li>Provide your task definition family name and infrastructure as AWS Fargate.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*232lQrmQ48iPysIxHWcAqw.jpeg" /><figcaption>Task Definition infrastructure</figcaption></figure><ol><li>Select launch type as AWS Fargate.</li><li>Choose your desired operating system and system requirements.</li><li>You can provide permissions via Task role.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rf6ETM086enFFioTtJe7hA.jpeg" /><figcaption>Task Definition Container</figcaption></figure><ol><li>Provide your containerized image deployed in AWS ECR, the name and image uri.</li><li>Provide your server port mappings and system requirements</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kLoNAugWNasWDeV67-qE_Q.jpeg" /><figcaption>Task Definition Health Check</figcaption></figure><p>This is optional step for providing your health check information.</p><h3>Create your cluster service</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IHasl0z0n9T6hJMg4QLlNg.jpeg" /><figcaption>ECS Service</figcaption></figure><p>Go to the clusters tab and select your newly created cluster and under the Services sub-tab, click on Create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FI8o9R9S34UxwJkfdmEN0A.jpeg" /><figcaption>Create Service</figcaption></figure><p>Select environment as Capacity provider strategy and rest as default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mdjrKm8tEbjr2051H6fE7Q.jpeg" /><figcaption>Service Deployment</figcaption></figure><ol><li>Select application type as Service.</li><li>Select the task definition that you created earlier from the dropdown.</li><li>Provide a name to your service and the number of tasks you want to be running at all times. In our case, I have given the value 2.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oj1lVJfDvZa9X6JbjRgOGw.jpeg" /><figcaption>Service Networking</figcaption></figure><p>Specify the VPC and subnets keeping the below point in mind is that the public subnets of load balancer and private subnets of ECS tasks should be in same <strong>availability zones. </strong>Otherwise your load balancer wont be able to access the ECS tasks and your tasks would be stopping/starting continuously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*rlYMAWbZX7bTlxSPzfTYhQ.jpeg" /><figcaption>Service Load Balancer</figcaption></figure><ol><li>Select Application Load Balancer from the dropdown.</li><li>Provide the container and target group name with your health check route. Remember to put the listener to port 80 and rest keep default.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JyjVexshK14aTAY4k8RO2A.jpeg" /><figcaption>Service Auto Scaling</figcaption></figure><ol><li>Optionally you can also set auto scaling.</li><li>Provide your minimum and maximum task number you want to run.</li><li>Select your policy type and scaling threshold and click on Create.</li></ol><blockquote>We are all set your app should be running fine now. Hit the DNS name of your load balancer in the browser and your app should be working fine.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a27d8d782dbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Deploy React App on AWS using S3, CloudFront, Route53 with AWS CI/CD CodePipeline &…]]></title>
            <link>https://nirmalyasaha.medium.com/a-comprehensive-guide-to-deploy-reactjs-app-to-aws-using-s3-cloudfront-route53-withaws-ci-cd-4c4530564335?source=rss-7fdacb31882a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c4530564335</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Nirmalya Saha]]></dc:creator>
            <pubDate>Sat, 09 Mar 2024 20:03:54 GMT</pubDate>
            <atom:updated>2024-03-10T19:37:32.450Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to Deploy React App on AWS using S3, CloudFront, Route53 with AWS CI/CD CodePipeline &amp; CodeBuild</h3><p>A Comprehensive Guide to deploy React app on AWS setting up an automated deployment pipeline using CodePipeline, CodeBuild, S3, CloudFront and Route53 services.</p><h3><strong>Introduction</strong></h3><p>Welcome to the exciting world of AWS deployment! If you’re a beginner AWS software engineer eager to take your first steps in deploying a ReactJS app, you’re in the right place.</p><p>In this step-by-step guide, we’ll navigate the AWS services to set up a robust deployment pipeline using AWS CodePipeline, and CodeBuild to host a ReactJS website using AWS S3 for build storage and frontended by CloudFront CDN. We will also cover how to attach domains to CloudFront URLs using AWS Route53.</p><figure><img alt="Frontend deployment architecture using AWS Route53, S3 and CloudFront automating using CodePipeline and CodeBuild services." src="https://cdn-images-1.medium.com/max/922/1*mDCIsRQaS3UehNJ06YtvxA.jpeg" /><figcaption>Frontend deployment architecture using AWS Route53, S3 and CloudFront automating using CodePipeline and CodeBuild services.</figcaption></figure><h3><strong>Why These Services?</strong></h3><p>Before we dive into deployment, let’s understand why I’ve chosen these particular AWS services for hosting and automating your ReactJS app.</p><ul><li>AWS S3 provides a cost-effective and scalable solution for hosting static assets and build artifacts.</li><li>AWS CloudFront is a content delivery network that can be employed to swiftly distribute code to end-users by caching static assets at edge locations worldwide. This reduces latency and ensures a faster, more responsive user experience globally.</li><li>AWS Route53 serves as a reliable and scalable domain management.</li><li>AWS CodePipeline offer’s developers in rapidly building, testing, and deploying their code.</li><li>AWS CodeBuild offers developers a fully managed, serverless build environment to install dependencies, making build artifacts in S3 and creating invalidations in CLoudFront.</li></ul><h3>Assumptions</h3><ul><li>A ReactJS project hosted in a git repository on a service such as Bitbucket or GitHub.</li><li>AWS account and NodeJS with npm installed in your system.</li></ul><h3>Prerequisites</h3><p>Ensure you have the following prerequisites in place. These are required if you wish to attach your custom domains to your ReactJS app, however it’s entirely optional, and you can still use the default CloudFront distribution domain to access your application.</p><ul><li>A domain, and access to the DNS settings of that domain, that you wish to use to point to the deployed site.</li><li>A certificate for the above-mentioned domain was imported/created in Amazon Certificate Manager.</li></ul><h3>Create and Configure the S3 Bucket</h3><p>The first step in deploying your ReactJS app on AWS is to setup a S3 bucket where all static build outputs of the ReactJS app will be live and hosted. We will configure a private bucket with an attached access policy.</p><ol><li>Login into your AWS account and navigate to the S3 service.</li><li>Click the “<strong>Create Bucket</strong>” button.</li><li>In General Configuration provide your bucket name and AWS region. For this tutorial, I am providing the bucket name as “<em>nirmalyasaha.com</em>” and the region as “<em>US East (Ohio) us-east-2</em>”. Note bucket name should be unique.</li><li>Keep the remaining settings as default, emphasizing straightforward ownership, versioning simplicity, enhanced security with blocked public access, and encryption using SSE-S3.</li></ol><ul><li><em>Object Ownership</em> to ACL disabled.</li><li><em>Bucket versioning</em> as disabled.</li><li><em>Block all public access</em> enabled.</li><li><em>Default encryption</em> as “<em>Server-side encryption with Amazon S3 managed keys (SSE-S3)</em>”.</li></ul><figure><img alt="S3 general configuration" src="https://cdn-images-1.medium.com/max/1024/1*WBzap06kD-3LZJ7qd6nSzg.jpeg" /><figcaption>S3 general configuration</figcaption></figure><blockquote>We will be editing the bucket policy to give access to our CloudFront distribution of getting objects and CodeBuild to push objects to the bucket in a later stage. This is necessary because CloudFront needs permission to fetch static assets, and CodeBuild requires permission to upload the build artifacts to the S3 bucket.</blockquote><blockquote>Configuring access through the bucket policy establishes a controlled and secure environment, ensuring that access to your ReactJS app’s assets is restricted and governed solely by the defined policy.</blockquote><h3>Create and Configure the CloudFront Distribution</h3><p>With your S3 bucket ready, the next step is to set up a CloudFront distribution to optimize content delivery, enhancing the performance and reliability of your ReactJS app by caching content at edge locations globally.</p><p>Using a <a href="https://en.wikipedia.org/wiki/Content_delivery_network">CDN</a> is an easy way to globally distribute static files such that they are geographically near the users when they request to open the site, thus minimizing website load times.</p><ol><li>Navigate to the CloudFront service.</li><li>Click the “<strong>Create Distribution</strong>” button.</li><li>In the Origin Domain select the created s3 bucket arn from the drop-down and the Name of the origin same as Origin Domain.</li><li>Select Origin Access as “<em>Origin access control settings</em>”.</li><li>Click on “<em>Create new OAC</em>”, and create your origin access control with the name as Origin Domain and Origin Type as “<em>S3</em>”.</li></ol><figure><img alt="OAC" src="https://cdn-images-1.medium.com/max/1024/1*jFgLe2ytdaqYm_RATARWaw.jpeg" /><figcaption>Origin Access Control OAC</figcaption></figure><p>6. Select your origin access control as the created OAC. Note via this process your access control is controlled and secured by the CloudFront access policy which we have to attach to our created S3 bucket. This ensures that your ReactJS frontend is restricted and governed solely by the defined bucket policy.</p><figure><img alt="CloudFront Distribution Origin" src="https://cdn-images-1.medium.com/max/903/1*FbFLxShifja2JHfYEHDuMA.jpeg" /><figcaption>CloudFront Distribution Origin</figcaption></figure><p>7. In <strong>Default cache behavior</strong></p><ul><li>Select the Compress objects automatically to “<em>yes</em>”.</li><li>Select Viewer protocol policy to “<em>Redirect HTTP to HTTPS</em>” for secure web access.</li><li>Select Allowed HTTP methods to “<em>GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE</em>” to allow all requests for your ReactJS app.</li><li>Select Cache key and origin requests to “<em>Cache policy and origin request policy</em>” and cache policy to “<em>S3</em>”.</li></ul><figure><img alt="CloudFront cache settings" src="https://cdn-images-1.medium.com/max/747/1*Jo4JHMYZZt5lIQ0P4uP1dw.jpeg" /><figcaption>CloudFront cache configuration.</figcaption></figure><p>8. If you want to add a Web Application Firewall to your CloudFront then in WAF section enable secure protections. Note this can also incur an additional cost to your distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gvn4AaWxG5EO4V8fnSjYgg.jpeg" /><figcaption>CloudFront WAF configurations.</figcaption></figure><p>9. In the <strong>Settings</strong></p><ul><li>Select the price class as “<em>Use North America, Europe, Asia, Middle East, and Africa</em>”. You can set it according to your customer’s geographical locations.</li><li>If you want to use your custom domain then add your alternate domain CNAME. This step is optional if you don’t have your domain and will access using the CloudFront Distribution domain.</li><li>Add your SSL certificate for your domain. This is also an optional step.</li><li>Enable the IPV6 and disable logging.</li></ul><figure><img alt="CloudFront settings configuration." src="https://cdn-images-1.medium.com/max/761/1*23wEE-aF_hos6wsUVNRUVg.jpeg" /><figcaption>CloudFront settings configuration.</figcaption></figure><p>10. Click on the “<strong>Create Distribution</strong>” button. You will be provided with the access control policy of your CloudFront. Copy that we will be using that in the next steps to edit our S3 bucket policies.</p><p>11. Once the distribution is created, you will need to make one modification to the Error page behavior so that the <a href="https://stackoverflow.com/a/52346186">react-router plays well with the site being hosted on CloudFront and S3</a>.</p><ul><li>Open up the newly created Distribution, then open up “Error Pages” tab, and then click “Create custom response”. Set the following properties:</li><li>HTTP error code: <em>403</em></li><li>Customize error message: <em>yes</em></li><li>HTTP Response page path: <em>/index.html</em></li><li>HTTP Response code: <em>200</em></li></ul><p>Once you’ve done the above, you should see something like this:</p><figure><img alt="CloudFront error pages." src="https://cdn-images-1.medium.com/max/1024/1*OaobHlOlDVhxJy-m6VleqA.jpeg" /><figcaption>CloudFront error pages.</figcaption></figure><h3>Setup the CodePipeline and CodeBuild Projects</h3><p>Now that we have our S3 bucket and CloudFront distribution ready, let’s automate the deployment process using AWS CodePipeline and CodeBuild.</p><p>CodePipeline is the top-level orchestration tool that listens for changes to the source repository and then signals CodeBuild to compile the newly committed source artifacts. CodeBuild is a tool that takes as an input a source code artifact and then performs a series of “build” actions that ultimately produce as an output a compiled set of “build artifacts”.</p><ol><li>Open the AWS CodePipeline console, click on “<strong>Create pipeline</strong>”.</li><li>In the pipeline settings provide your pipeline name and service role as “<em>New service role</em>”, the rest keep all default settings and click on “<strong>Next</strong>”.</li></ol><figure><img alt="Pipeline settings" src="https://cdn-images-1.medium.com/max/1024/1*wvMZ_s75ENuuozuyriPxfw.jpeg" /><figcaption>Pipeline settings.</figcaption></figure><p>3. In Source Provider, choose your source code service where the source code for your project is hosted (Generally, we use Bitbucket).</p><p>4. Once selected, you then need to configure the connection properties to that service. Ultimately after the connection is configured, you will need to provide the following pieces of information:</p><ul><li>Repository name of your ReactJS project</li><li>The branch name of your selected repository from where the code will be pulled initially.</li></ul><p>5. In the trigger section you can choose the pull or push event of branch or tags. In this tutorial, I am selecting the push event of the tag “<em>deploy-stack</em>”. Click Next to choose a “<em>Build provider</em>”.</p><figure><img alt="CodePipeline trigger configuration." src="https://cdn-images-1.medium.com/max/832/1*fVKTafbbRW5VZvf8S89Apg.jpeg" /><figcaption>CodePipeline trigger configuration.</figcaption></figure><p>6. In the dropdown box, select “<em>AWS CodeBuild</em>”, then click on “<strong>Create project</strong>”. This will trigger a new pop-up window which will walk you through the process of creating the CodeBuild project before returning you back to the CodePipeline creation wizard.</p><p>7. In the CodeBuild setup wizard, configure</p><ul><li>Project Name: “<em>frontend-deployment</em>”.</li><li>Environment image: “<em>Managed Image</em>”.</li><li>Operating system: “<em>Amazon Linux 2</em>”.</li><li>Compute: “<em>EC2</em>”.</li><li>Runtime(s): “<em>Standard</em>”.</li><li>Image: “<em>aws/codebuild/amazonlinux2-x86_64-standard:4.0</em>”.</li><li>Image version: “<em>always use the latest one</em>”.</li><li>Service Role: “<em>New service role</em>”.</li></ul><figure><img alt="CodeBuild configurations." src="https://cdn-images-1.medium.com/max/587/1*ifHOLsEoru2BWEBDzWmM1A.jpeg" /><figcaption>CodeBuild configurations.</figcaption></figure><ul><li>In Buildspec select “Use a buidspec file”, and provide the filename exactly as the “<em>buildspec.yaml</em> ” of your frontend project. Note we will provide the yaml configuration in later part.</li></ul><figure><img alt="CodeBuild buildspec configurations." src="https://cdn-images-1.medium.com/max/548/1*hus9SXq077lS-sbsiNJ-iQ.jpeg" /><figcaption>CodeBuild buildspec configurations.</figcaption></figure><p>8. At this point, you should be back in the CodePipeline wizard, take note of the ARN of the CodeBuild service role created as part of the CodeBuild project as you will need it later.</p><figure><img alt="CodeBuild configuration." src="https://cdn-images-1.medium.com/max/1024/1*kAM7Seljvg4bpIeCs8snZg.jpeg" /><figcaption>CodeBuild configuration.</figcaption></figure><p>9. Click “<strong>Next</strong>” and then choose “<em>Skip deploy stage</em>” and then “<strong>Finish</strong>” to start the creation of the CodePipeline.</p><blockquote>At this point, the CodePipeline will be created and it will attempt to run a build using the source provider and CodeBuild provider project we specified. This will FAIL, and we will address the necessary adjustments.</blockquote><blockquote>Before we do that, we need to take care of some security housekeeping to give the CodeBuild service role permissions to the S3 directory and to trigger the CloudFront CDN to refresh its contents.</blockquote><blockquote>Also now we will be attaching the access control policy in out created S3 bucket which was copied from our CloudFront creation and we will grant the CodeBuild service role appropriate permissions to access the S3 directory and trigger a CloudFront CDN refresh. Additionally, we will attach a policy to grant putObject access to CodeBuild, allowing it to effectively update and manage the objects in the S3 bucket during the build process.</blockquote><blockquote>This ensures that the ReactJS frontend hosted in the S3 bucket is restricted and governed by the defined policy.</blockquote><h3>Grant the Access Control Policies to the S3 Bucket</h3><p>To address security considerations and enable a successful build within the CodePipeline, we need to grant the necessary access control policies to our S3 bucket.</p><ol><li>Navigate to the S3 service.</li><li>Open the S3 bucket created for your ReactJS app.</li><li>Go to the Permissions tab.</li><li>Click Edit Bucket Policy. We will be attaching CloudFront and CodeBuild Access Control Policy to the S3 Bucket.</li><li>Copy and paste the bucket policy and replace &lt;s3-bucket-arn&gt;, &lt;cloudfront-arn&gt; and &lt;code-build-service-role-arn&gt; with your actual arns value.</li></ol><p>This policy enables CloudFront to fetch objects securely and grants the CodeBuild service role full access to all objects in the specified S3 bucket during the deployment process.</p><pre>{<br>    &quot;Version&quot;: &quot;2008-10-17&quot;,<br>    &quot;Id&quot;: &quot;PolicyForCloudFrontPrivateContent&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;AllowCloudFrontServicePrincipal&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: {<br>                &quot;Service&quot;: &quot;cloudfront.amazonaws.com&quot;<br>            },<br>            &quot;Action&quot;: &quot;s3:GetObject&quot;,<br>            &quot;Resource&quot;: &quot;&lt;s3-bucket-arn&gt;/*&quot;,<br>            &quot;Condition&quot;: {<br>                &quot;StringEquals&quot;: {<br>                    &quot;AWS:SourceArn&quot;: &quot;&lt;cloudfront-arn&gt;&quot;<br>                }<br>            }<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;AllowFullAccessCodeBuildServiceRole&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: {<br>                &quot;AWS&quot;: &quot;&lt;code-build-service-role-arn&gt;&quot;<br>            },<br>            &quot;Action&quot;: &quot;*&quot;,<br>            &quot;Resource&quot;: &quot;&lt;s3-bucket-arn&gt;/*&quot;<br>        }<br>    ]<br>}</pre><h3>Grant the CodeBuild Service Role Permissions to the CloudFront CDN</h3><p>To facilitate a seamless deployment, it’s crucial to grant the CodeBuild service role the necessary permissions for creating an “<a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html"><em>invalidation</em></a>” against the CloudFront distribution established for your web app. An ‘invalidation’ serves as a directive to CloudFront, triggering a refresh of its contents from the S3 bucket and pushing those changes to all regional CDN endpoints.</p><ol><li>Open the IAM console and create a new Policy with the following JSON by replacing &lt;cloudfront-arn&gt; with your created CloudFront arn.</li><li>Click Review policy, provide a unique name and description, and then click “<strong>Create policy</strong>”.</li></ol><pre>{<br> &quot;Version&quot;: &quot;2012-10-17&quot;,<br> &quot;Statement&quot;: [<br>  {<br>   &quot;Sid&quot;: &quot;AllowCloudFrontInvalidation&quot;,<br>   &quot;Effect&quot;: &quot;Allow&quot;,<br>   &quot;Action&quot;: &quot;cloudfront:CreateInvalidation&quot;,<br>   &quot;Resource&quot;: [<br>    &quot;&lt;cloudfront-arn&gt;&quot;<br>   ]<br>  }<br> ]<br>}</pre><p>2. Attach the Policy to CodeBuild Service Role:</p><ul><li>In the IAM console, navigate to Roles, locate and click on the CodeBuild service role associated with your project.</li><li>Under the Permissions tab, click Add Permissions.</li><li>Attach the policy you just created in the previous step.</li></ul><blockquote>At this point, our CodeBuild service role now has all the permissions it needs to deploy the ReactJS web app, including the ability to create invalidations against the CloudFront distribution.</blockquote><h3>Configure the CodeBuild “buildspec.yaml” for the ReactJS Project</h3><p>To ensure the CodeBuild project accurately builds and deploys your ReactJS web app, it’s essential to configure the “buildspec” file. This file contains the build instructions and commands that CodeBuild will execute during the build process.</p><p>The buildspec defines the shell commands that need to be run during various phases of compilation in YAML format.</p><ol><li>Open your ReactJS app’s source code repository.</li><li>Create a new file named “buildspec.yml” in the root directory, or locate the existing file if it already exists. Note the filename should match as the filename provide in Buildspec configuration while creating our CodeBuild project.</li><li>Copy and paste the yaml configuration replacing &lt;build-folder&gt;, &lt;s3-bucket-name&gt; and &lt;cloudfront-distribution-id&gt; with your react project build folder name, your created S3 bucket name and CloudFront Distribution id.</li></ol><pre>version: 0.2<br><br>phases:<br>  install:<br>    runtime-versions:<br>      nodejs: 16<br>  pre_build:<br>    commands:<br>      - echo Installing source NPM dependencies<br>      - npm install<br>  build:<br>    commands:<br>      - echo Build started<br>      - npm run build<br>  post_build:<br>    commands:<br>      - ls -R ./dist<br>      - aws s3 cp --recursive ./&lt;build-folder&gt; s3://&lt;s3-bucket-name&gt;/<br>      - aws s3 cp --cache-control=&quot;max-age=0, no-cache, no-store, must-revalidate&quot; ./&lt;build-folder&gt;/index.html s3://&lt;s3-bucket-name&gt;/<br>      - aws cloudfront create-invalidation --distribution-id &lt;cloudfront-distribution-id&gt; --paths /index.html<br>artifacts:<br>  files:<br>    - &#39;&lt;build-folder&gt;/*&#39;<br>    - &#39;&lt;build-folder&gt;/**/*&#39;</pre><p>The above YAML file is pretty straightforward.</p><ol><li>Node.js Version: Specified Node.js version is 16.</li><li>In the pre_build phase, we install all of the dependencies.</li><li>In the build stage, we execute the NPM run script to compile and package the web app into the build folder.</li><li>In the post_build phase, we do 3 things:</li></ol><ul><li>ls -R ./&lt;build-folder&gt;: Displays the contents of the &#39;&lt;build-folder&gt;&#39; directory, aiding in debugging and verification.</li><li>aws s3 cp: Copies build artifacts to the specified S3 bucket, facilitating seamless deployment.</li><li>aws s3 cp --cache-control: Sets cache control for the HTML file, ensuring proper caching behavior.</li><li>aws cloudfront create-invalidation: Creates a CloudFront invalidation for the updated HTML file, ensuring swift content refresh to all it’s CDN endpoints.</li></ul><blockquote>Push the buildspec.yaml file with a tag “deploy-stack” to initiates the CodePipeline. Note the tag name must match with the name you provided during creation of CodePipeline trigger.</blockquote><blockquote>This time you should see the Build phase succeed!</blockquote><blockquote>At this point we now have a fully automated build pipeline to deploy a ReactJS web app to a S3 bucket with a CloudFront CDN.</blockquote><blockquote>To test that the web app is deployed properly, locate the URL in the “<em>Distribution domain name</em>” of your CloudFront distribution and plug that into your browser…and voila, you should see your app!</blockquote><h3>Attach Domain to the CloudFront Distribution using Route53 (Optional)</h3><p>The final touch to your ReactJS app’s AWS setup involves associating your custom domain with the CloudFront Distribution. This step ensures a seamless and branded experience for your users when accessing your application.</p><p>This is the same domain you entered as the Alternate Domain Names when setting up the CloudFront Distribution.</p><ol><li>Open the Route 53 console and perform the following steps.</li><li>Click “<strong>Create Hosted Zone</strong>” and enter the domain name you wish to associate with CloudFront.</li></ol><figure><img alt="Route53 hosted zone configurations." src="https://cdn-images-1.medium.com/max/1024/1*HHImQdU-a7Kq3lBeolpH3Q.jpeg" /><figcaption>Route53 hosted zone configurations.</figcaption></figure><p>3. Once created, you’ll receive a set of nameservers with this Hosted Zone. Add these nameservers to your domain account through your domain provider.</p><figure><img alt="Route53 records." src="https://cdn-images-1.medium.com/max/1024/1*-2VmrGyFmgIqWnaG0qlX_A.jpeg" /><figcaption>Route53 records.</figcaption></figure><p>4. Create a record set by clicking “<strong>Create Record Set</strong>” in the top-right corner.</p><p>5. Enter a name for the record set and select “<em>A — IPv4 address</em>” from the Type drop-down menu. Enter the CloudFront distribution’s domain name in the “<em>Value</em>” field and click “<strong>Create</strong>” to establish the record set.</p><figure><img alt="CloudFront record." src="https://cdn-images-1.medium.com/max/1024/1*TGTABpV1Y3vGhGWtGu3hzw.jpeg" /><figcaption>CloudFront record.</figcaption></figure><p>6. If you haven&#39;t associated your domain to the “<em>Alternate Domain Names</em>” section while creating CloudFront then update the field with the domain.</p><p>7. Click the “<strong>Create Record Set</strong>” button again. Enter the same domain name as before and select “<em>CNAME — Canonical name</em>” from the Type drop-down menu. Enter the CloudFront distribution’s domain name in the “<em>Value</em>” field. Click “<strong>Create</strong>” to generate the second record set.</p><p>8. Voila.. Your domain is now successfully associated with CloudFront.</p><h3>Summary</h3><p>In this article, we navigated the journey of deploying a ReactJS app on AWS, leveraging services like S3, CloudFront, and Route 53. From configuring a robust CI/CD pipeline with CodePipeline and CodeBuild to seamlessly attaching custom domains, every step was meticulously covered.</p><p>Whether you’re a beginner AWS engineer or seasoned developer, this tutorial ensures a smooth and automated deployment process, combining efficiency, scalability, and the latest cloud technologies.</p><p>Elevate your AWS projects to new heights with this ultimate deployment success blueprint.</p><blockquote>#Sab Asan Hai<br>By Nirmalya Saha</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c4530564335" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>