ecs-task-discovery

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2025 License: MIT

README

license Go Report Card Go Reference Docker Pulls Agent Docker Pulls Example

ecs-task-discovery

ecs-task-discovery is a Go module that performs service discovery for ECS tasks.

Groupcache Task Discovery

The package groupcachediscovery implements task discovery for groupcache-enabled applications running on AWS ECS.

See package documentation here: groupcachediscovery

Find an example toy application using groupcache with groupcachediscovery here: https://github.com/udhos/kubecache/blob/main/cmd/kubecache/groupcache.go

Usage

See example: ./cmd/ecs-task-discovery-example/main.go

Build Example

./build.sh

Run example

export SERVICE=ecs-task-discovery-example

ecs-task-discovery-example

Testing agent

# mock metadata server
cd samples
python3 -m http.server 8000

# run agent pointing to mocked metadata
export FORCE_SINGLE_TASK=true
export ECS_CONTAINER_METADATA_URI_V4=http://localhost:8000
ecs-task-discovery-agent

curl localhost:8080/tasks/ecs-task-discovery-example

export ECS_TASK_DISCOVERY_AGENT_URL=http://localhost:8080/tasks
export ECS_CONTAINER_METADATA_URI_V4=http://localhost:8000
ecs-task-discovery-example

References

ECS Exec Checker

ECS Exec Checker: https://github.com/aws-containers/amazon-ecs-exec-checker

git clone https://github.com/aws-containers/amazon-ecs-exec-checker

cd amazon-ecs-exec-checker

./check-ecs-exec.sh demo 1641160e91d34bbf880549bde1981fb3

Execute command

aws ecs update-service \
    --task-definition miniapi \
    --cluster demo \
    --service demo \
    --enable-execute-command \
    --force-new-deployment

aws ecs execute-command --cluster demo \
    --task 1641160e91d34bbf880549bde1981fb3 \
    --container miniapi \
    --interactive \
    --command "/bin/sh"

Directories

Path Synopsis
cmd
ecs-task-discovery-agent
Package main implements the tool.
Package main implements the tool.
ecs-task-discovery-example
Package main implements the tool.
Package main implements the tool.
Package discovery discovers ecs tasks.
Package discovery discovers ecs tasks.
Package groupcachediscovery implements groupcache task discovery for ECS.
Package groupcachediscovery implements groupcache task discovery for ECS.
internal
shared
Package shared holds common resources.
Package shared holds common resources.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL