Guozhen AIGlobal AI field notes and model intelligence

English translation

AWS Cloud Fundamentals #12: Compute Services — EC2 and ECS

Published:

Category: AWS

Read time: 3 min

Reads: 0

Lesson #12Views are counted together with the original Chinese articleImages are preserved from the source page

AI Article Decision Snapshot

Turn the lesson into workflow, model, budget, and security checks before choosing tools.

Use this quick snapshot before leaving the article. It keeps the next search tied to practical AI software, model/API, cost, privacy, and implementation questions.

Workflow fit

Identify the real job behind the article: coding, research, document review, support, analytics, content, or internal automation.

Model or tool decision

Decide whether the next step is a software shortlist, an AI tool comparison, an API platform choice, or a model benchmark.

Budget and usage signal

Estimate seats, API calls, prompt volume, retries, review time, and fallback work before assuming the workflow is cheap.

Security and privacy review

Check whether source code, customer data, private documents, prompts, logs, or embeddings will enter the AI workflow.

In the previous tutorial, we explored AWS Auto Scaling and Elastic Load Balancing—services that enhance application availability and performance when handling large volumes of requests. In this tutorial, we’ll dive deeper into AWS compute services, focusing specifically on EC2 (Elastic Compute Cloud) and ECS (Elastic Container Service)—two powerful services designed to support diverse workloads.

EC2 (Elastic Compute Cloud)

EC2 is AWS’s foundational compute service, enabling users to create and manage virtual servers in the cloud. Each virtual server is called an instance, and users can select from a wide range of instance types based on their computational requirements.

EC2 Features

  • Elastic Scaling: Start or stop instances on demand to match workload fluctuations.
  • Multiple Instance Types: Offers various configurations optimized for different use cases—such as compute-intensive, memory-optimized, or storage-optimized workloads.
  • Flexible Pricing Models: Includes On-Demand, Reserved Instances, and Spot Instances—allowing cost optimization based on usage patterns.

Use Case

Suppose you need to deploy a web application. Here’s how you can use EC2:

  1. Log in to the AWS Management Console.
  2. Navigate to the EC2 service, then click the Launch Instance button.
  3. Select an AMI (Amazon Machine Image): For example, choose Ubuntu or Amazon Linux as your operating system.
  4. Choose an Instance Type: Select t2.micro (ideal for small-scale applications).
  5. Configure the Instance: Set up networking, security groups, and other options.
  6. Launch the Instance, then connect to it via SSH.

Here’s an example SSH connection command:

ssh -i your-key.pem ec2-user@your-instance-public-ip

ECS (Elastic Container Service)

ECS is AWS’s managed container orchestration service, enabling developers to easily deploy and manage containerized applications. ECS abstracts infrastructure management, natively supports Docker containers, and integrates seamlessly with other AWS services.

ECS Features

  • Serverless Option: Supports AWS Fargate—enabling fully managed, infrastructure-free container execution.
  • Native AWS Integration: Works seamlessly with services like Amazon CloudWatch and AWS IAM.
  • Docker Compatibility: Allows straightforward migration of existing Docker-based applications.

Use Case

Assume you have a web service built with Docker and want to run it on ECS. Follow these steps:

  1. Define a Task Definition: Specify the container configuration—including image, resource requirements (CPU/memory), and network settings.

Here’s a simple example task definition:

{
  "family": "web-app",
  "containerDefinitions": [
    {
      "name": "web",
      "image": "your-docker-image",
      "memory": 512,
      "cpu": 256,
      "essential": true,
      "portMappings": [
        {
          "containerPort": 80,
          "hostPort": 80
        }
      ]
    }
  ]
}
  1. Create an ECS Cluster: Launch a new ECS cluster via the AWS Management Console.
  2. Run a Service: Deploy your application using the previously defined task definition, specifying the desired number of running tasks.

EC2 vs. ECS: Key Differences

Choosing between EC2 and ECS depends on your application architecture and operational needs. EC2 provides full OS-level control and maximum configuration flexibility, while ECS simplifies deployment, scaling, and lifecycle management through container abstraction. For microservices architectures requiring rapid development and deployment cycles, ECS—especially with Fargate—is often the preferred choice.

Summary

In this tutorial, we examined two core AWS compute services: EC2 and ECS. EC2 delivers the flexibility and control of traditional virtual machines, whereas ECS offers an efficient, scalable platform for managing containerized applications. In practice, most organizations select the service best aligned with their specific workload, team expertise, and operational goals. In the next tutorial, we’ll explore AWS storage services—starting with Amazon S3—and cover fundamental concepts and practical usage patterns, ensuring a comprehensive understanding of the AWS cloud ecosystem.

Apply This Lesson

Turn this article into AI software, model, API, and security decisions.

English Article FAQ

Use this article as evidence before choosing AI tools

How should I use this AI Tutorials article?

Use it as the implementation or learning layer, then connect the idea to AI software buyer guides, tool comparisons, benchmarks, API choices, and security checks before making a production decision.

Is this English article different from the Chinese original?

The English edition is localized for global AI readers while preserving the original diagrams, screenshots, prompts, code examples, and source context from the Chinese article.

What should I read after AWS Cloud Fundamentals #12: Compute Services — EC2 and ECS?

Continue with AI Software Buyer Guides, AI Tools Workbench, Best AI Coding Agents, AI Model Benchmarks, OpenAI vs Anthropic API, or LLM Security Tools depending on the decision you need to make.

Can this article alone choose an AI product or model?

No. Treat the article as evidence and context, then validate fit with pricing, privacy requirements, integration effort, benchmark results, workflow tests, and fallback planning.

Continue

Keep reading from here

Browse English site

Reader Messages

Reader messages

Questions, corrections, extra sources, or hands-on results can be left here. No login is required.

Max 800 characters

To reduce spam, each message is checked for length, link count, and posting frequency.

0/800

Messages

0 messages
Loading messages...