我使用带多容器版本的elasticbeanstalk,并且我有带有boto3的docker容器。我想承担使用python将文件保存在S3上的作用。
基于以下问题:Fetching AWS instance metadata from within Docker container?urlopen('http://169.254.169.254/latest/meta-data/iam/instance-id-credentials/s3access').read().decode('utf-8')
返回404。
我不想在我的Docker镜像中使用硬编码的凭据。
有办法以某种方式扮演角色吗?
最佳答案
我通过以--net host
模式启动容器来完成这项工作。即使用主机的网络堆栈,使AWS认为您是从EC2主机请求。
这是提供此解决方案的注释:Fetching AWS instance metadata from within Docker container?
关于amazon-web-services - 如何承担在Elasticbeanstalk环境中运行的Docker容器中的AWS角色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48768156/