Pass AWS credentials (IAM role credentials) to code running in docker container

后端 未结 2 1212
粉色の甜心
粉色の甜心 2020-12-29 06:25

When running code on an EC2 instance, the SDK you use to access AWS resources, automagically talks to a locally linked web server on 169.254.169.254 and gets that instances

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 06:38

    The EC2 metadata service will usually be available from within docker (unless you use a more custom networking setup - see this answer on a similar question).

    If your docker network setup prevents it from being accessed, you might use the ENV directive in your Dockerfile or pass them directly during run, but keep in mind that credentials from IAM roles are automatically rotated by AWS.

提交回复
热议问题