Skip to content

IPv6-only support for awslogs logging driver#4577

Merged
amogh09 merged 11 commits into
aws:devfrom
amogh09:ipv6-awslogs
Apr 18, 2025
Merged

IPv6-only support for awslogs logging driver#4577
amogh09 merged 11 commits into
aws:devfrom
amogh09:ipv6-awslogs

Conversation

@amogh09
Copy link
Copy Markdown
Contributor

@amogh09 amogh09 commented Apr 17, 2025

Summary

For supporting awslogs driver in IPv6-only environments, the logging driver needs to consume dual stack CloudWatch Logs endpoints. However, awslogs logging driver in docker does not support enabling dual stack CloudWatch Logs endpoint. To workaround this limitation, this change makes Agent resolve the dual stack endpoint for the logging region and set it as awslogs-endpoint option in the logging driver configuration.

In the long term we will update awslogs driver in Docker to support dual stack endpoints so that Agent does not have to resolve the endpoint. But this solution is not prioritized currently.

Implementation details

  • DockerTaskEngine.createContainer method is updated so that it calls a new setAWSLogsDualStackEndpoint function if the instance is IPv6-only. This function uses cloudwatchlogs package from aws-sdk-go-v2 to resolve the dual stack endpoint for the logging region and set it as awslogs-endpoint key in the awslogs configuration.

Testing

New tests cover the changes: yes

Ran a task on an IPv6-only instance and verified that logs are published to CloudWatch Logs. Also verified in Agent logs that Agent resolved the dual stack endpoint.

/var/log/ecs/ecs-agent.log:level=info time=2025-04-17T17:57:44Z msg="Resolved dual stack endpoint" taskARN="arn:aws:ecs:us-west-2:979604884904:task/sc-test/34dd29214b604cc0bc5d5beb2c414c20" containerName="amazonlinux" endpoint="https://logs.us-west-2.api.aws" region="us-west-2"

Description for the changelog

Enhancement: Agent resolves CloudWatch Logs dual stack endpoint on IPv6-only instances and sets it as awslogs-endpoint option for awslogs logging driver

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

Does this PR include the addition of new environment variables in the README?

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@amogh09 amogh09 changed the title Ipv6 awslogs IPv6-only support for awslogs logging driver Apr 17, 2025
@amogh09 amogh09 marked this pull request as ready for review April 17, 2025 17:55
@amogh09 amogh09 requested a review from a team as a code owner April 17, 2025 17:55
Comment thread agent/engine/docker_task_engine.go Outdated
Comment thread agent/engine/docker_task_engine.go
Comment thread agent/engine/docker_task_engine.go Outdated
Comment thread agent/engine/docker_task_engine.go
Comment thread agent/engine/docker_task_engine.go
Comment thread agent/engine/docker_task_engine.go Outdated
TheanLim
TheanLim previously approved these changes Apr 18, 2025
Comment thread agent/engine/docker_task_engine.go Outdated
Comment thread agent/engine/docker_task_engine_test.go
Comment thread agent/engine/docker_task_engine.go Outdated
Comment thread agent/engine/docker_task_engine.go Outdated
Comment thread agent/engine/docker_task_engine_test.go
@amogh09 amogh09 enabled auto-merge (squash) April 18, 2025 19:10
@amogh09 amogh09 merged commit e50abf0 into aws:dev Apr 18, 2025
timj-hh pushed a commit to timj-hh/amazon-ecs-agent that referenced this pull request Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants