Skip to content
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

Feature request: Make enableAmazonUniqueId work for fargate(ECS) #109

Open
TysonAndre opened this issue Oct 4, 2023 · 0 comments
Open

Comments

@TysonAndre
Copy link
Contributor

TysonAndre commented Oct 4, 2023

EC2 is already implemented and uses https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-identity-documents.html , which does not exist for fargate

The IPv4 address 169.254.169.254 is a link-local address and is valid only from the instance.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html

https://stackoverflow.com/a/75993784 https://docs.aws.amazon.com/AmazonECS/latest/userguide/task-metadata-endpoint-v4-fargate.html#task-metadata-endpoint-v4-fargate-examples has fields such as dockerId/privateId. dockerId seems the most similar to instanceId.

The environment variable ECS_CONTAINER_METADATA_URI_V4 is set in AWS fargate platform 1.4.0+

DockerId
The Docker ID for the container.
When you use Fargate, the id is a 32-digit hex followed by a 10 digit number.

When querying the ${ECS_CONTAINER_METADATA_URI_V4} endpoint you are returned only metadata about the container itself. The following is an example output.

{
    "DockerId": "cd189a933e5849daa93386466019ab50-2495160603",

Aside: Multiple ECS containers can run on individual EC2 instances. I haven't checked what the endpoint currently does in that case. To preserve existing behavior, 169.254.169.254 (exports.AWS_UNIQUE_ID_URL) could be tried first: https://cloudonaut.io/ecs-vs-fargate-whats-the-difference/

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

No branches or pull requests

1 participant