IITP · Semester ISummaries · Quizzes · Assignments

Lecture summary

FCS 26 Sep

26 Sep 20262h 03m3 parts

Source: IITP-big-files\Sem-1\ECS5102-FCS\Lectures\2026-09-26 0000 FCS 26 Sep\summary\notes.md

Overview

This class was a practical deployment session focused on deploying a three-tier, containerized web application (AWS Order Fulfillment) to AWS using Elastic Container Service (ECS). It covered the end-to-end process from examining the application code and infrastructure-as-code scripts to executing an automated deployment, verifying resources in the AWS console, and testing the live application. The session concluded with log analysis using AWS CloudWatch to trace requests and a discussion on container portability and cloud-agnostic deployment. This practical demonstration connects the course's software concepts (processes, containers) to real-world system deployment and management.

Learning outcomes

  • Deploy a multi-service, containerized application to a cloud provider using infrastructure scripts.
  • Verify the deployment by checking cloud resources (VPC, ECS cluster, load balancer, database) and testing application functionality.
  • Use CloudWatch Logs to trace a request's journey through the system and analyze its performance.
  • Explain the cross-cloud portability of containerized applications and the steps to migrate a deployment from AWS to Azure.

Core concepts

Segregation and Aggregation

A thinking tool where you first list items individually (segregation) and then group them based on common characteristics (aggregation). This methodology was applied to understand system components (e.g., separating hardware, software, and network concepts).

Three-Tier Containerized Application

An application architecture with distinct frontend, backend, and database components, each packaged into Docker containers. This modular design enables independent scaling, deployment, and management of each tier.

Automated Cloud Deployment

The process of using scripts (like deploy.sh) to automatically provision and configure cloud resources (compute, networking, storage) and deploy application code, eliminating manual steps and ensuring consistency.

Observability with CloudWatch Logs

Using centralized logging (AWS CloudWatch) to collect, search, and analyze logs from distributed application components. This is critical for debugging, performance monitoring, and tracing requests across microservices.

Cross-Cloud Portability

The principle that containerized applications, by packaging dependencies, can run on any cloud provider's container orchestration service (e.g., AWS ECS, Azure Container Instances) with changes primarily to the deployment scripts and service commands.

Formulas and maths

(Not covered in this session)

Worked examples

1. Directory and File Structure Examination

  • Project Root: aws-order-tracing-demo
  • Subdirectories: infra/, backend/, frontend/, queries/, trainer/, and a README.
  • Key Files:
    • infra/config.env: Shell script setting environment variables (e.g., export AWS_REGION=ap-south-1).
    • infra/deploy.sh: Bash shell script automating the deployment.
    • frontend/Dockerfile: Uses base image nginx:1.27-alpine, copies nginx.conf and index.html.
    • backend/Dockerfile: Defines a Python application (details not fully shown).
    • backend/requirements.txt: Listed dependencies: Flask and Boto3.
    • backend/app.py: Exposed endpoints: /health and /api/orders.

2. Deployment and Verification Steps

  1. Pre-deployment Check: Verified AWS CLI configuration using aws sts get-caller-identity. Used the root user for the demo to bypass IAM permission issues.
  2. Execution: Ran deployment script: ./infra/deploy.sh.
  3. Verification in AWS Console:
    • Confirmed VPC, ECS cluster, and services were created.
    • Observed EC2 instances started on demand by ECS.
    • Located the Application Load Balancer (ALB) URL.
    • Verified DynamoDB table creation: aws-order-tracing-demo-orders.
  4. Application Test: Submitted an order via the ALB URL. Received HTTP status 201 (success) with a response time of 5 milliseconds.

3. CloudWatch Log Analysis

  • Query: Searched the backend log group for a specific request_id over the last 30 minutes, yielding 5 matches.
  • Analysis of a Request Log:
    • Method: POST
    • URL: /api/orders
    • Status: 201
    • Total Duration: 2531 (interpreted as 25 milliseconds).
    • Outcome: Database write successful.
  • Database Verification: Confirmed four items in the DynamoDB table, matching four logged transactions.
  • Health Check Observation: Noted Python URL library health checks occurring every 5 seconds (127.0.0.1).

