Closed hoyon closed 2 years ago
If you guys have the same issue with ECS on EC2, here's a way to fix this (with IMDSv2 best practices):
resource "aws_instance" ... {
metadata_options {
http_tokens = "required"
http_endpoint = "enabled"
http_put_response_hop_limit = 2 # https://stackoverflow.com/a/71884476/5692012
}
}
Environment
mix deps |grep ex_aws
: 2.3.0mix deps | grep hackney
: 1.18.1Current behavior
Running an elixir app with ex_aws on ECS fargate crashes on startup when using the latest version of ex_aws.
Error message:
I think this is because of the new IMDSv2 support added in this pr which crashes as the IMDSv2 endpoint isn't available on ECS fargate.
This command from the docs doesn't work on ECS fargate for example:
Instead
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
should be used as inExAws.InstanceMeta
Expected behavior
The app starts successfully without error and credentials are fetched using the existing
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
variable and doesn't attempt to use IMDSv2.