1

i would like to get my aws account id programmatically when running an application on AWS EKS on Fargate.

On EC2 instances I can simply call http://169.254.169.254/latest/dynamic/instance-identity/document but I can not on fargate.

Can I get the account id without using aws sts get-caller-identity?

Thanks for your help.

d.a.d.a
  • 1,296
  • 1
  • 12
  • 28

1 Answers1

-1

Calling the task metadata endpoint returns detailed data, including the task arn, which contains the account id.

I don't know if there is a better way of getting this information.

Related answer: https://stackoverflow.com/a/53113140/15910427