Lecture Notes: Docker and VMs in Microservices Architecture
Key Concepts
- Bridge Network: Non-routed network within which containers communicate using the host's resources.
- VMware and Hyper-V: Analogy drawn with Docker's resource utilization, where VMs use the host's resources similarly to Docker containers.
Virtualization vs Containerization
Virtual Machines (VMs)
- Host Machine: Physical server with its own OS.
- Hyper-V: Installed on host to enable virtualization.
- Multiple VMs: Each with its own OS, utilizing the host's resources.
- Use Case: Amazon EC2 instances at AWS data centers.
Docker Containers
- No Separate OS: Containers do not have their own OS, unlike VMs.
- Docker Technology: Installed on the OS of the host machine.
- Resource Sharing: Containers share CPU, memory, and network of the host machine.
- Interactivity: Containers run as processes, and interactive login is via terminal attachment, not direct like VMs.
ECS - Elastic Container Service
Overview
- Managed Orchestration: AWS service for deploying, managing, and scaling container workloads.
- Comparison: Alternatives include Docker Swarm and Kubernetes.
Core Concepts
- ECS Cluster: Collection of servers or resources for running workloads.
- Compute Clusters: Can be of two types - EC2 type clusters and Fargate clusters.
- Fargate: Serverless compute engine for running containers without provisioning EC2 instances.
ECS Services
Task Definitions
- JSON File: Defines application configuration, including CPU, memory, Docker image, ports, and dependencies.
- Creating Tasks: Tasks are running instances of applications, based on task definitions.
Services and Scalability
- ECS Service: Higher-level abstraction to manage multiple tasks.
- Scalability: Services allow for easier scaling and management, including load balancing and autoscaling.
Additional Concepts
- Auto Scaling: Service auto-scaling to handle increased load by adding more tasks.
- Availability Zone Rebalancing: Ensures tasks are distributed across availability zones to enhance fault tolerance.
- Rolling Updates: Updating application versions within a service without downtime.
Practical Demonstration
Task and Service Creation
- Task Creation: Demonstrated using AWS Console.
- Service Creation: Highlighted the setup of tasks in a service, enabling load balancing and autoscaling.
Cleanup
- Resource Management: Instructions for deleting tasks, services, and clusters to avoid unnecessary costs.
These notes summarize the key concepts covered in the lecture, focusing on Docker, container orchestration, and AWS ECS implementation. Understanding these principles is vital in deploying and managing scalable microservices applications efficiently.