Friday, 4 December 2026

Deploy a .NET Docker Application to AWS ECS Fargate Using Docker Hub (Without Amazon ECR)

 Introduction

Containerization has become one of the most popular approaches for deploying modern applications. Docker allows developers to package an application along with its dependencies into a portable container image, making it easier to deploy across different environments.

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that makes it easy to run, manage, and scale containerized applications on AWS.

In this article, we will learn how to deploy a .NET application to AWS ECS using AWS Fargate and a Docker Hub image, without pushing the image to Amazon Elastic Container Registry (ECR).

Typically, AWS ECS deployments use Amazon ECR to store Docker images. However, ECS also supports pulling container images directly from public and private Docker Hub repositories.

We will use Docker Hub as our container image repository and AWS Fargate to run the application without managing EC2 instances.

What Are We Going to Build?

  1. Create a Docker image of a .NET application.
  2. Push the Docker image to Docker Hub.
  3. Create an Amazon ECS cluster.
  4. Create an ECS task definition using the Docker Hub image URL.
  5. Configure AWS Fargate as the launch type.
  6. Create an ECS service.
  7. Deploy and run the .NET application on AWS.
  8. Verify that the application is running successfully.

Step 1: Create a Docker Image of the .NET Application

First, we need to containerize our .NET application using Docker.

Navigate to your .NET application directory and create a file named Dockerfile.

For this example, we will use a multi-stage Docker build.


Docker File  # Build stage FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src # Copy project files COPY . . # Restore dependencies RUN dotnet restore # Publish application RUN dotnet publish -c Release -o /app/publish # Runtime stage FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS final WORKDIR /app COPY --from=build /app/publish . EXPOSE 8080 ENTRYPOINT ["dotnet", "YourApplication.dll"]    Note: Replace YourApplication.dll with the actual DLL name of your .NET application. The Docker SDK and runtime versions should match your application's target framework. Adjust the build commands if your solution contains multiple projects.


Build the Docker Image

Open a terminal in the application directory and execute:  
docker build -t sunnys-dotnet-app:latest . 

Step 2: Push the Docker Image to Docker Hub

Your Docker image URL will look like this:

docker.io/YOUR_DOCKERHUB_USERNAME/sunnys-dotnet-app:latest

Important: For production deployments, prefer a versioned image tag instead of relying only on latest. Also ensure that the image architecture is compatible with your selected Fargate CPU architecture. 

Step 3: Create an Amazon ECS Cluster

Now let's create an ECS cluster where our .NET application will run.

  1. Log in to the AWS Management Console.
  2. Search for Amazon Elastic Container Service (ECS).
  3. Navigate to the Clusters section.
  4. Click Create cluster.
  5. Enter a cluster name.

For this example, we will use:
 

