https://github.com/udhos/ecs-task-discovery
ecs-task-discovery is a Go module that performs service discovery for ECS tasks.
https://github.com/udhos/ecs-task-discovery
aws discovery ecs go go-module golang module
Last synced: 11 months ago
JSON representation
ecs-task-discovery is a Go module that performs service discovery for ECS tasks.
- Host: GitHub
- URL: https://github.com/udhos/ecs-task-discovery
- Owner: udhos
- License: mit
- Created: 2025-02-05T00:26:51.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-02-20T01:26:54.000Z (11 months ago)
- Last Synced: 2025-02-20T02:26:41.963Z (11 months ago)
- Topics: aws, discovery, ecs, go, go-module, golang, module
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/udhos/ecs-task-discovery/blob/main/LICENSE)
[](https://goreportcard.com/report/github.com/udhos/ecs-task-discovery)
[](https://pkg.go.dev/github.com/udhos/ecs-task-discovery)
[](https://hub.docker.com/r/udhos/ecs-task-discovery-agent)
[](https://hub.docker.com/r/udhos/ecs-task-discovery-example)
# ecs-task-discovery
[ecs-task-discovery](https://github.com/udhos/ecs-task-discovery?tab=readme-ov-file) is a Go module that performs service discovery for ECS tasks.
# Usage
See example: [./cmd/ecs-task-discovery-example/main.go](./cmd/ecs-task-discovery-example/main.go)
# Build Example
```bash
./build.sh
```
# Run example
```bash
export SERVICE=ecs-task-discovery-example
ecs-task-discovery-example
```
# Testing agent
```bash
# 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
```bash
git clone https://github.com/aws-containers/amazon-ecs-exec-checker
cd amazon-ecs-exec-checker
./check-ecs-exec.sh demo 1641160e91d34bbf880549bde1981fb3
```
## Execute command
```bash
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"
```