4.1.6.1. Create and Configure ACI
4.1.6.1. Create and Configure ACI
💡 First Principle: Azure Container Instances (ACI) provides the fastest and simplest way to run a container in Azure, fundamentally abstracting away all server management and orchestration to enable rapid, serverless container execution.
Scenario: You need to quickly deploy a small, event-driven microservice packaged as a Docker container. It processes incoming messages and performs a short computation. You want to deploy it as fast as possible without managing any VMs.
What It Is: ACI is a fully managed, serverless PaaS (Platform as a Service) offering for running individual containers.
Purpose:
- ACI enables you to launch containers directly, ideal for single-container apps, batch jobs, or event-driven workloads.
Key Benefits:
- Serverless: No VM provisioning or patching.
- Fast Startup: Containers can be running in seconds.
- Per-second Billing: Pay only for the resources (CPU, memory) your containers use.
- Customizable: Choose CPU, memory, and GPU resources.
High-Level Steps to Create an ACI Container Group:
- Specify resource group and container name.
- Select container image (from Docker Hub, Azure Container Registry - ACR, etc.).
- Configure resources: set CPU, memory, and OS type.
- Define networking: assign a public IP or integrate with a VNet.
- Set restart policy (e.g., Always, OnFailure, Never).
Visual: Azure Container Instances (ACI) Simple Deployment
Resizing a Running Container Group
CPU and memory are requested when a container group is created. You can update a running group by redeploying it with the same name and at least one changed property, such as the image or the DNS name label; every container in the group then restarts in place. Some properties can't be updated that way, and a group must be deleted and created again to change its:
- CPU, memory, or GPU resources
- OS type
- Restart policy
- Availability zone
A recreated group pulls all image layers fresh and can receive a new IP address, so give clients a DNS name label rather than an IP address. Terminated or deleted groups can't be updated at all; they're deployed as new.
⚠️ Exam Trap: Rerunning az container create with a larger --memory value against a running group doesn't resize it in place. Resource changes require delete and recreate. When a workload must grow and shrink with demand, Azure Container Apps (4.1.6.5) is the service with declarative scale rules.
⚠️ Common Pitfall: Using ACI for complex, multi-container applications that require service discovery, load balancing, and advanced orchestration. ACI is designed for simple, individual containers.
Key Trade-Offs:
- Simplicity (ACI) vs. Orchestration (AKS): ACI is simple and fast for single containers. AKS is more complex but provides robust orchestration for multi-container applications.
Reflection Question: How does creating and configuring Azure Container Instances, with its serverless nature and per-second billing, fundamentally provide the fastest and simplest way to run containers in Azure, minimizing infrastructure management and operational overhead?