amazon-web-services - 如何承担在Elasticbeanstalk环境中运行的Docker容器中的AWS角色?

标签 amazon-web-services docker amazon-s3 amazon-elastic-beanstalk boto3

我使用带多容器版本的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/

相关文章:

amazon-web-services - ECS CLI - 启动容器实例时挂载 EFS

ruby - 在 Amazon S3 对象上设置 noindex

amazon-web-services - 如何在 AWS DocumentDB 中编写联接查询

amazon-web-services - 如何获取 Amazon S3 中目录的上次修改日期?

Docker 数据卷容器。我似乎无法备份

docker - 容器构建错误 - 无法关闭容器 - 容器在关闭期间遇到错误

ruby-on-rails - 从Docker容器中管理Capistrano部署的SSH key

amazon - 同步 S3 存储桶

unit-testing - 模拟和单元测试此具有静态构建器的方法的最佳方法

amazon-web-services - 通过 Cloudformation 进行 Eventbrige X-Ray 配置