sunnys-cluster

     

    1. Select the appropriate infrastructure configuration for AWS Fargate.
    2. Configure any additional monitoring or settings required.
    3. Click Create. 

    Once the cluster is created, it will be available in the ECS Clusters list.










    What is an ECS Cluster?

    An ECS cluster is a logical grouping of tasks and services. It provides an environment in which containerized applications can run.

    Since we are using AWS Fargate, we do not need to provision or manage EC2 instances.

     

    Step 4: Create an ECS Task Definition Using the Docker Hub Image

    An ECS task definition is a blueprint that describes how our container should run.

    It contains information such as:

    • Docker image URL.
    • CPU and memory requirements.
    • Container port mappings.
    • Environment variables.
    • IAM roles.
    • Logging configuration.
    • Network requirements.

    Let's create a task definition.

    4.1 Navigate to Task Definitions

    1. Open Amazon ECS.
    2. Select Task definitions from the left navigation.
    3. Click Create new task definition.
    4. Enter the task definition family name.

    For example:  

    sunnys-task-definition 





      





    4.2 Configure Infrastructure Requirements

    Select: 

    Launch type: AWS Fargate

    Choose the required CPU and memory configuration.

    For this example, we can start with:

    CPU: 0.25 vCPU
    Memory: 0.5 GB


    These are example values and should be adjusted according to your application's resource requirements.

    4.3 Configure the Container

    Under the container configuration, provide the following details:

    ConfigurationValue
    Container namesunnys-dotnet-container
    Image URIYOUR_DOCKERHUB_USERNAME/sunnys-dotnet-app:latest
    Container port8080
    ProtocolTCP
    Essential containerYes

    The most important configuration is the Image URI.

    Instead of using an Amazon ECR image URL, we will directly provide the Docker Hub image URL.

    For example:

    docker.io/YOUR_DOCKERHUB_USERNAME/sunnys-dotnet-app:latest
    

     This allows ECS to pull the image directly from Docker Hub.

    4.4 Create the Task Definition

    Review all the configurations and click Create.

    Our ECS task definition is now ready.



    Step 5: Configure AWS Fargate as the Launch Type

    AWS Fargate is a serverless compute engine for containers that works with Amazon ECS.

    It eliminates the need to provision, configure, patch, and maintain EC2 instances.

    For our deployment, we will use Fargate as the compute infrastructure.

    The important configurations are:  

    Launch type: FARGATE
    Network mode: awsvpc
    Operating system: Linux
    CPU architecture: X86_64

     The selected CPU architecture must match the architecture of the Docker image.

    With Fargate, AWS manages the underlying infrastructure, while we focus on deploying and managing our application.

    Step 6: Create an ECS Service

    An ECS service helps maintain the desired number of running tasks in an ECS cluster.

    For example, if we configure a service with two desired tasks, ECS attempts to maintain two running instances of our application.

    Let's create the service.

    6.1 Navigate to the ECS Cluster

    1. Open Amazon ECS.
    2. Select Clusters.
    3. Open the cluster we created earlier.  
      sunnys-cluster
      
         
      1. Navigate to the Services tab.
      2. Click Create.

        6.2 Configure Service Details

        Provide the following configuration:

        ConfigurationValue
        Compute optionsLaunch type
        Launch typeFARGATE
        Application typeService
        Task definition familysunnys-task-definition
        Service namesunnys-task-definition-service
        Desired tasks2

        Select the latest revision of your task definition.








      Step 7: Deploy and Run the .NET Application on AWS

      Once the ECS service is created, AWS Fargate starts provisioning the required infrastructure and launching the containers.

      The deployment process includes:

      1. ECS schedules the required tasks.
      2. Fargate provisions the compute resources.
      3. The container image is pulled from Docker Hub.
      4. The container is started.
      5. The .NET application starts running inside the container.
      6. ECS monitors the task health and maintains the desired number of tasks.

      Step 8: Verify the Deployment

      After the service deployment is complete, verify that the .NET application is running successfully.

      8.1 Check ECS Cluster Status

      Open your ECS cluster and check the cluster overview.

      You should be able to see:

      • Cluster status.
      • Active services.
      • Running tasks.
      • Pending tasks.

      8.2 Check ECS Service Status

      Navigate to the Services tab.

      Verify that the service status is Active

      8.3 Check Running Tasks

      Open the Tasks tab and verify that the desired tasks are running.

      You can also inspect the container details and application logs.

      8.4 Access the Application

      If you configured a public IP or Application Load Balancer, access the application using the corresponding public endpoint.


      Make sure the endpoint, listener, target group, and security group configurations match your application.

      Step 9: Verify the Deployment in the AWS Console

      After completing the deployment, we can verify the ECS cluster and service from the AWS Management Console.

      In our deployment, the ECS cluster is named: 

      sunnys-cluster

       The cluster overview shows:

      • Cluster status: Active
      • Services: 1 active, 0 draining
      • Tasks: 2 running, 0 pending
      • Infrastructure: AWS Fargate

      The Services tab also displays our deployed ECS service with an Active status.

      This confirms that the ECS service has been created and the two desired tasks are running.

      Tuesday, 24 November 2026

      How to Manage 20+ Excel Worksheets Easily Using an Automatic Sheet Index (VBA)

       Introduction

      Have you ever worked with an Excel workbook containing 30, 50, or even 100+ worksheets? Navigating between worksheets can become frustrating, especially when you have to scroll horizontally through numerous sheet tabs to find the worksheet you need.

      Excel provides basic sheet navigation options, but managing a large number of worksheets can still be time-consuming.

      Fortunately, there is a simple solution: Create an automatic Sheet Index using VBA (Visual Basic for Applications).

      With this approach, you can create a separate INDEX sheet containing all worksheet names, along with clickable hyperlinks. You can also add a Refresh button to update the list whenever worksheets are added, deleted, or renamed.

      Let's understand how to do it step by step.

      1. What Is an Excel Sheet Index?

      An Excel Sheet Index is a dedicated worksheet that contains a list of all worksheets available in your workbook.

      Instead of scrolling through multiple sheet tabs, you can simply open the INDEX sheet and click the worksheet name you want to access.

      For example:

      S.No.Sheet Name
      1January
      2February
      3March
      4April
      5Sales
      6Purchase
      7Summary

      Each sheet name acts as a hyperlink, allowing you to navigate directly to the respective worksheet.

      2. How to Create an Automatic Sheet Index Using VBA

      Follow these steps to create your automatic Sheet Index.

      Step 1: Open the VBA Editor

      1. Open your Excel workbook.
      2. Press Alt + F11.
      3. In the VBA Editor, click Insert → Module.
      4. A new module will be created.

      Step 2: Insert the VBA Code

      Copy and paste the following VBA code into the module.

      Sub CreateSheetIndex()
      
          Dim ws As Worksheet
          Dim indexWs As Worksheet
          Dim rowNum As Long
      
          'Check if INDEX sheet exists
          On Error Resume Next
          Set indexWs = ThisWorkbook.Worksheets("INDEX")
          On Error GoTo 0
      
          'Create INDEX sheet if it does not exist
          If indexWs Is Nothing Then
              Set indexWs = ThisWorkbook.Worksheets.Add
              indexWs.Name = "INDEX"
          End If
      
          'Clear existing contents
          indexWs.Cells.Clear
      
          'Add heading
          indexWs.Range("A1").Value = "WORKBOOK SHEET INDEX"
          indexWs.Range("A1").Font.Bold = True
          indexWs.Range("A1").Font.Size = 16
      
          indexWs.Range("A3").Value = "S.No."
          indexWs.Range("B3").Value = "Sheet Name"
      
          indexWs.Range("A3:B3").Font.Bold = True
      
          rowNum = 4
      
          'List all sheets except INDEX
          For Each ws In ThisWorkbook.Worksheets
      
              If ws.Name <> "INDEX" Then
      
                  indexWs.Cells(rowNum, 1).Value = rowNum - 3
      
                  indexWs.Hyperlinks.Add _
                      Anchor:=indexWs.Cells(rowNum, 2), _
                      Address:="", _
                      SubAddress:="'" & ws.Name & "'!A1", _
                      TextToDisplay:=ws.Name
      
                  rowNum = rowNum + 1
      
              End If
      
          Next ws
      
          'Apply formatting
          With indexWs
              .Columns("A:B").AutoFit
              .Range("A3:B" & rowNum - 1).Borders.LineStyle = xlContinuous
              .Activate
              .Range("A1").Select
          End With
      
          MsgBox "Sheet Index Created Successfully!", vbInformation
      
      End Sub



      Step 3: Run the VBA Macro

      1. Return to Excel.
      2. Press Alt + F8.
      3. Select CreateSheetIndex.
      4. Click Run.

      Excel will automatically create a new worksheet named INDEX (if it does not already exist) and populate it with all worksheet names and clickable hyperlinks.

      3. How to Add a Refresh Button to the INDEX Sheet

      Creating the Sheet Index is useful, but what happens when you add new worksheets or rename existing ones?

      You don't need to manually update the INDEX sheet. You can simply add a Refresh button and assign the existing VBA macro to it.

      Follow these steps:

      Step 1: Enable the Developer Tab

      If the Developer tab is not visible:

      1. Go to File → Options.
      2. Select Customize Ribbon.
      3. Tick the Developer checkbox.
      4. Click OK.

      Step 2: Insert a Button

      1. Open the INDEX worksheet.
      2. Click the Developer tab.
      3. Select Insert.
      4. Under Form Controls, select Button.
      5. Draw the button anywhere on your INDEX sheet.

      Step 3: Assign the Macro

      Excel will display the Assign Macro window.

      1. Select CreateSheetIndex.
      2. Click OK.

      Step 4: Rename the Button

      Right-click the button, select Edit Text, and change its name to:

      REFRESH SHEET INDEX

      Now your button is ready!

      4. How Does the Refresh Button Work?

      Let's understand with a simple example.

      Suppose your workbook initially contains 30 worksheets.

      • Run the macro to create the INDEX sheet.
      • Later, add five new worksheets.
      • Open the INDEX sheet.
      • Click the REFRESH SHEET INDEX button.

      The macro will automatically rebuild the list and include all 35 worksheets.

      Similarly, if you rename or delete a worksheet, clicking Refresh will update the index.

      5. Important: Save Your Workbook in the Correct Format

      One important point to remember is that Excel's .xlsx format does not support saving VBA macros.

      To retain your macro and Refresh button functionality:

      1. Click File → Save As.
      2. Select Excel Macro-Enabled Workbook.
      3. Choose the .xlsm file format.
      4. Save your workbook.

      If you want to continue using .xlsx, you can run the macro once and save the resulting INDEX sheet with its hyperlinks. The macro itself, however, will not be retained in the .xlsx file.







      6. Benefits of Using an Automatic Sheet Index

      This simple VBA solution offers several advantages:

      • Easy Navigation: Access any worksheet with a single click.
      • Time Saving: No need to scroll through dozens of worksheet tabs.
      • Automatic Updates: Refresh the list whenever worksheet names or sheets change.
      • Better Organization: Maintain a centralized list of all worksheets.
      • Improved Productivity: Particularly useful for large Excel workbooks containing monthly reports, sales data, financial records, or departmental information.

      Conclusion

      Managing multiple worksheets in Excel doesn't have to be difficult. By creating an automatic Sheet Index with clickable hyperlinks and a Refresh button, you can make worksheet navigation much faster and easier.

      If you regularly work with Excel files containing 30+ worksheets, this small VBA automation can save time and improve your overall workflow.

      Try it in your next Excel workbook and make worksheet navigation simpler!

      Deploy a .NET Docker Application to AWS ECS Fargate Using Docker Hub (Without Amazon ECR)

       Introduction Containerization has become one of the most popular approaches for deploying modern applications. Docker allows developers to ...