Skip to content

Make ecs-anywhere-install.sh IPv6-only compatible #4747

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2025

Conversation

amogh09
Copy link
Contributor

@amogh09 amogh09 commented Aug 7, 2025

Summary

This change makes ecs-anywhere-install.sh script compatible with IPv6-only environments. It now auto-detects if the instance is IPv6-only by looking at default IPv4 and IPv6 routes. An override option --ip-compatibility ipv4|ipv6 is also provided so that users can turn off auto-detection if it's not working as expected.

For IPv6-only environments, the script -

  1. Creates an amazon-ssm-agent configuration file at /etc/amazon/ssm/amazon-ssm-agent.json with contents like below. These are dualstack endpoints of key SSM Agent dependencies as the current version of SSM Agent is not compatible with IPv6-only environments without such manual configuration.
{
        "Ssm": {
                "Endpoint": "https://ssm.ap-northeast-2.api.aws"
        },
        "Mgs": {
                "Endpoint": "https://ssmmessages.ap-northeast-2.api.aws"
        },
        "Mds": {
                "Endpoint": "https://ec2messages.ap-northeast-2.api.aws"
        }
}

This is a temporary workaround until we have an SSM Agent version that is IPv6-only compatible out of the box.

  1. Makes the S3 URLs used for downloading various files us dualstack endpoints which are compatible with IPv6-only environments.

Testing

Tested on CentOS 9 and Amazon Linux 2023 running in IPv6-only networks. The script correctly auto-detected IPv6-only environment on these instances and successfully registered the instance with ECS. Also tested that the new --ip-compatibility command line argument works as expected and overrides auto-detection.

New tests cover the changes: NA

Description for the changelog

Enhancement: Make ecs-anywhere-install.sh compatible with IPv6-only environments

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 base branch from dev to feature/ipv6-only August 7, 2025 00:00
@amogh09 amogh09 force-pushed the ipv6-anywhere-install branch from b0df987 to 50e5cd6 Compare August 7, 2025 00:18
@amogh09 amogh09 force-pushed the ipv6-anywhere-install branch from b628b44 to b89b33e Compare August 7, 2025 15:33
@amogh09 amogh09 changed the title Ipv6 anywhere install Make ecs-anywhere-install.sh IPv6-only compatible Aug 7, 2025
@amogh09 amogh09 marked this pull request as ready for review August 7, 2025 16:04
@amogh09 amogh09 requested a review from a team as a code owner August 7, 2025 16:04
local ssm_config_file="$ssm_config_dir/amazon-ssm-agent.json"

if [ -f "$ssm_config_file" ]; then
echo "SSM agent configuration file already exists at $ssm_config_file, skipping creation."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where a customer would create this file and prevent the updating to ipv6 corrected endpoints?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not known but my thought is that the script should honor pre-existing configuration and assume it to work correctly.

@amogh09 amogh09 merged commit cba079f into aws:feature/ipv6-only Aug 7, 2025
40 of 42 checks passed
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