aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
kenny 2020-11-27T17:08:44.147Z

I have a task running on EC2 ECS and am using Cognitect's aws-api to make API calls. I am constructing a regular sts client (e.g., (aws/client {:api :sts})) and issuing an :AssumeRole API call. That call is failing with an anomaly saying "No region found by any region provider." I have traced the call back to the cognitect.aws.ec2-metadata-utils namespace. It is attempting to fetch the region from this endpoint "http://169.254.170.2/latest/dynamic/instance-identity/document". If I curl that endpoint from within my container, I get a 404. I can curl the credentials using curl <http://169.254.170.2>${AWS_CONTAINER_CREDENTIALS_RELATIVE_URI} and get a successful response. Any idea why the former endpoint used for the region is returning a 404?

kenny 2020-11-27T17:19:49.147800Z

I can work around this by setting the AWS_REGION env var. Curious how default region identification is supposed to work in EC2 ECS though.

ghadi 2020-11-27T17:23:21.148500Z

Do you have the instance metadata v1 service disabled @kenny ?

kenny 2020-11-27T17:23:39.148700Z

How would I know?

kenny 2020-11-27T17:24:11.149100Z

(Afaik, I did not explicitly disable it)

ghadi 2020-11-27T17:24:35.149500Z

Check the properties in the console

kenny 2020-11-27T17:25:36.149700Z

What am I looking for?

ghadi 2020-11-27T17:28:03.150200Z

Google imds v2, sorry afk

kenny 2020-11-27T17:37:56.150700Z

I see how to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-instance-metadata-service.html. Not seeing how to view the property from an already running instance though.

orestis 2020-11-27T17:40:17.151200Z

You need to relaunch afaik

kenny 2020-11-27T17:45:01.151700Z

This seems relevant here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/container-metadata.html#enable-metadata. Container metadata is disabled by default for ECS.

ghadi 2020-11-27T17:53:48.152100Z

That’s the wrong metadata service

ghadi 2020-11-27T17:53:57.152400Z

I thought EC2?

ghadi 2020-11-27T17:54:06.152700Z

@kenny

kenny 2020-11-27T18:21:04.153100Z

The issue is occurring inside a task that is running on ECS EC2.

viesti 2020-11-27T21:25:52.154300Z

hmm, I remember setting the AWS_REGION & AWS_DEFAULT_REGION to make python boto3 applications work when run on ECS

viesti 2020-11-27T21:26:54.155300Z

it didn't occur to me that the region would actually be available from the container metadata service