CloudVectra Logo CloudVectra
CloudVectra Knowledge Hub

AWS Fargate vs. Azure Container Instances: When Serverless Containers Become Expensive

Model container task and group billing, startup time, allocation rounding, minimum durations, networking and job lifecycle costs in Fargate and ACI.

7 min read

A container that performs 30 seconds of useful work can create a longer billable lifetime. Image downloads, initialization, resource rounding, minimum billing periods, sidecars and a process that never exits all affect the result.

AWS Fargate and Azure Container Instances (ACI) remove direct host management for supported container workloads. They are not identical orchestration platforms. Compare the execution lifecycle and surrounding architecture before comparing per-second prices.

Calculations use illustrative USD rates, exclude grants and discounts, and specify their billing assumptions. The ECS versus Container Apps guide covers long-lived platform and replica decisions.

1. Task versus container group

Fargate supplies compute for ECS tasks and supported EKS pods. In an ECS task, containers share a task-level allocation and lifecycle constraints. An ECS service, Batch or another orchestration layer can launch and replace those tasks.

ACI bills a container group, which can contain multiple containers sharing networking and lifecycle. Treating each sidecar as an independent group can overcount; ignoring its contribution to the group’s required allocation can undercount.

Container job timeline separating image pull, initialization, useful execution and shutdown from the billed container lifetime.
QuestionFargateACI
What is the execution object?Task or supported podContainer group
Who runs service/job orchestration?ECS, EKS, Batch or other integrated controlYour workflow or supported higher-level integration
How is sizing selected?Supported CPU-memory combinationsRequested group resources with billing rounding
What remains separate?Network, registry, durable storage, logs and dependenciesNetwork, registry, durable storage, logs and dependencies

ACI has newer capabilities beyond a single container group, including supported multi-instance and standby options. Their capacity economics require a separate estimate. Do not assume an ordinary group includes Container Apps-style ingress autoscaling and application revision management.

2. Allocated CPU and memory determine compute cost

A general resource-duration model is:

Compute cost =
  billable seconds × (
    allocated vCPU × vCPU-second rate
    + billable memory units × memory-second rate
  )
  + applicable storage / OS / specialized-resource charges

Actual CPU utilization does not directly substitute for allocated CPU in this formula. A blocked container waiting for a database can remain billable at its full allocation.

Fargate pricing uses supported task/pod configurations, with separate OS and architecture considerations. ACI pricing describes group-level vCPU rounding up to whole cores and memory rounding up to tenths of a GB.

For an ACI request of 1.2 vCPU and 3.01 GB, that billing description yields 2 vCPU and 3.1 GB. Verify deployment constraints as well as rounding; a requested shape must be supported in the chosen environment.

3. When the billable clock starts and stops

AWS documents Fargate duration beginning when image download starts and ending when the task terminates. Linux billing has a one-minute minimum; Windows has a five-minute minimum, with per-second calculation beyond the minimum.

Microsoft describes ACI group duration starting with the first image pull for a new deployment, or restart for an existing group, and ending when the group stops. It uses per-second resource-duration billing. Do not apply Fargate’s one-minute Linux or five-minute Windows minimum to ACI merely because both run containers.

A process completion log is not proof that all containers have terminated. A sidecar, an incorrect entrypoint, a restart policy, or an idle loop can keep the group/task alive or cause another run.

Measure allocation and stop timestamps as well as business-operation duration. Also distinguish pre-allocation queue delay from billable startup time; every minute of elapsed waiting is not automatically charged compute.

4. Short-job example: startup and minimums

Suppose a Linux Fargate task allocates 1 vCPU and 2 GiB. Use illustrative rates of $0.04/vCPU-hour and $0.005/GiB-hour: $0.05 per allocated hour.

PhaseDuration
Image pull20 seconds
Initialization10 seconds
Useful execution30 seconds
Shutdown5 seconds
Total billed-lifecycle assumption65 seconds

For 10,000 tasks:

10,000 × (65 / 3,600) × $0.05 ≈ $9.03

Counting only 30 useful seconds would produce $4.17. If the complete Linux task lifetime were 40 seconds, the one-minute minimum would instead yield $8.33 for 10,000 tasks under the same assumed rates.

