Envoy EDS Service that automatically updates upstreams from AWS
AWS Elastic Container Service.
Gets privateIPv4Address of EC2/Fargate Tasks.
Environmental Variable: _aws.ecs.clusterName__port (e.g. us-west-2-fargate_port=8080)
Default: 80
Reads SRV records from CloudMap
Environmental Variable: aws.cloudMap.serviceDiscoveryId _port (e.g. srv-1234_port=8080)
instance['AWS_INSTANCE_PORT'] from ListInstances CloudMap API
Default: 80
Environmental Variable: EDS_LISTEN (e.g. 127.0.0.1:8080)
Default: 0.0.0.0:5678
All responses cached for 30 seconds on successful response
eds-config.yaml
static_resources :
listeners :
- name : listener_0
address :
socket_address : { address: 0.0.0.0, port_value: 8080 }
filter_chains :
- filters :
- name : envoy.filters.network.http_connection_manager
typed_config :
" @type " : type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
stat_prefix : http_proxy
route_config :
name : local_route
virtual_hosts :
- name : local_service
domains : ["*"]
routes :
- match : { prefix: "/" }
route : { cluster: web }
http_filters :
- name : envoy.filters.http.router
clusters :
- name : web
connect_timeout : 10s
type : EDS
eds_cluster_config :
service_name : srv-qp3a4lugw4s5ei3a
eds_config :
resourceApiVersion : V3
api_config_source :
api_type : GRPC
transport_api_version : V3
grpc_services :
- envoy_grpc :
cluster_name : xds_cluster
- type : STATIC
connect_timeout : 10s
load_assignment :
cluster_name : xds_cluster
endpoints :
- lb_endpoints :
- endpoint :
address :
socket_address :
address : 10.0.0.5
port_value : 5678
http2_protocol_options : {}
name : xds_cluster
Dockerfile
FROM golang:1.16.4
ENV GOOS=linux
ENV GOARCH=amd64
COPY ./ /build
WORKDIR /build
RUN go mod vendor && go build -o aws-ecs-eds main.go
FROM amazonlinux:2
ENV EDS_LISTEN="0.0.0.0:5678"
EXPOSE 5678
WORKDIR /root/
COPY --from=0 /build/aws-ecs-eds /opt
CMD ["/opt/aws-ecs-eds" ]