Questions asked in class

Q: A student pointed out a duplicate option in an assignment question (Question 5). A: The instructor will check the question and consider scoring based on 9 questions or possibly giving a grace mark to all students.

Q: Student asked about the quality of assignment questions. A (from student chat): The questions were found to be practical and situation-based, which was a good approach.

Q: Asked about types of load balancers in Azure and the difference between L4 and L8. A: Briefly acknowledged; the answer was provided in the session.

Q (Suraj): What are the prerequisites for running the demo locally? A: An AWS account with billing enabled is required. Connection is via AWS CLI configured on the local system with credentials.

Q (Varun Agarwal): About the ARN and root in aws sts get-caller-identity output. A: The ARN shows the authenticated identity. The root user is the default administrative user for the AWS account. It was used in the demo to avoid IAM permission issues but is not recommended for regular use.

Q (Varun Agarwal): How to manage config.env for multiple environments (dev, test, etc.)? A: You can create separate environment files for each, or use a single file with sections demarcated by square brackets (e.g., [development], [testing]), and have the script reference the appropriate section.

Q (Varun Agarwal): Where are container images stored during deployment? A: Images are not stored locally as a repository. The script builds images and pushes them to Amazon ECR (Elastic Container Registry), AWS's managed container registry, from which ECS pulls them.

Q: Can the same Dockerfile/script used in AWS be run successfully in Azure? A: Yes, 100%. You would need to install the Azure CLI, configure it, and change the deployment shell script commands from AWS to Azure commands. Azure provides analogous services.

Q: Where are the container resources deployed? Can we see them? A: They are running in an ECS cluster. You can view them in the ECS console under the specific cluster, which shows services (backend, frontend) and running tasks.

Q: Would this work with a Windows web server (e.g., IIS) instead of Nginx? A: Yes. The container would package the Windows web server executable. Containerization allows the same packaged application to run on AWS, Azure, Windows, or Linux hosts.

Q: What is the difference between ECS and EKS? A: ECS is AWS's older, proprietary container orchestration service. EKS is AWS's managed Kubernetes service, based on the open-source Kubernetes code. Both run Docker containers, but EKS uses Kubernetes concepts (pods, namespaces).

Q: If deployed on EKS, would containers be visible in the ECS UI? A: No. ECS and EKS are separate services. Containers run in EKS are managed and viewed only within the EKS service/console.

Q: How is authentication handled between frontend and backend microservices? A: The frontend is not directly exposed. Only the Application Load Balancer (ALB) is public. The ALB, residing within the same secured network, is the only entity allowed to communicate with the cluster. Requests via the ALB are considered authenticated for internal routing.

Q: In the CloudWatch logs, the backend health check was on 127.0.0.1 (localhost), but other logs had 172.31.* private IPs. Does this mean frontend and backend always run on the same VM? A: No. The 127.0.0.1 address is for local health checks within a container/VM. The 172.31.* addresses are private IPs used for actual communication. Container placement on VMs is managed by ECS.

Q: What is the difference between MySQL, MSSQL, and DynamoDB? A: MySQL and Microsoft SQL Server (MSSQL) are relational database management systems (RDBMS). DynamoDB is a NoSQL database service.

Key takeaways

  • Automated deployment scripts (deploy.sh) build Docker images, push them to ECR, and provision all necessary AWS resources (VPC, ECS, ALB, DynamoDB).
  • The root AWS user simplifies demos but violates security best practices; IAM roles should be used in production.
  • Container images are stored in Amazon ECR, a managed container registry, not locally.
  • Successful deployment is verified by checking HTTP status codes (e.g., 201 for creation), response times (e.g., 5 ms), and persisted data in DynamoDB.
  • CloudWatch Logs enable tracing a request by its request_id across log groups to analyze performance and confirm successful execution at each tier.
  • Containerized applications are inherently portable; migrating from AWS to Azure requires changing CLI tools and deployment script commands, not the application containers.
  • ECS is AWS's proprietary orchestration service, while EKS is its managed Kubernetes offering; they are separate and have different management consoles.
  • In a microservices architecture deployed behind an ALB, the load balancer acts as the single public entry point, and internal service-to-service communication is considered trusted within the secured network perimeter.
  • Health checks (127.0.0.1) are internal to a container/instance, while service communication uses private IP addresses (172.31.*); these can be on different physical hosts.
  • DynamoDB operations: Scan reads all items, while Query finds items based on primary key values.

