0 votes
1 view
in AWS by (19.2k points)

Is there a straightforward way to access AWS instance metadata from within a Docker container?

For example, when trying to fetch credentials for an IAM role on an EC2 instance, this would work on the instance itself:

...but not from within a Docker container running on that EC2 instance.

1 Answer

0 votes
by (44.6k points)

This container can be used to access EC2 metadata directly:

[email protected]:/# curl


  "Code" : "Success",

  "LastUpdated" : "2019-07-14T15:04:12Z",

  "Type" : "AWS-HMAC",

  "AccessKeyId" : "accesskey",

  "SecretAccessKey" : "secretkey",

  "Token" : "mytoken",

  "Expiration" : "2019-04-14T21:08:29Z"


Welcome to Intellipaat Community. Get your technical queries answered by top developers !