Closed rasikmhetre closed 3 years ago
Thanks for pointing this out. Please see https://github.com/aws/amazon-ecs-agent/pull/2999 for the enhancement. Unfortunately, we can't specify the exact error at this time without significant effort. However, the reference to the public documentation added should suffice.
Please feel free to re-open if this solution is not satisfactory.
Summary
ECS Agent logging should be improved if the ecs-agent container is exiting with exit code 5 i.e. Error registering attributes: cluster.instance-identifier / Instance registration attempt with an invalid attribute
Description
Our custom ami sets the value of a custom attribute to register my container instance to the ECS cluster through the bootstrap script. It populates an entries in /etc/ecs/ecs.config file. It is very time-consuming to troubleshoot the issue with an error
Instance registration attempt with an invalid attribute
Expected Behavior
It should print something like
CharacterLimitExceeded
in the ecs-agent.log file if the attribute name of value exceeds the character limit size i.e. 128, that would be a very easy and time-saving process to troubleshoot the issue.Observed Behavior
If the ECS_INSTANCE_ATTRIBUTES value is above 128 characters, ecs-agent just exists or fails with the following error messages in the ecs-agent.log which doesn't help in troubleshooting the issue faster.
msg="Error registering attributes: cluster.instance-identifier" module=client.go msg="Error registering: Attribute validation failed" module=agent.go msg="Instance registration attempt with an invalid attribute" module=agent.go
Environment Details
Linux Environment
Supporting Log Snippets
level=error time=2021-08-05T08:40:13Z msg="Error registering attributes: cluster.instance-identifier" module=client.go level=error time=2021-08-05T08:40:13Z msg="Error registering: Attribute validation failed" module=agent.go level=critical time=2021-08-05T08:40:13Z msg="Instance registration attempt with an invalid attribute" module=agent.go