Exam-style questions

  1. Describe the steps an automated deployment script (deploy.sh) must perform to deploy a containerized frontend/backend application to AWS ECS.

    • Answer Outline: Build Docker images for each service; push images to Amazon ECR; create an ECS cluster; register ECR images as task definitions; create ECS services for frontend and backend; provision an Application Load Balancer (ALB) with target groups; configure ALB listeners and routing rules; create necessary IAM roles and security groups; optionally provision a database (e.g., DynamoDB table).
  2. You see a CloudWatch log entry showing a POST request to /api/orders returning status 201 with a duration of 2531. Interpret this log. What would you check next to confirm the request was fully processed?

    • Answer Outline: The log indicates a successful order creation (HTTP 201) that took approximately 25 milliseconds. To confirm full processing, you would: 1) Check the DynamoDB aws-order-tracing-demo-orders table for a new item with a matching request_id. 2) Verify there are no corresponding error logs in the backend or database log groups. 3) Confirm the frontend log group shows a successful response returned to the ALB.
  3. A team wants to migrate the deployed application from AWS ECS to Azure. What changes are required to the deployment process, and what remains the same?

    • Answer Outline: Changes: Replace AWS CLI with Azure CLI; rewrite the deployment script to use Azure-specific commands (e.g., az container create, az appservice); use Azure Container Registry instead of ECR; provision Azure analogues for ALB (Azure Load Balancer or Application Gateway) and DynamoDB (Azure Cosmos DB or SQL Database). Remains the same: The application's Dockerfiles, source code, and the three-tier architecture. The container images themselves are portable.

Glossary

  • Aggregation - The step of grouping segregated items based on common characteristics.
  • ALB (Application Load Balancer) - An AWS load balancer that operates at the application layer (Layer 7).
  • AWS ECS (Elastic Container Service) - AWS service for running containerized applications without managing Kubernetes.
  • Containerized application - An application packaged with its dependencies into a container (using Docker).
  • DynamoDB - AWS NoSQL database service.
  • ECR (Elastic Container Registry) - AWS service for storing Docker container images.
  • IAM role - AWS Identity and Access Management role defining permissions.
  • Ingress - Incoming network traffic.
  • Log group - A collection of log streams in AWS CloudWatch Logs.
  • Segregation - The first step in a thinking process where you list or separate items/concepts individually.
  • Target group - A group of targets (e.g., EC2 instances, containers) for a load balancer.
  • Task definition (ECS) - A blueprint that describes how a Docker container should run in ECS.
  • Three-tier application - An application with front-end, back-end, and database components.
  • Trust policy (IAM) - A JSON policy document that defines which principals can assume an IAM role.
  • VPC (Virtual Private Cloud) - An isolated virtual network in AWS.

Follow-ups

  • The detailed content of the backend/Dockerfile and requirements.txt was not fully shown.
  • The exact JSON policy templates (trust-policy.json, backend-task-policy.json) were not examined.
  • The process for tracing a request "from URL to database" across multiple log groups (frontend, backend, database) in CloudWatch was mentioned but only backend logs were shown; this is planned for a future session.
  • The distinction between hardware/software boundaries (e.g., virtual machine, sandbox) mentioned during the segregation/aggregation example was flagged for later discussion.
  • A new combined AWS CloudWatch service integrating Log Insights, Trial, and Contributor Insights with AI-assisted query writing was mentioned but its name was [unclear].
  • Configuring multi-region image repositories in Amazon ECR for high availability and disaster recovery was noted as a best practice but not demonstrated.