Skip to content

Comments

feat(ecs): add basic ECS service implementation#206

Merged
sivchari merged 9 commits intomainfrom
feat/ecs-basic-implementation
Feb 12, 2026
Merged

feat(ecs): add basic ECS service implementation#206
sivchari merged 9 commits intomainfrom
feat/ecs-basic-implementation

Conversation

@sivchari
Copy link
Owner

@sivchari sivchari commented Feb 6, 2026

Overview

This PR implements basic ECS (Elastic Container Service) service support for awsim.

Implemented APIs

Cluster Operations

  • CreateCluster - Create a new ECS cluster
  • DeleteCluster - Delete an existing cluster
  • DescribeClusters - Describe one or more clusters
  • ListClusters - List all clusters

Task Definition Operations

  • RegisterTaskDefinition - Register a new task definition
  • DeregisterTaskDefinition - Deregister a task definition

Task Operations

  • RunTask - Run tasks on a cluster
  • StopTask - Stop a running task
  • DescribeTasks - Describe one or more tasks

Service Operations

  • CreateService - Create a new ECS service
  • DeleteService - Delete an existing service
  • UpdateService - Update service configuration

Implementation Details

  • Protocol: AWS JSON 1.1 (via JSONProtocolService interface)
  • Target Prefix: AmazonEC2ContainerServiceV20141113
  • Storage: In-memory storage with sync.RWMutex for thread safety
  • ARN Format: Properly formatted ARNs for all resources

Changes

  • internal/service/ecs/service.go - Service registration and JSONProtocolService implementation
  • internal/service/ecs/handlers.go - DispatchAction and 12 handler implementations
  • internal/service/ecs/storage.go - Storage interface and MemoryStorage implementation
  • internal/service/ecs/types.go - Complete type definitions for requests/responses
  • test/integration/ecs_test.go - Integration tests for all APIs

Testing

  • All APIs tested with AWS SDK v2
  • Cluster lifecycle tests
  • Task definition registration and revision management
  • Task execution and stopping
  • Service creation, update, and deletion
  • ARN resolution tests

Checklist

  • Code follows project style guidelines
  • Integration tests added
  • All tests pass locally
  • Lint checks pass
  • Commit message follows conventional commits

Closes #14

@sivchari sivchari added the enhancement New feature or request label Feb 6, 2026
@sivchari sivchari marked this pull request as ready for review February 12, 2026 06:37
Implement basic ECS service with the following APIs:
- CreateCluster, DeleteCluster, DescribeClusters, ListClusters
- RegisterTaskDefinition, DeregisterTaskDefinition
- RunTask, StopTask, DescribeTasks
- CreateService, DeleteService, UpdateService

Add in-memory storage implementation with cluster, task definition,
task, and service management. Implement JSON protocol dispatcher
for AWS JSON 1.1 protocol.

Add integration tests for all implemented APIs.

Closes #14
- Add package comment to handlers.go
- Rename ECSService to ServiceResource to avoid stuttering
- Add status constants and use them throughout
- Refactor RunTask function to reduce length (funlen)
- Fix rangeValCopy by using index instead of value
- Fix prealloc by preallocating slice capacity
- Use range over int syntax for loop modernization
Add the ECS service import to cmd/awsim/main.go so that the ECS
service is registered via init() when the server starts. This fixes
the integration test failure where the JSON protocol dispatcher
could not find the AmazonEC2ContainerServiceV20141113 service.
- Add JSON tags to all data model structs (Cluster, TaskDefinition,
  Task, Container, ServiceResource, Deployment, Tag, etc.) to ensure
  proper serialization for AWS SDK compatibility
- Fix DeleteService to return "DRAINING" status instead of "INACTIVE"
  to match AWS ECS behavior
- Add custom Timestamp type that marshals to Unix epoch seconds
- AWS SDK expects timestamps as floating-point numbers, not RFC3339 strings
- Update Task and Deployment structs to use Timestamp type
- Add newTimestamp() helper function in storage
- Fix bindIP JSON tag to bindIp for tagliatelle linter
@sivchari sivchari force-pushed the feat/ecs-basic-implementation branch from b49d7d2 to 885378d Compare February 12, 2026 06:38
@github-actions
Copy link
Contributor

📊 Integration Test Coverage Report

Total Coverage: 65.0%

@sivchari sivchari merged commit 1536982 into main Feb 12, 2026
3 checks passed
@sivchari sivchari deleted the feat/ecs-basic-implementation branch February 12, 2026 06:40
@github-actions github-actions bot mentioned this pull request Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ECS: Service implementation

1 participant