Skip to content

Fix agent update on ipv6-only instances - #4781

Merged
amogh09 merged 1 commit into
aws:devfrom
amogh09:ipv6-update-agent
Sep 16, 2025
Merged

amogh09 merged 1 commit into
aws:devfrom
amogh09:ipv6-update-agent

Conversation

@amogh09

@amogh09 amogh09 commented Sep 15, 2025 •

Copy link
Copy Markdown
Contributor

Summary

This change fixes a bug in agent update (UpdateContainerAgent API) handling for IPv6-only instances. The update location (S3 URL) streamed down to Agent is currently not IPv6 compatible, so as a temporary workaround, Agent needs to convert it to IPv6-only compatible (dualstack) S3 URL.

Legacy S3 URLs have format -

s3.<aws-region>.<partition-suffix>/bucketname

Dualstack S3 URLs have format -

s3.dualstack.<aws-region>.<partition-suffix>/bucketname

so, the conversion is rather simple and works for all partitions.

Testing

I made some temporary changes to make Agent think that it's running v1.98.0 with its corresponding build ID. Then I ran that Agent on an IPv6-only instance and called UpdateContainerAgentAPI on it. Update was successful.

Agent logs -

level=info time=2025-09-16T16:21:38Z msg="Starting Amazon ECS Agent" version="1.98.0" commit="7d5ec06f"
...
level=debug time=2025-09-16T16:22:05Z msg="Staging updateupdate{\n  ClusterArn: \"arn:aws:ecs:us-west-2:979604884904:cluster/default\",\n  ContainerInstanceArn: \"arn:aws:ecs:us-west-2:979604884904:container-instance/default/d8d3da61c4504e67bdfbf298f5e5bd79\",\n  MessageId: \"14def9e9-de8f-4654-8a9d-f0ef9867e870\",\n  UpdateInfo: {\n    Location: \"https://s3.us-west-2.amazonaws.com/amazon-ecs-agent-us-west-2/ecs-agent-v1.99.0.tar\",\n    Signature: \"d884c06823f46705f065d3c89b351295c07a6ca85d8cc1155a97bc162eae59c5\"\n  }\n}" module=updater.go
level=info time=2025-09-16T16:22:05Z msg="Converting agent update URL to dual-stack for IPv6" originalURL="https://s3.us-west-2.amazonaws.com/amazon-ecs-agent-us-west-2/ecs-agent-v1.99.0.tar" dualStackURL="https://s3.dualstack.us-west-2.amazonaws.com/amazon-ecs-agent-us-west-2/ecs-agent-v1.99.0.tar"
...
level=debug time=2025-09-16T16:22:13Z msg="Got perform update request" module=updater.go
level=debug time=2025-09-16T16:22:13Z msg="Shutting down task engine for final save" module=termination_handler.go
level=debug time=2025-09-16T16:22:13Z msg="Saving state before shutting down" module=termination_handler.go
level=info time=2025-09-16T16:22:13Z msg="Starting Amazon ECS Agent" version="1.99.0" commit="ad700257"

Introspection before/after -

[ec2-user@i-0859029921f52268e ~]$ curl -s http://localhost:51678/v1/metadata | python3 -mjson.tool
{
    "Cluster": "default",
    "ContainerInstanceArn": "arn:aws:ecs:us-west-2:979604884904:container-instance/default/d8d3da61c4504e67bdfbf298f5e5bd79",
    "Version": "Amazon ECS Agent - v1.98.0 (*7d5ec06f)"
}
[ec2-user@i-0859029921f52268e ~]$ curl -s http://localhost:51678/v1/metadata | python3 -mjson.tool
{
    "Cluster": "default",
    "ContainerInstanceArn": "arn:aws:ecs:us-west-2:979604884904:container-instance/default/d8d3da61c4504e67bdfbf298f5e5bd79",
    "Version": "Amazon ECS Agent - v1.99.0 (*ad700257)"
}

New tests cover the changes: yes

Description for the changelog

bugfix: Fix agent update handling for IPv6-only instances

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 marked this pull request as ready for review September 16, 2025 17:05
@amogh09
amogh09 requested a review from a team as a code owner September 16, 2025 17:05
@amogh09 amogh09 changed the title IPv6 update agent Fix agent update on ipv6-only instances Sep 16, 2025
@amogh09
amogh09 merged commit 6f648b7 into aws:dev Sep 16, 2025
@Yiyuanzzz Yiyuanzzz mentioned this pull request Sep 17, 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.

4 participants