For an ACI comparison, use its measured group lifetime and billing-rounded allocation, not the Fargate task’s shape and minimum. Different image caching and startup behavior can change the real duration.

5. ACI allocation example

Assume the earlier 1.2-vCPU/3.01-GB request is billed as 2 vCPU and 3.1 GB. Use illustrative rates of $0.000012/vCPU-second and $0.0000015/GB-second. If the group runs for 600 billable seconds:

CPU = 600 × 2 × $0.000012 = $0.0144
Memory = 600 × 3.1 × $0.0000015 = $0.00279
Per-group compute = $0.01719
1,000 executions = $17.19

This is not a current regional quote. It excludes OS surcharges, registry, logs, storage and networking. It shows why an estimate using the unrounded 1.2 cores would materially understate the specified model.

Benchmark resource shapes against completion time. Halving CPU while doubling duration may save little or nothing, and could increase exposure to timeouts and retries.

6. Always-on containers: per-second does not mean low cost

A 2-vCPU/8-GiB container allocation at the earlier hourly rates costs $0.12/hour. Running for 730 hours costs $87.60/month; three such allocations cost $262.80 before dependencies.

A suitable VM-backed pool might have a lower sustained rate if workloads fit efficiently and the team can operate it. The comparison must include host overhead, resilience, patching, deployment capacity and unused space.

Serverless containers can still be appropriate at steady load when their operational benefits justify the premium. Conversely, sporadic workloads can lose their advantage if a large warm or standby pool remains allocated.

7. Storage, image registries and networking

Fargate includes a baseline ephemeral-storage allowance and charges for eligible configured additions. Ephemeral storage is not a durable backup. Supported EFS, EBS or external storage configurations have their own lifecycle and pricing.

ACI supports durable state through supported external services such as Azure Files. Account for capacity, transactions, networking and mount performance. Do not assume writing to a local container filesystem protects job outputs.

Public exposure and outbound connectivity need explicit design. Fargate task public IPv4 can incur address charges. For ACI, do not invent an equivalent per-task AWS IPv4 meter: identify actual Azure public-IP resources and service-specific charges.

Microsoft’s ACI VNet documentation requires NAT Gateway for supported outbound connectivity from VNet-deployed groups. Include the gateway, its address and processing path rather than estimating private execution as compute alone. Also include applicable transfer.

Large images increase pull time, registry activity and possible processing. Keep registries near execution where suitable, reuse layers sensibly and validate private registry access. A smaller image is valuable when it improves the actual billed or operational path.

8. Restart policies and orchestration can amplify work

A job needs an intentional success condition and restart policy. If successful work restarts automatically, the next execution can repeat charges and business actions.

Track logical jobs separately from attempts. A scheduler retry and container restart can combine, producing more runs than either configuration suggests. Persist completion state safely and make repeated writes idempotent.

For fleets of background work, use a queue or job platform rather than creating an unbounded number of independent containers. Admission limits, regional quotas, dependency capacity and maximum parallelism protect both reliability and spending.

Spot options can lower eligible execution rates, but lost work, checkpointing and deadline risk belong in the comparison. Discounted capacity does not guarantee availability.

9. Where each approach fits

PatternInitial fit to evaluateWhat can overturn the choice
ECS-integrated task/serviceFargateUnsupported shape, host features or sustained economics
Standalone Azure container jobACIRequired orchestration, scaling or network complexity
Large scheduled job fleetBatch or suitable managed job platformQueue semantics and startup/deadline requirements
Stable high-utilization portfolioVM-backed containersOperations burden and inefficient packing
Low-latency ready capacityDeliberately sized service/standby designIdle floor exceeding its business value

Compare successful jobs completed by deadline, not merely container-seconds. A faster option can cost more per hour and less per finished job.

10. Keep execution costs connected to ownership

A developer can fix an oversized container or missing termination. At organizational scale, the recurring questions are which jobs own the bill, whether retries are increasing, and who funds shared gateways and registries.

CloudVectra cost analysis and Cost Centers support those cost and ownership conversations. Anomaly detection helps surface unexpected expenditure for investigation.

Use task/group lifecycle data to establish the cause and verify the next run. A reduced container bill should remain visible alongside persistent storage and network costs.

Continue the compute series

Sources and further reading

Choose whether CloudVectra may load optional analytics. You can change this at any time.

Cookie names, providers, and retention